String index out of range: -1 error when to use Query.setCriteria (Doc ID 2262593.1)

Last updated on MAY 05, 2017

Applies to:

Oracle Agile PLM Framework - Version 9.3.5.0 and later
Information in this document applies to any platform.

Symptoms

On : 9.3.5.0 version, Searches

When attempting to use IQuery to search Parts,
the following error occurs.

ERROR
-----------------------
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1931)
at com.agile.apibean.objects.query.Query.compareAttributeNames(Query.java:2561)
at com.agile.apibean.objects.query.Query.getSearchableAttribute(Query.java:841)
at com.agile.apibean.objects.query.Query.apply(Query.java:1304)
at com.agile.apibean.objects.query.Query.apply(Query.java:1094)
at com.agile.apibean.objects.query.Query.apply(Query.java:1101)
at com.agile.apibean.objects.query.Query.setCriteria(Query.java:808)
at com.agile.apibean.objects.query.Query.setCriteria(Query.java:683)
at com.agile.apibean.objects.QueryOperations.setCriteria(QueryOperations.java:50)
at com.agile.apibean.APISessionBean.setCriteria(APISessionBean.java:305)


STEPS
-----------------------
The issue can be reproduced at will with the following steps:
1. Code with samples:
IAgileSession session = fac.createSession(map);
session.setDateFormats(new DateFormat[] {new SimpleDateFormat("MM/dd/yyyy")});
IQuery query = (IQuery)session.createObject(IQuery.OBJECT_TYPE, ItemConstants.CLASS_PARTS_CLASS);
Query_STR="03/31/2017";
query.setCriteria(
"[Title Block.Part Type] in ('Part-EE Component') and " +
"[Change History.Rev] in ('1A') and " +
"[Change History.Rel Date] Equal to (%0)",new String[] {Query_STR});
ITable tabs = query.execute();
Iterator it = tabs.iterator();
while (it.hasNext()){
   IRow row = (IRow)it.next();
   System.out.println(row);;
}

2. Run it

3. Will see code fails and error


Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms