Program: 188582
Project: 188582
Buggy source:
public static StreamResponse retrieveClassificationPlan(String type,User user) throws GenericException, RequestNotValidException, NotFoundException, AuthorizationDeniedException {
  try {
    JsonFactory factory=new JsonFactory();
    ObjectMapper mapper=new ObjectMapper(factory);
    ObjectNode root=mapper.createObjectNode();
    ArrayNode array=mapper.createArrayNode();
    List<DescriptionLevel> descriptionLevels=DescriptionLevelUtils.getAllButRepresentationsDescriptionLevels();
    List<String> descriptionsLevels=descriptionLevels.stream().map(d -> d.getLevel()).collect(Collectors.toList());
    Filter allButRepresentationsFilter=new Filter(new OneOfManyFilterParameter(RodaConstants.AIP_LEVEL,descriptionsLevels));
    IndexService index=RodaCoreFactory.getIndexService();
    long collectionsCount=index.count(IndexedAIP.class,allButRepresentationsFilter);
    for (int i=0; i < collectionsCount; i+=RodaConstants.DEFAULT_PAGINATION_VALUE) {
      IndexResult<IndexedAIP> collections=index.find(IndexedAIP.class,allButRepresentationsFilter,null,new Sublist(i,RodaConstants.DEFAULT_PAGINATION_VALUE));
      for (      IndexedAIP aip : collections.getResults()) {
        array.add(aipToJSON(aip));
      }
    }
    root.set("String_Node_Str",array);
    StringWriter sw=new StringWriter();
    mapper.writeValue(sw,root);
    StreamingOutput stream=new StreamingOutput(){
      @Override public void write(      OutputStream os) throws IOException, WebApplicationException {
        IOUtils.write(sw.toString().getBytes("String_Node_Str"),os);
      }
    }
;
    return new StreamResponse("String_Node_Str",MediaType.APPLICATION_JSON,stream);
  }
 catch (  IOException e) {
    throw new GenericException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
public static StreamResponse retrieveClassificationPlan(String type,User user) throws GenericException, RequestNotValidException, NotFoundException, AuthorizationDeniedException {
  try {
    JsonFactory factory=new JsonFactory();
    ObjectMapper mapper=new ObjectMapper(factory);
    ObjectNode root=mapper.createObjectNode();
    ArrayNode array=mapper.createArrayNode();
    List<String> descriptionsLevels=RodaUtils.copyList(RodaCoreFactory.getRodaConfiguration().getList(RodaConstants.LEVELS_CLASSIFICATION_PLAN));
    Filter allButRepresentationsFilter=new Filter(new OneOfManyFilterParameter(RodaConstants.AIP_LEVEL,descriptionsLevels));
    IndexService index=RodaCoreFactory.getIndexService();
    long collectionsCount=index.count(IndexedAIP.class,allButRepresentationsFilter);
    for (int i=0; i < collectionsCount; i+=RodaConstants.DEFAULT_PAGINATION_VALUE) {
      IndexResult<IndexedAIP> collections=index.find(IndexedAIP.class,allButRepresentationsFilter,null,new Sublist(i,RodaConstants.DEFAULT_PAGINATION_VALUE));
      for (      IndexedAIP aip : collections.getResults()) {
        array.add(aipToJSON(aip));
      }
    }
    root.set("String_Node_Str",array);
    StringWriter sw=new StringWriter();
    mapper.writeValue(sw,root);
    StreamingOutput stream=new StreamingOutput(){
      @Override public void write(      OutputStream os) throws IOException, WebApplicationException {
        IOUtils.write(sw.toString().getBytes("String_Node_Str"),os);
      }
    }
;
    return new StreamResponse("String_Node_Str",MediaType.APPLICATION_JSON,stream);
  }
 catch (  IOException e) {
    throw new GenericException("String_Node_Str" + e.getMessage());
  }
}