Program: 7542
Project: 7542
Buggy source:
@POST @Path("String_Node_Str") public void getInstances(HttpRequest request,HttpResponder responder){
  try {
    String accountId=getAuthenticatedAccountId(request);
    List<JsonObject> args=decodeArrayArguments(request);
    if (args == null || args.isEmpty()) {
      respondAndLog(responder,HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
    for (int i=0; i < args.size(); ++i) {
      JsonObject requestedObj=args.get(i);
      String appId, programTypeStr, programId, runnableId;
      try {
        appId=requestedObj.getAsJsonPrimitive(APP_ID_ARG).getAsString();
        programTypeStr=requestedObj.getAsJsonPrimitive(PROGRAM_TYPE_ARG).getAsString();
        programId=requestedObj.getAsJsonPrimitive(PROGRAM_ID_ARG).getAsString();
      }
 catch (      NullPointerException e) {
        respondAndLog(responder,HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
        return;
      }
      Type programType=Type.valueOfPrettyName(programTypeStr);
      if (programType == null) {
        respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programTypeStr + "String_Node_Str");
        return;
      }
      int requested, provisioned;
      ApplicationSpecification spec=store.getApplication(Id.Application.from(accountId,appId));
      if (spec == null) {
        respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + appId + "String_Node_Str");
        return;
      }
      if (programType == Type.PROCEDURE) {
        runnableId=programId;
        if (spec.getProcedures().containsKey(programId)) {
          requested=store.getProcedureInstances(Id.Program.from(accountId,appId,programId));
        }
 else {
          respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programId + "String_Node_Str");
          return;
        }
      }
 else {
        try {
          runnableId=requestedObj.getAsJsonPrimitive(RUNNABLE_ID_ARG).getAsString();
        }
 catch (        NullPointerException e) {
          respondAndLog(responder,HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
          return;
        }
        if (programType == Type.FLOW) {
          FlowSpecification flowSpec=spec.getFlows().get(programId);
          if (flowSpec != null) {
            Map<String,FlowletDefinition> flowletSpecs=flowSpec.getFlowlets();
            if (flowletSpecs != null && flowletSpecs.containsKey(runnableId)) {
              requested=flowletSpecs.get(runnableId).getInstances();
            }
 else {
              respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + runnableId + "String_Node_Str");
              return;
            }
          }
 else {
            respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programId + "String_Node_Str");
            return;
          }
        }
 else         if (programType == Type.SERVICE) {
          ServiceSpecification serviceSpec=spec.getServices().get(programId);
          if (serviceSpec != null) {
            Map<String,RuntimeSpecification> runtimeSpecs=serviceSpec.getRunnables();
            if (runtimeSpecs != null && runtimeSpecs.containsKey(runnableId)) {
              requested=runtimeSpecs.get(runnableId).getResourceSpecification().getInstances();
            }
 else {
              respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + runnableId + "String_Node_Str");
              return;
            }
          }
 else {
            respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programId + "String_Node_Str");
            return;
          }
        }
 else {
          respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programTypeStr + "String_Node_Str");
          return;
        }
      }
      provisioned=getRunnableCount(accountId,appId,programType,programId,runnableId);
      requestedObj.addProperty("String_Node_Str",requested);
      requestedObj.addProperty("String_Node_Str",provisioned);
      args.set(i,requestedObj);
    }
    responder.sendJson(HttpResponseStatus.OK,args);
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
  }
catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}

Fixed version (ground truth):
@POST @Path("String_Node_Str") public void getInstances(HttpRequest request,HttpResponder responder){
  try {
    String accountId=getAuthenticatedAccountId(request);
    List<JsonObject> args=decodeArrayArguments(request);
    if (args == null || args.isEmpty()) {
      respondAndLog(responder,HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
    for (int i=0; i < args.size(); ++i) {
      JsonObject requestedObj=args.get(i);
      String appId, programTypeStr, programId, runnableId;
      try {
        appId=requestedObj.getAsJsonPrimitive(APP_ID_ARG).getAsString();
        programTypeStr=requestedObj.getAsJsonPrimitive(PROGRAM_TYPE_ARG).getAsString();
        programId=requestedObj.getAsJsonPrimitive(PROGRAM_ID_ARG).getAsString();
      }
 catch (      NullPointerException e) {
        respondAndLog(responder,HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
        return;
      }
      Type programType;
      try {
        programType=Type.valueOfPrettyName(programTypeStr);
      }
 catch (      IllegalArgumentException e) {
        respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programTypeStr);
        return;
      }
      if (programType == null) {
        respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programTypeStr + "String_Node_Str");
        return;
      }
      int requested, provisioned;
      ApplicationSpecification spec=store.getApplication(Id.Application.from(accountId,appId));
      if (spec == null) {
        respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + appId + "String_Node_Str");
        return;
      }
      if (programType == Type.PROCEDURE) {
        runnableId=programId;
        if (spec.getProcedures().containsKey(programId)) {
          requested=store.getProcedureInstances(Id.Program.from(accountId,appId,programId));
        }
 else {
          respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programId + "String_Node_Str");
          return;
        }
      }
 else {
        if (programType != Type.FLOW && programType != Type.SERVICE) {
          respondAndLog(responder,HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + programTypeStr);
          return;
        }
        try {
          runnableId=requestedObj.getAsJsonPrimitive(RUNNABLE_ID_ARG).getAsString();
        }
 catch (        NullPointerException e) {
          respondAndLog(responder,HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
          return;
        }
        if (programType == Type.FLOW) {
          FlowSpecification flowSpec=spec.getFlows().get(programId);
          if (flowSpec != null) {
            Map<String,FlowletDefinition> flowletSpecs=flowSpec.getFlowlets();
            if (flowletSpecs != null && flowletSpecs.containsKey(runnableId)) {
              requested=flowletSpecs.get(runnableId).getInstances();
            }
 else {
              respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + runnableId + "String_Node_Str");
              return;
            }
          }
 else {
            respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programId + "String_Node_Str");
            return;
          }
        }
 else {
          ServiceSpecification serviceSpec=spec.getServices().get(programId);
          if (serviceSpec != null) {
            Map<String,RuntimeSpecification> runtimeSpecs=serviceSpec.getRunnables();
            if (runtimeSpecs != null && runtimeSpecs.containsKey(runnableId)) {
              requested=runtimeSpecs.get(runnableId).getResourceSpecification().getInstances();
            }
 else {
              respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + runnableId + "String_Node_Str");
              return;
            }
          }
 else {
            respondAndLog(responder,HttpResponseStatus.NOT_FOUND,"String_Node_Str" + programId + "String_Node_Str");
            return;
          }
        }
      }
      provisioned=getRunnableCount(accountId,appId,programType,programId,runnableId);
      requestedObj.addProperty("String_Node_Str",requested);
      requestedObj.addProperty("String_Node_Str",provisioned);
      args.set(i,requestedObj);
    }
    responder.sendJson(HttpResponseStatus.OK,args);
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
  }
catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}