Program: 20075
Project: 20075
Buggy source:
@GET @Produces(MediaType.TEXT_HTML) public Object doGetHTML(@QueryParam("String_Node_Str") String subProjectId,@QueryParam("String_Node_Str") String visibility) throws Exception {
  CoreSession session=SessionFactory.getSession(request);
  DocumentService docService=Framework.getService(DocumentService.class);
  List<String> envs=new ArrayList<String>();
  DocumentModelList environments=session.query("String_Node_Str" + Endpoint.XPATH_ENDP_ENVIRONMENT + "String_Node_Str"+ Endpoint.DOCTYPE);
  for (  DocumentModel model : environments) {
    envs.add((String)model.getPropertyValue(Endpoint.XPATH_ENDP_ENVIRONMENT));
  }
  String query="String_Node_Str" + InformationService.DOCTYPE;
  String subProjectPathCriteria=NXQLQueryHelper.buildSubprojectPathCriteria(session,subProjectId,visibility);
  if (!"String_Node_Str".equals(subProjectPathCriteria)) {
    query=query + DocumentService.NXQL_WHERE + subProjectPathCriteria;
  }
  DocumentModelList services=docService.query(session,query,true,false);
  Map<String,DocumentModelList> endpoints=new HashMap<String,DocumentModelList>();
  for (  DocumentModel service : services) {
    DocumentModelList endpointsList=docService.query(session,"String_Node_Str" + Endpoint.DOCTYPE + DocumentService.NXQL_WHERE_NO_PROXY+ DocumentService.NXQL_AND+ "String_Node_Str"+ service.getId()+ "String_Node_Str",true,false);
    endpoints.put(service.getName(),endpointsList);
  }
  return getView("String_Node_Str").arg("String_Node_Str",envs).arg("String_Node_Str",endpoints).arg("String_Node_Str",subProjectId).arg("String_Node_Str",visibility).arg("String_Node_Str",ContextData.getVersionData(session,subProjectId));
}

Fixed version (ground truth):
@GET @Produces(MediaType.TEXT_HTML) public Object doGetHTML(@QueryParam("String_Node_Str") String subProjectId,@QueryParam("String_Node_Str") String visibility) throws Exception {
  CoreSession session=SessionFactory.getSession(request);
  DocumentService docService=Framework.getService(DocumentService.class);
  List<String> envs=new ArrayList<String>();
  DocumentModelList environments=session.query("String_Node_Str" + Endpoint.XPATH_ENDP_ENVIRONMENT + "String_Node_Str"+ Endpoint.DOCTYPE);
  for (  DocumentModel model : environments) {
    envs.add((String)model.getPropertyValue(Endpoint.XPATH_ENDP_ENVIRONMENT));
  }
  String query="String_Node_Str" + InformationService.DOCTYPE;
  String subProjectPathCriteria=NXQLQueryHelper.buildSubprojectPathCriteria(session,subProjectId,visibility);
  if (!"String_Node_Str".equals(subProjectPathCriteria)) {
    query=query + DocumentService.NXQL_WHERE + subProjectPathCriteria;
  }
  DocumentModelList services=docService.query(session,query,true,false);
  Map<String,DocumentModelList> endpoints=new HashMap<String,DocumentModelList>();
  for (  DocumentModel service : services) {
    query="String_Node_Str" + Endpoint.DOCTYPE + DocumentService.NXQL_WHERE+ "String_Node_Str"+ service.getId()+ "String_Node_Str";
    if (!"String_Node_Str".equals(subProjectPathCriteria)) {
      query=query + DocumentService.NXQL_AND + subProjectPathCriteria;
    }
    DocumentModelList endpointsList=docService.query(session,query,true,false);
    endpoints.put(service.getName(),endpointsList);
  }
  return getView("String_Node_Str").arg("String_Node_Str",envs).arg("String_Node_Str",endpoints).arg("String_Node_Str",subProjectId).arg("String_Node_Str",visibility).arg("String_Node_Str",ContextData.getVersionData(session,subProjectId));
}