Program: 179175
Project: 179175
Buggy source:
/** 
 * updating array of entries
 * @throws JSONException
 */
@PUT @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) public Response updateServices(JSONArray serviceInfos) throws WebApplicationException, JSONException {
  try {
    JSONArray arr=new JSONArray();
    JSONArray errorArray=new JSONArray();
    for (int i=0; i < serviceInfos.length(); i++) {
      JSONObject serviceInfo=serviceInfos.getJSONObject(i);
      Client c=(Client)req.getAttribute("String_Node_Str");
      String owner=c.getDistinguishedName();
      String url=serviceInfo.getString(ServiceBasicAttributeNames.SERVICE_ENDPOINT_URL.getAttributeName());
      serviceInfo.put(ServiceBasicAttributeNames.SERVICE_OWNER.getAttributeName(),c.getDistinguishedName());
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + url + "String_Node_Str"+ owner);
      }
      String messageTime="String_Node_Str";
      if (serviceInfo.has(ServiceBasicAttributeNames.SERVICE_UPDATE_SINCE.getAttributeName())) {
        messageTime=serviceInfo.getString(ServiceBasicAttributeNames.SERVICE_UPDATE_SINCE.getAttributeName());
      }
      if (c.getRole().getName().equalsIgnoreCase("String_Node_Str")) {
        JSONObject res;
        try {
          res=serviceAdmin.updateService(serviceInfo);
          arr.put(res);
        }
 catch (        UnknownServiceException e) {
          return Response.status(Status.NOT_FOUND).build();
        }
catch (        WebApplicationException e) {
          errorArray.put(serviceInfo);
        }
        continue;
      }
 else       if (owner != null && serviceAdmin.checkOwner(owner,serviceInfo.getString(ServiceBasicAttributeNames.SERVICE_ENDPOINT_URL.getAttributeName())) && serviceAdmin.checkMessageGenerationTime(messageTime,url)) {
        JSONObject res;
        try {
          res=serviceAdmin.updateService(serviceInfo);
          arr.put(res);
        }
 catch (        UnknownServiceException e) {
          return Response.status(Status.NOT_FOUND).build();
        }
catch (        WebApplicationException e) {
          errorArray.put(serviceInfo);
        }
        continue;
      }
 else {
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str" + serviceInfo.getString(ServiceBasicAttributeNames.SERVICE_ENDPOINT_URL.getAttributeName()) + "String_Node_Str");
        }
        return Response.status(Status.UNAUTHORIZED).entity("String_Node_Str" + owner + "String_Node_Str"+ url).build();
      }
    }
    EventDispatcher.notifyRecievers(new Event(EventTypes.SERVICE_UPDATE,arr));
    if (errorArray.length() > 0) {
      return Response.status(Status.CONFLICT).entity(errorArray).build();
    }
    return Response.ok(arr).build();
  }
 catch (  Exception e) {
    JSONObject jErr=new JSONObject();
    jErr.put("String_Node_Str",e.getCause());
    throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(jErr).build());
  }
}

Fixed version (ground truth):
/** 
 * updating array of entries
 * @throws JSONException
 */
@PUT @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) public Response updateServices(JSONArray serviceInfos) throws WebApplicationException, JSONException {
  try {
    JSONArray arr=new JSONArray();
    JSONArray errorArray=new JSONArray();
    for (int i=0; i < serviceInfos.length(); i++) {
      JSONObject serviceInfo=serviceInfos.getJSONObject(i);
      Client c=(Client)req.getAttribute("String_Node_Str");
      String owner=c.getDistinguishedName();
      String url=serviceInfo.getString(ServiceBasicAttributeNames.SERVICE_ENDPOINT_URL.getAttributeName());
      serviceInfo.put(ServiceBasicAttributeNames.SERVICE_OWNER.getAttributeName(),c.getDistinguishedName());
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + url + "String_Node_Str"+ owner);
      }
      String messageTime="String_Node_Str";
      if (serviceInfo.has(ServiceBasicAttributeNames.SERVICE_UPDATE_SINCE.getAttributeName())) {
        messageTime=(serviceInfo.getJSONObject(ServiceBasicAttributeNames.SERVICE_UPDATE_SINCE.getAttributeName())).getString("String_Node_Str");
      }
      if (c.getRole().getName().equalsIgnoreCase("String_Node_Str") && serviceAdmin.checkMessageGenerationTime(messageTime,url)) {
        JSONObject res;
        try {
          res=serviceAdmin.updateService(serviceInfo);
          arr.put(res);
        }
 catch (        UnknownServiceException e) {
          return Response.status(Status.NOT_FOUND).build();
        }
catch (        WebApplicationException e) {
          errorArray.put(serviceInfo);
        }
        continue;
      }
 else       if (owner != null && serviceAdmin.checkOwner(owner,serviceInfo.getString(ServiceBasicAttributeNames.SERVICE_ENDPOINT_URL.getAttributeName())) && serviceAdmin.checkMessageGenerationTime(messageTime,url)) {
        JSONObject res;
        try {
          res=serviceAdmin.updateService(serviceInfo);
          arr.put(res);
        }
 catch (        UnknownServiceException e) {
          return Response.status(Status.NOT_FOUND).build();
        }
catch (        WebApplicationException e) {
          errorArray.put(serviceInfo);
        }
        continue;
      }
 else {
        if (logger.isDebugEnabled()) {
          logger.debug("String_Node_Str" + serviceInfo.getString(ServiceBasicAttributeNames.SERVICE_ENDPOINT_URL.getAttributeName()) + "String_Node_Str");
        }
        return Response.status(Status.UNAUTHORIZED).entity("String_Node_Str" + owner + "String_Node_Str"+ url).build();
      }
    }
    EventDispatcher.notifyRecievers(new Event(EventTypes.SERVICE_UPDATE,arr));
    if (errorArray.length() > 0) {
      return Response.status(Status.CONFLICT).entity(errorArray).build();
    }
    return Response.ok(arr).build();
  }
 catch (  Exception e) {
    JSONObject jErr=new JSONObject();
    jErr.put("String_Node_Str",e.getCause());
    throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(jErr).build());
  }
}