Program: 63429
Project: 63429
Buggy source:
@SuppressWarnings("String_Node_Str") private Response namedQueryResponse(PersistenceContext context,String queryName,DatabaseQuery dbQuery,Query query,HttpHeaders headers,UriInfo uriInfo,FeatureResponseBuilder responseBuilder){
  final Map<String,Object> queryParams=getQueryParameters(uriInfo);
  if (query.getMaxResults() != Integer.MAX_VALUE) {
    queryParams.put(QueryParameters.JPARS_PAGING_LIMIT,String.valueOf(query.getMaxResults()));
    queryParams.put(QueryParameters.JPARS_PAGING_OFFSET,String.valueOf(query.getFirstResult()));
  }
  if (dbQuery instanceof ReportQuery) {
    List<ReportItem> reportItems=((ReportQuery)dbQuery).getItems();
    List<Object[]> queryResults=query.getResultList();
    if ((queryResults != null) && (!queryResults.isEmpty())) {
      Object list=responseBuilder.buildReportQueryResponse(context,queryParams,queryResults,reportItems,uriInfo);
      if (list != null) {
        return Response.ok(new StreamingOutputMarshaller(context,list,headers.getAcceptableMediaTypes())).build();
      }
 else {
        throw JPARSException.responseCouldNotBeBuiltForNamedQueryRequest(queryName,context.getName());
      }
    }
    return Response.ok(new StreamingOutputMarshaller(context,queryResults,headers.getAcceptableMediaTypes())).build();
  }
  List<Object> results=query.getResultList();
  if ((results != null) && (!results.isEmpty())) {
    Object list=responseBuilder.buildReadAllQueryResponse(context,queryParams,results,uriInfo);
    return Response.ok(new StreamingOutputMarshaller(context,list,headers.getAcceptableMediaTypes())).build();
  }
  return Response.ok(new StreamingOutputMarshaller(context,results,headers.getAcceptableMediaTypes())).build();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private Response namedQueryResponse(PersistenceContext context,String queryName,DatabaseQuery dbQuery,Query query,HttpHeaders headers,UriInfo uriInfo,FeatureResponseBuilder responseBuilder){
  final Map<String,Object> queryParams=getQueryParameters(uriInfo);
  if (query.getMaxResults() != Integer.MAX_VALUE) {
    queryParams.put(QueryParameters.JPARS_PAGING_LIMIT,String.valueOf(query.getMaxResults() - 1));
    queryParams.put(QueryParameters.JPARS_PAGING_OFFSET,String.valueOf(query.getFirstResult()));
  }
  if (dbQuery instanceof ReportQuery) {
    List<ReportItem> reportItems=((ReportQuery)dbQuery).getItems();
    List<Object[]> queryResults=query.getResultList();
    if ((queryResults != null) && (!queryResults.isEmpty())) {
      Object list=responseBuilder.buildReportQueryResponse(context,queryParams,queryResults,reportItems,uriInfo);
      if (list != null) {
        return Response.ok(new StreamingOutputMarshaller(context,list,headers.getAcceptableMediaTypes())).build();
      }
 else {
        throw JPARSException.responseCouldNotBeBuiltForNamedQueryRequest(queryName,context.getName());
      }
    }
    return Response.ok(new StreamingOutputMarshaller(context,queryResults,headers.getAcceptableMediaTypes())).build();
  }
  List<Object> results=query.getResultList();
  if ((results != null) && (!results.isEmpty())) {
    Object list=responseBuilder.buildReadAllQueryResponse(context,queryParams,results,uriInfo);
    return Response.ok(new StreamingOutputMarshaller(context,list,headers.getAcceptableMediaTypes())).build();
  }
  return Response.ok(new StreamingOutputMarshaller(context,results,headers.getAcceptableMediaTypes())).build();
}