Program: 29903
Project: 29903
Buggy source:
/** 
 * Perform an object query for the given table and query parameters. The table must belong to this session's OLAP application. Recognized query parameters are: <table> <tr><td>Name</td><td>Value</td><td>Description</td></tr> <tr><td>q</td> <td>query expression</td> <td>Required. Query expression that selects objects in the table. "*" selects all objects.</td> </tr> <tr><td>f</td> <td>field list</td> <td>Comma-separated list of fields to return in the query.</td> </tr> <tr><td>s</td> <td>integer</td> <td>Number of objects to return in the page. Defaults to the value configured for the server. 0 means "all objects".</td> </tr> <tr><td>o</td> <td>field [ASC|DESC]</td> <td>Order the results by the given scalar field name, optionally followed by ASC (ascending, the default) or DESC (descending).</td> </tr> <tr><td>k</td> <td>integer</td> <td>Skip the given number of objects, thereby returning a secondary page of results.</td> </tr> <tr><td>shards</td> <td>shard list</td> <td>Comma-separated list of shards to query. Either this or the "range" parameter must be provided, but not both.</td> </tr> <tr><td>range</td> <td><i>shard-from</i>[,<i>shard-to</i>]</td> <td>Defines a range of shards to query beginning with shards whose name is greater than or equal to the <i>shard-from</i> name. If a <i>shard-to</i> name is given, shard names must also be less than or equal to that name. Either this or the "shards" parameter must be provided, but not both.</td> </tr> </table> If the "k" is not given, the first page of the query is returned. Results are returned in a   {@link QueryResult} object. An exception is thrown if a parameter isinvalid or a database error occurs.
 * @param tableName Name of table to query. 
 * @param params    Names and values of query parameters. 
 * @return          {@link QueryResult} containing results.
 */
@Override public QueryResult objectQuery(String tableName,Map<String,String> params){
  Utils.require(tableName != null,"String_Node_Str");
  Utils.require(params != null,"String_Node_Str");
  TableDefinition tableDef=m_appDef.getTableDef(tableName);
  Utils.require(tableDef != null,"String_Node_Str",tableName);
  StringBuilder uri=new StringBuilder();
  uri.append(uriRoot());
  uri.append(Utils.urlEncode(tableDef.getAppDef().getAppName()));
  uri.append("String_Node_Str");
  uri.append(Utils.urlEncode(tableDef.getTableName()));
  uri.append("String_Node_Str");
  Utils.require(params.containsKey("String_Node_Str"),"String_Node_Str");
  uri.append("String_Node_Str");
  uri.append(Utils.urlEncode(params.get("String_Node_Str")));
  for (  String name : params.keySet()) {
    String value=params.get(name);
switch (name) {
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
      uri.append("String_Node_Str");
    uri.append(name);
  uri.append("String_Node_Str");
uri.append(Utils.urlEncode(value));
break;
case "String_Node_Str":
break;
default :
Utils.require(false,"String_Node_Str",name);
}
}
try {
RESTResponse response=m_restClient.sendRequest(HttpMethod.GET,uri.toString());
m_logger.debug("String_Node_Str",response.toString());
QueryResult result=null;
if (response.getCode() != HttpCode.OK) {
result=new QueryResult(tableDef,response.getBody());
}
 else {
result=new QueryResult(tableDef,getUNodeResult(response));
}
return result;
}
 catch (Exception e) {
throw new RuntimeException(e);
}
}

Fixed version (ground truth):
/** 
 * Perform an object query for the given table and query parameters. The table must belong to this session's OLAP application. Recognized query parameters are: <table> <tr><td>Name</td><td>Value</td><td>Description</td></tr> <tr><td>q</td> <td>query expression</td> <td>Required. Query expression that selects objects in the table. "*" selects all objects.</td> </tr> <tr><td>f</td> <td>field list</td> <td>Comma-separated list of fields to return in the query.</td> </tr> <tr><td>s</td> <td>integer</td> <td>Number of objects to return in the page. Defaults to the value configured for the server. 0 means "all objects".</td> </tr> <tr><td>o</td> <td>field [ASC|DESC]</td> <td>Order the results by the given scalar field name, optionally followed by ASC (ascending, the default) or DESC (descending).</td> </tr> <tr><td>k</td> <td>integer</td> <td>Skip the given number of objects, thereby returning a secondary page of results.</td> </tr> <tr><td>shards</td> <td>shard list</td> <td>Comma-separated list of shards to query. Either this or the "range" parameter must be provided, but not both.</td> </tr> <tr><td>range</td> <td><i>shard-from</i>[,<i>shard-to</i>]</td> <td>Defines a range of shards to query beginning with shards whose name is greater than or equal to the <i>shard-from</i> name. If a <i>shard-to</i> name is given, shard names must also be less than or equal to that name. Either this or the "shards" parameter must be provided, but not both.</td> </tr> </table> If the "k" is not given, the first page of the query is returned. Results are returned in a   {@link QueryResult} object. An exception is thrown if a parameter isinvalid or a database error occurs.
 * @param tableName Name of table to query. 
 * @param params    Names and values of query parameters. 
 * @return          {@link QueryResult} containing results.
 */
@Override public QueryResult objectQuery(String tableName,Map<String,String> params){
  Utils.require(tableName != null,"String_Node_Str");
  Utils.require(params != null,"String_Node_Str");
  TableDefinition tableDef=m_appDef.getTableDef(tableName);
  Utils.require(tableDef != null,"String_Node_Str",tableName);
  StringBuilder uri=new StringBuilder("String_Node_Str");
  uri.append(Utils.urlEncode(tableDef.getAppDef().getAppName()));
  uri.append("String_Node_Str");
  uri.append(Utils.urlEncode(tableDef.getTableName()));
  uri.append("String_Node_Str");
  Utils.require(params.containsKey("String_Node_Str"),"String_Node_Str");
  uri.append("String_Node_Str");
  uri.append(Utils.urlEncode(params.get("String_Node_Str")));
  for (  String name : params.keySet()) {
    String value=params.get(name);
switch (name) {
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
case "String_Node_Str":
      uri.append("String_Node_Str");
    uri.append(name);
  uri.append("String_Node_Str");
uri.append(Utils.urlEncode(value));
break;
case "String_Node_Str":
break;
default :
Utils.require(false,"String_Node_Str",name);
}
}
addTenantParam(uri);
try {
RESTResponse response=m_restClient.sendRequest(HttpMethod.GET,uri.toString());
m_logger.debug("String_Node_Str",response.toString());
QueryResult result=null;
if (response.getCode() != HttpCode.OK) {
result=new QueryResult(tableDef,response.getBody());
}
 else {
result=new QueryResult(tableDef,getUNodeResult(response));
}
return result;
}
 catch (Exception e) {
throw new RuntimeException(e);
}
}