Program: 86054
Project: 86054
Buggy source:
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public Response getInstances(@Context Request request,@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,@QueryParam("String_Node_Str") String configSpecType,@QueryParam("String_Node_Str") String path){
  try {
    Calendar cal=new GregorianCalendar();
    cal.add(Calendar.MINUTE,-30);
    Response.ResponseBuilder rb=request.evaluatePreconditions(cal.getTime());
    if (rb != null) {
      return rb.build();
    }
 else {
      CacheControl cc=new CacheControl();
      cc.setMaxAge(60 * 30);
      ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
      ConfigSpec cs;
      if (configSpecType == null || configSpecType.equals("String_Node_Str")) {
        cs=new LatestConfigSpec();
      }
 else {
        cs=productService.getConfigSpecForBaseline(ciKey,Integer.parseInt(configSpecType));
      }
      PartUsageLink rootUsageLink;
      List<Integer> usageLinkPaths=new ArrayList<Integer>();
      if (path != null && !path.equals("String_Node_Str")) {
        String[] partUsageIdsString=path.split("String_Node_Str");
        for (int i=0; i < partUsageIdsString.length; i++) {
          usageLinkPaths.add(Integer.parseInt(partUsageIdsString[i]));
        }
        rootUsageLink=productService.filterProductStructure(ciKey,cs,usageLinkPaths.get(0),0);
        usageLinkPaths.remove(0);
      }
 else {
        rootUsageLink=productService.filterProductStructure(ciKey,cs,null,0);
      }
      return Response.ok().lastModified(new Date()).cacheControl(cc).entity(new InstanceCollection(rootUsageLink,usageLinkPaths)).build();
    }
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces("String_Node_Str") public Response getInstances(@Context Request request,@PathParam("String_Node_Str") String workspaceId,@PathParam("String_Node_Str") String ciId,@QueryParam("String_Node_Str") String configSpecType,@QueryParam("String_Node_Str") String path){
  try {
    Calendar cal=new GregorianCalendar();
    cal.add(Calendar.MINUTE,-30);
    Response.ResponseBuilder rb=request.evaluatePreconditions(cal.getTime());
    if (rb != null) {
      return rb.build();
    }
 else {
      CacheControl cc=new CacheControl();
      cc.setMaxAge(60 * 30);
      ConfigurationItemKey ciKey=new ConfigurationItemKey(workspaceId,ciId);
      ConfigSpec cs;
      if (configSpecType == null || configSpecType.equals("String_Node_Str") || configSpecType.equals("String_Node_Str")) {
        cs=new LatestConfigSpec();
      }
 else {
        cs=productService.getConfigSpecForBaseline(ciKey,Integer.parseInt(configSpecType));
      }
      PartUsageLink rootUsageLink;
      List<Integer> usageLinkPaths=new ArrayList<Integer>();
      if (path != null && !path.equals("String_Node_Str")) {
        String[] partUsageIdsString=path.split("String_Node_Str");
        for (int i=0; i < partUsageIdsString.length; i++) {
          usageLinkPaths.add(Integer.parseInt(partUsageIdsString[i]));
        }
        rootUsageLink=productService.filterProductStructure(ciKey,cs,usageLinkPaths.get(0),0);
        usageLinkPaths.remove(0);
      }
 else {
        rootUsageLink=productService.filterProductStructure(ciKey,cs,null,0);
      }
      return Response.ok().lastModified(new Date()).cacheControl(cc).entity(new InstanceCollection(rootUsageLink,usageLinkPaths)).build();
    }
  }
 catch (  com.docdoku.core.services.ApplicationException ex) {
    throw new RestApiException(ex.toString(),ex.getMessage());
  }
}