Program: 20085
Project: 20085
Buggy source:
public static EndpointInformations queryEndpoints(CoreSession documentManager,String search,String subProjectId,String visibility) throws Exception {
  DocumentService documentService=Framework.getService(DocumentService.class);
  boolean searchParamIncluded=false;
  ArrayList<String> parameters=new ArrayList<String>();
  StringBuilder query=new StringBuilder();
  query.append("String_Node_Str");
  if (search != null && !"String_Node_Str".equals(search)) {
    String searchParam="String_Node_Str" + search + "String_Node_Str";
    query.append("String_Node_Str" + "String_Node_Str" + SoaNode.XPATH_SOANAME + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ WsdlInfoFacet.XPATH_WSDL_PORTTYPE_NAME+ "String_Node_Str");
    parameters.add(searchParam);
    parameters.add(searchParam);
    parameters.add(searchParam);
    parameters.add(searchParam);
    searchParamIncluded=true;
  }
  if (subProjectId != null && !"String_Node_Str".equals(subProjectId)) {
    String subProjectCriterias="String_Node_Str";
    DocumentModel subProjectModel=SubprojectServiceImpl.getSubprojectById(documentManager,subProjectId);
    if (subProjectModel != null) {
      subProjectCriterias=SubprojectServiceImpl.buildCriteriaSeenFromSubproject(subProjectModel,visibility);
      if (searchParamIncluded) {
        query.append("String_Node_Str").append(subProjectCriterias);
      }
 else {
        query.append("String_Node_Str").append(subProjectCriterias);
      }
    }
 else {
      throw new Exception("String_Node_Str" + subProjectId + "String_Node_Str");
    }
  }
  String nxqlQuery=NXQLQueryBuilder.getQuery(query.toString(),parameters.toArray(),false,true);
  DocumentModelList soaNodeModelList=documentService.query(documentManager,nxqlQuery,true,false);
  EndpointInformations endpointInformations=new EndpointInformations();
  for (  DocumentModel soaNodeModel : soaNodeModelList) {
    endpointInformations.addEndpointInformation(SoaNodeInformationToWSDLInformationMapper.mapToEndpointInformation(soaNodeModel,NUXEO_BASE_URL));
  }
  return endpointInformations;
}

Fixed version (ground truth):
public static EndpointInformations queryEndpoints(CoreSession documentManager,String search,String subProjectId,String visibility) throws Exception {
  DocumentService documentService=Framework.getService(DocumentService.class);
  boolean searchParamIncluded=false;
  ArrayList<String> parameters=new ArrayList<String>();
  StringBuilder query=new StringBuilder();
  query.append("String_Node_Str");
  if (search != null && !"String_Node_Str".equals(search)) {
    String searchParam="String_Node_Str" + search + "String_Node_Str";
    query.append("String_Node_Str" + "String_Node_Str" + SoaNode.XPATH_SOANAME + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ WsdlInfoFacet.XPATH_WSDL_PORTTYPE_NAME+ "String_Node_Str");
    parameters.add(searchParam);
    parameters.add(searchParam);
    parameters.add(searchParam);
    parameters.add(searchParam);
    searchParamIncluded=true;
  }
  if (subProjectId != null && !"String_Node_Str".equals(subProjectId)) {
    String subProjectCriterias="String_Node_Str";
    DocumentModel subProjectModel=SubprojectServiceImpl.getSubprojectById(documentManager,subProjectId);
    if (subProjectModel != null) {
      subProjectCriterias=SubprojectServiceImpl.buildCriteriaSeenFromSubproject(subProjectModel);
      if (searchParamIncluded) {
        query.append("String_Node_Str").append(subProjectCriterias);
      }
 else {
        query.append("String_Node_Str").append(subProjectCriterias);
      }
    }
 else {
      throw new Exception("String_Node_Str" + subProjectId + "String_Node_Str");
    }
  }
  String nxqlQuery=NXQLQueryBuilder.getQuery(query.toString(),parameters.toArray(),false,true);
  DocumentModelList soaNodeModelList=documentService.query(documentManager,nxqlQuery,true,false);
  EndpointInformations endpointInformations=new EndpointInformations();
  for (  DocumentModel soaNodeModel : soaNodeModelList) {
    endpointInformations.addEndpointInformation(SoaNodeInformationToWSDLInformationMapper.mapToEndpointInformation(soaNodeModel,NUXEO_BASE_URL));
  }
  return endpointInformations;
}