Program: 20062
Project: 20062
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.TEXT_HTML) public Object doGetByPathHTML(@PathParam("String_Node_Str") String endpointId,@PathParam("String_Node_Str") String page,@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);
  Pagination pagination=new Pagination();
  if (endpointId == null || "String_Node_Str".equals(endpointId)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int pageNumber;
  try {
    pageNumber=Integer.parseInt(page) - 1;
    if (pageNumber < 1) {
      pageNumber=0;
    }
  }
 catch (  Exception ex) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  DocumentModel endpoint=session.getDocument(new IdRef(endpointId));
  String serviceId=endpoint.getProperty(ServiceImplementation.XPATH_PROVIDED_INFORMATION_SERVICE).getValue(String.class);
  DocumentModel service=session.getDocument(new IdRef(serviceId));
  String slaOrOlaSubprojectId=(String)service.getPropertyValue(SubprojectNode.XPATH_SUBPROJECT);
  EndpointStateService endpointStateService=new EndpointStateServiceImpl();
  List<SlaOrOlaIndicator> indicators=endpointStateService.getSlaOrOlaIndicators(endpointId,"String_Node_Str",null,null,RESULTS_PER_PAGE,pageNumber).getSlaOrOlaIndicatorList();
  List<String> endpointIds=new ArrayList<String>();
  endpointIds.add(endpointId);
  int totalIndicatorNumber=endpointStateService.getTotalNumberOfSlaOrOlaindicators(endpointIds,null,null);
  pagination.setTotalPageNumber(totalIndicatorNumber % RESULTS_PER_PAGE);
  pagination.setCurrentPage(pageNumber + 1);
  if (totalIndicatorNumber > RESULTS_PER_PAGE) {
    pagination.setHasNextPage(true);
  }
  if (pageNumber > 0) {
    pagination.setHasPreviousPage(true);
  }
  for (  SlaOrOlaIndicator indicator : indicators) {
    indicator.setDescription("String_Node_Str");
    DocumentModel slaOrOla;
    slaOrOla=docService.findSoaNode(session,new SoaNodeId(slaOrOlaSubprojectId,org.easysoa.registry.types.SlaOrOlaIndicator.SLA_DOCTYPE,indicator.getSlaOrOlaName()),true);
    if (slaOrOla == null) {
      slaOrOla=docService.findSoaNode(session,new SoaNodeId(slaOrOlaSubprojectId,org.easysoa.registry.types.SlaOrOlaIndicator.OLA_DOCTYPE,indicator.getSlaOrOlaName()),true);
    }
    if (slaOrOla != null) {
      indicator.setDescription(slaOrOla.getProperty(org.easysoa.registry.types.SlaOrOlaIndicator.XPATH_SLA_OR_OLA_DESCRIPTION).getValue(String.class));
      indicator.setPath(slaOrOla.getPathAsString());
    }
  }
  Template view=getView("String_Node_Str");
  if (indicators != null) {
    view.arg("String_Node_Str",indicators);
  }
  view.arg("String_Node_Str",subprojectId).arg("String_Node_Str",visibility).arg("String_Node_Str",ContextData.getVersionData(session,subprojectId)).arg("String_Node_Str",service).arg("String_Node_Str",service.getPathAsString()).arg("String_Node_Str",endpoint).arg("String_Node_Str",pagination).arg("String_Node_Str",new freemarker.template.utility.ObjectConstructor());
  return view;
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces(MediaType.TEXT_HTML) public Object doGetByPathHTML(@PathParam("String_Node_Str") String endpointId,@PathParam("String_Node_Str") String page,@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);
  Pagination pagination=new Pagination();
  if (endpointId == null || "String_Node_Str".equals(endpointId)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int pageNumber;
  try {
    pageNumber=Integer.parseInt(page) - 1;
    if (pageNumber < 1) {
      pageNumber=0;
    }
  }
 catch (  Exception ex) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  DocumentModel endpoint=session.getDocument(new IdRef(endpointId));
  String serviceId=endpoint.getProperty(ServiceImplementation.XPATH_PROVIDED_INFORMATION_SERVICE).getValue(String.class);
  DocumentModel service=session.getDocument(new IdRef(serviceId));
  String slaOrOlaSubprojectId=(String)service.getPropertyValue(SubprojectNode.XPATH_SUBPROJECT);
  EndpointStateService endpointStateService=new EndpointStateServiceImpl();
  List<SlaOrOlaIndicator> indicators=endpointStateService.getSlaOrOlaIndicators(endpointId,"String_Node_Str",null,null,RESULTS_PER_PAGE,pageNumber).getSlaOrOlaIndicatorList();
  List<String> endpointIds=new ArrayList<String>();
  endpointIds.add(endpointId);
  int totalIndicatorNumber=endpointStateService.getTotalNumberOfSlaOrOlaindicators(endpointIds,null,null);
  int totalPageNumber=Math.round(totalIndicatorNumber / RESULTS_PER_PAGE);
  if (totalIndicatorNumber % RESULTS_PER_PAGE > 0) {
    totalPageNumber++;
  }
  pagination.setTotalPageNumber(totalPageNumber);
  if (indicators.size() > 0) {
    pagination.setCurrentPage(pageNumber + 1);
  }
 else {
    pagination.setCurrentPage(0);
  }
  if (totalIndicatorNumber - ((pageNumber + 1) * RESULTS_PER_PAGE) > 0) {
    pagination.setHasNextPage(true);
  }
  if (pageNumber > 0) {
    pagination.setHasPreviousPage(true);
  }
  for (  SlaOrOlaIndicator indicator : indicators) {
    indicator.setDescription("String_Node_Str");
    DocumentModel slaOrOla;
    slaOrOla=docService.findSoaNode(session,new SoaNodeId(slaOrOlaSubprojectId,org.easysoa.registry.types.SlaOrOlaIndicator.SLA_DOCTYPE,indicator.getSlaOrOlaName()),true);
    if (slaOrOla == null) {
      slaOrOla=docService.findSoaNode(session,new SoaNodeId(slaOrOlaSubprojectId,org.easysoa.registry.types.SlaOrOlaIndicator.OLA_DOCTYPE,indicator.getSlaOrOlaName()),true);
    }
    if (slaOrOla != null) {
      indicator.setDescription(slaOrOla.getProperty(org.easysoa.registry.types.SlaOrOlaIndicator.XPATH_SLA_OR_OLA_DESCRIPTION).getValue(String.class));
      indicator.setPath(slaOrOla.getPathAsString());
    }
  }
  Template view=getView("String_Node_Str");
  if (indicators != null) {
    view.arg("String_Node_Str",indicators);
  }
  view.arg("String_Node_Str",subprojectId).arg("String_Node_Str",visibility).arg("String_Node_Str",ContextData.getVersionData(session,subprojectId)).arg("String_Node_Str",service).arg("String_Node_Str",service.getPathAsString()).arg("String_Node_Str",endpoint).arg("String_Node_Str",pagination).arg("String_Node_Str",new freemarker.template.utility.ObjectConstructor());
  return view;
}