Program: 25302
Project: 25302
Buggy source:
/** 
 * Cancel all the queries in query server; can be filtered with state and user.
 * @param sessionid The session in which cancel is issued
 * @param state If any state is passed, all the queries in that state will be cancelled, otherwise all queries will be cancelled. Possible states are  {@value QueryStatus.Status#values()} The queries in{@value QueryStatus.Status#FAILED},  {@value QueryStatus.Status#FAILED},   {@value QueryStatus.Status#CLOSED},  {@value QueryStatus.Status#UNKNOWN} cannot be cancelled
 * @param user If any user is passed, all the queries submitted by the user will be cancelled, otherwise all the queries will be cancelled
 * @param queryName Cancel queries matching the query name
 * @param fromDate the from date
 * @param toDate the to date
 * @return APIResult with state {@value Status#SUCCEEDED} in case of successful cancellation. APIResult with state{@value Status#FAILED} in case of cancellation failure. APIResult with state {@value Status#PARTIAL} incase of partial cancellation.
 */
@DELETE @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_PLAIN}) public APIResult cancelAllQueries(@QueryParam("String_Node_Str") LensSessionHandle sessionid,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String state,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String user,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String queryName,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") long fromDate,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") long toDate){
  checkSessionId(sessionid);
  int numCancelled=0;
  List<QueryHandle> handles=null;
  boolean failed=false;
  try {
    handles=getAllQueries(sessionid,state,queryName,user,fromDate,toDate == -1L ? Long.MAX_VALUE : toDate);
    for (    QueryHandle handle : handles) {
      if (cancelQuery(sessionid,handle)) {
        numCancelled++;
      }
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    failed=true;
  }
  String msgString=(StringUtils.isBlank(state) ? "String_Node_Str" : "String_Node_Str" + state) + (StringUtils.isBlank(user) ? "String_Node_Str" : "String_Node_Str" + user);
  if (handles != null && numCancelled == handles.size()) {
    return new APIResult(Status.SUCCEEDED,"String_Node_Str" + msgString + "String_Node_Str");
  }
 else {
    assert(failed);
    if (numCancelled == 0) {
      return new APIResult(Status.FAILED,"String_Node_Str" + msgString + "String_Node_Str");
    }
 else {
      return new APIResult(Status.PARTIAL,"String_Node_Str" + msgString + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Cancel all the queries in query server; can be filtered with state and user.
 * @param sessionid The session in which cancel is issued
 * @param state If any state is passed, all the queries in that state will be cancelled, otherwise all queries will be cancelled. Possible states are  {@value QueryStatus.Status#values()} The queries in{@value QueryStatus.Status#FAILED},   {@value QueryStatus.Status#CLOSED},  {@value QueryStatus.Status#SUCCESSFUL} cannot be cancelled
 * @param user If any user is passed, all the queries submitted by the user will be cancelled, otherwise all the queries will be cancelled
 * @param queryName Cancel queries matching the query name
 * @param fromDate the from date, inclusive(submitTime>=fromDate)
 * @param toDate the to date, inclusive(toDate>=submitTime)
 * @return APIResult with state {@value Status#SUCCEEDED} in case of successful cancellation. APIResult with state{@value Status#FAILED} in case of cancellation failure. APIResult with state {@value Status#PARTIAL} incase of partial cancellation.
 */
@DELETE @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_PLAIN}) public APIResult cancelAllQueries(@QueryParam("String_Node_Str") LensSessionHandle sessionid,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String state,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String user,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") String queryName,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") long fromDate,@DefaultValue("String_Node_Str") @QueryParam("String_Node_Str") long toDate){
  checkSessionId(sessionid);
  int numCancelled=0;
  List<QueryHandle> handles=null;
  boolean failed=false;
  try {
    handles=getAllQueries(sessionid,state,queryName,user,fromDate,toDate == -1L ? Long.MAX_VALUE : toDate);
    for (    QueryHandle handle : handles) {
      if (cancelQuery(sessionid,handle)) {
        numCancelled++;
      }
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    failed=true;
  }
  String msgString=(StringUtils.isBlank(state) ? "String_Node_Str" : "String_Node_Str" + state) + (StringUtils.isBlank(user) ? "String_Node_Str" : "String_Node_Str" + user);
  if (handles != null && numCancelled == handles.size()) {
    return new APIResult(Status.SUCCEEDED,"String_Node_Str" + msgString + "String_Node_Str");
  }
 else {
    assert(failed);
    if (numCancelled == 0) {
      return new APIResult(Status.FAILED,"String_Node_Str" + msgString + "String_Node_Str");
    }
 else {
      return new APIResult(Status.PARTIAL,"String_Node_Str" + msgString + "String_Node_Str");
    }
  }
}