Program: 13190
Project: 13190
Buggy source:
@Override public Promise<QueryResponse,ResourceException> queryCollection(final Context context,final QueryRequest request,final QueryResourceHandler handler){
  logger.debug("String_Node_Str",name,request.getResourcePath());
  QueryRequest repoRequest=Requests.copyOfQueryRequest(request);
  repoRequest.setResourcePath(repoId(null));
  String executeOnRetrieve=request.getAdditionalParameter("String_Node_Str");
  final boolean onRetrieve=executeOnRetrieve == null ? false : Boolean.parseBoolean(executeOnRetrieve);
  final List<Map<String,Object>> results=new ArrayList<Map<String,Object>>();
  final ResourceException[] ex=new ResourceException[]{null};
  try {
    QueryResponse queryResponse=connectionFactory.getConnection().query(context,repoRequest,new QueryResourceHandler(){
      @Override public boolean handleResource(      ResourceResponse resource){
        if (onRetrieve) {
          try {
            onRetrieve(context,request,resource.getId(),resource);
          }
 catch (          ResourceException e) {
            ex[0]=e;
            return false;
          }
        }
        results.add(resource.getContent().asMap());
        if (ContextUtil.isExternal(context)) {
          return handler.handleResource(cullPrivateProperties(resource));
        }
        return handler.handleResource(resource);
      }
    }
);
    if (ex[0] == null) {
      return newExceptionPromise(ex[0]);
    }
    activityLogger.log(context,request,"String_Node_Str" + request.getQueryId() + "String_Node_Str"+ request.getAdditionalParameters(),request.getQueryId(),null,new JsonValue(results),Status.SUCCESS);
    return newResultPromise(queryResponse);
  }
 catch (  ResourceException e) {
    return newExceptionPromise(e);
  }
}

Fixed version (ground truth):
@Override public Promise<QueryResponse,ResourceException> queryCollection(final Context context,final QueryRequest request,final QueryResourceHandler handler){
  logger.debug("String_Node_Str",name,request.getResourcePath());
  QueryRequest repoRequest=Requests.copyOfQueryRequest(request);
  repoRequest.setResourcePath(repoId(null));
  String executeOnRetrieve=request.getAdditionalParameter("String_Node_Str");
  final boolean onRetrieve=executeOnRetrieve == null ? false : Boolean.parseBoolean(executeOnRetrieve);
  final List<Map<String,Object>> results=new ArrayList<Map<String,Object>>();
  final ResourceException[] ex=new ResourceException[]{null};
  try {
    QueryResponse queryResponse=connectionFactory.getConnection().query(context,repoRequest,new QueryResourceHandler(){
      @Override public boolean handleResource(      ResourceResponse resource){
        if (onRetrieve) {
          try {
            onRetrieve(context,request,resource.getId(),resource);
          }
 catch (          ResourceException e) {
            ex[0]=e;
            return false;
          }
        }
        results.add(resource.getContent().asMap());
        if (ContextUtil.isExternal(context)) {
          return handler.handleResource(cullPrivateProperties(resource));
        }
        return handler.handleResource(resource);
      }
    }
);
    if (ex[0] != null) {
      return newExceptionPromise(ex[0]);
    }
    activityLogger.log(context,request,"String_Node_Str" + request.getQueryId() + "String_Node_Str"+ request.getAdditionalParameters(),request.getQueryId(),null,new JsonValue(results),Status.SUCCESS);
    return newResultPromise(queryResponse);
  }
 catch (  ResourceException e) {
    return newExceptionPromise(e);
  }
}