Program: 50941
Project: 50941
Buggy source:
/** 
 * Returns the list of modules
 * @return
 */
@GET @Path(REST_API_MODULES) @Produces(MediaType.APPLICATION_JSON) public Response findModules(@QueryParam(REST_QUERY_TECHID) String techId,@QueryParam(REST_QUERY_TYPE) String type,@QueryParam(REST_QUERY_CUSTOMERID) String customerId){
  if (isDebugEnabled) {
    S_LOGGER.debug("String_Node_Str" + techId + type);
  }
  List<ModuleGroup> foundModules=new ArrayList<ModuleGroup>();
  try {
    if (techId != null && type != null && customerId != null && type.equals(REST_QUERY_TYPE_MODULE)) {
      Criteria criteria=Criteria.where(REST_QUERY_TECHID).is(techId).and(REST_QUERY_TYPE).is(REST_QUERY_TYPE_MODULE).and(REST_QUERY_CUSTOMERID).is(DEFAULT_CUSTOMER_NAME);
      foundModules=mongoOperation.find(MODULES_COLLECTION_NAME,new Query(criteria),ModuleGroup.class);
      if (!customerId.equals(DEFAULT_CUSTOMER_NAME)) {
        Criteria customerCriteria=Criteria.where(REST_QUERY_TECHID).is(techId).and(REST_QUERY_TYPE).is(REST_QUERY_TYPE_MODULE).and(REST_QUERY_CUSTOMERID).is(customerId);
        foundModules.addAll(mongoOperation.find(MODULES_COLLECTION_NAME,new Query(customerCriteria),ModuleGroup.class));
      }
      return Response.status(Response.Status.OK).entity(foundModules).build();
    }
    if (techId != null && type != null && customerId != null && type.equals(REST_QUERY_TYPE_JS)) {
      Criteria criteria=Criteria.where(REST_QUERY_TECHID).is(techId).and(REST_QUERY_TYPE).is(REST_QUERY_TYPE_MODULE).and(REST_QUERY_CUSTOMERID).is(DEFAULT_CUSTOMER_NAME);
      foundModules=mongoOperation.find(MODULES_COLLECTION_NAME,new Query(criteria),ModuleGroup.class);
      if (!customerId.equals(DEFAULT_CUSTOMER_NAME)) {
        Criteria customerCriteria=Criteria.where(REST_QUERY_TECHID).is(techId).and(REST_QUERY_TYPE).is(REST_QUERY_TYPE_MODULE).and(REST_QUERY_CUSTOMERID).is(customerId);
        foundModules.addAll(mongoOperation.find(MODULES_COLLECTION_NAME,new Query(customerCriteria),ModuleGroup.class));
      }
      return Response.status(Response.Status.OK).entity(foundModules).build();
    }
    if (techId != null && type != null) {
      foundModules=mongoOperation.find(MODULES_COLLECTION_NAME,new Query(Criteria.where(REST_QUERY_CUSTOMERID).is(DEFAULT_CUSTOMER_NAME)),ModuleGroup.class);
      return Response.status(Response.Status.OK).entity(foundModules).build();
    }
  }
 catch (  Exception e) {
    throw new PhrescoWebServiceException(e,EX_PHEX00005,MODULES_COLLECTION_NAME);
  }
  return Response.status(Response.Status.BAD_REQUEST).build();
}

Fixed version (ground truth):
/** 
 * Returns the list of modules
 * @return
 */
@GET @Path(REST_API_MODULES) @Produces(MediaType.APPLICATION_JSON) public Response findModules(@QueryParam(REST_QUERY_TECHID) String techId,@QueryParam(REST_QUERY_TYPE) String type,@QueryParam(REST_QUERY_CUSTOMERID) String customerId){
  if (isDebugEnabled) {
    S_LOGGER.debug("String_Node_Str" + techId + type);
  }
  List<ModuleGroup> foundModules=new ArrayList<ModuleGroup>();
  try {
    if (techId != null && type != null && customerId != null && type.equals(REST_QUERY_TYPE_MODULE)) {
      Criteria criteria=Criteria.where(REST_QUERY_TECHID).is(techId).and(REST_QUERY_TYPE).is(REST_QUERY_TYPE_MODULE).and(REST_QUERY_CUSTOMERID).is(DEFAULT_CUSTOMER_NAME);
      foundModules=mongoOperation.find(MODULES_COLLECTION_NAME,new Query(criteria),ModuleGroup.class);
      if (!customerId.equals(DEFAULT_CUSTOMER_NAME)) {
        Criteria customerCriteria=Criteria.where(REST_QUERY_TECHID).is(techId).and(REST_QUERY_TYPE).is(REST_QUERY_TYPE_MODULE).and(REST_QUERY_CUSTOMERID).is(customerId);
        foundModules.addAll(mongoOperation.find(MODULES_COLLECTION_NAME,new Query(customerCriteria),ModuleGroup.class));
      }
      return Response.status(Response.Status.OK).entity(foundModules).build();
    }
    if (techId != null && type != null && customerId != null && type.equals(REST_QUERY_TYPE_JS)) {
      Criteria criteria=Criteria.where(REST_QUERY_TECHID).is(techId).and(REST_QUERY_TYPE).is(REST_QUERY_TYPE_JS).and(REST_QUERY_CUSTOMERID).is(DEFAULT_CUSTOMER_NAME);
      foundModules=mongoOperation.find(MODULES_COLLECTION_NAME,new Query(criteria),ModuleGroup.class);
      if (!customerId.equals(DEFAULT_CUSTOMER_NAME)) {
        Criteria customerCriteria=Criteria.where(REST_QUERY_TECHID).is(techId).and(REST_QUERY_TYPE).is(REST_QUERY_TYPE_JS).and(REST_QUERY_CUSTOMERID).is(customerId);
        foundModules.addAll(mongoOperation.find(MODULES_COLLECTION_NAME,new Query(customerCriteria),ModuleGroup.class));
      }
      return Response.status(Response.Status.OK).entity(foundModules).build();
    }
    if (techId != null && type != null) {
      foundModules=mongoOperation.find(MODULES_COLLECTION_NAME,new Query(Criteria.where(REST_QUERY_CUSTOMERID).is(DEFAULT_CUSTOMER_NAME)),ModuleGroup.class);
      return Response.status(Response.Status.OK).entity(foundModules).build();
    }
  }
 catch (  Exception e) {
    throw new PhrescoWebServiceException(e,EX_PHEX00005,MODULES_COLLECTION_NAME);
  }
  return Response.status(Response.Status.BAD_REQUEST).build();
}