Program: 7309
Project: 7309
Buggy source:
/** 
 * Returns the number of instances for all program runnables that are passed into the data. The data is an array of Json objects where each object must contain the following three elements: appId, programType, and programId (flow name, service name, or procedure name). Retrieving instances only applies to flows, procedures, and user services. For flows and procedures, another parameter, "runnableId", must be provided. This corresponds to the flowlet/runnable for which to retrieve the instances. This does not apply to procedures. Example input: [{"appId": "App1", "programType": "Service", "programId": "Service1", "runnableId": "Runnable1"}, {"appId": "App1", "programType": "Procedure", "programId": "Proc2"}, {"appId": "App2", "programType": "Flow", "programId": "Flow1", "runnableId": "Flowlet1"}] The response will be an array of JsonObjects each of which will contain the three input parameters as well as 3 fields: "provisioned" which maps to the number of instances actually provided for the input runnable, "requested" which maps to the number of instances the user has requested for the input runnable, "statusCode" which maps to the http status code for the data in that JsonObjects. (200, 400, 404) If an error occurs in the input (i.e. in the example above, Flowlet1 does not exist), then all JsonObjects for which the parameters have a valid instances will have the provisioned and requested fields status code fields but all JsonObjects for which the parameters are not valid will have an error message and statusCode. E.g. given the above data, if there is no Flowlet1, then the response would be 200 OK with following possible data: [{"appId": "App1", "programType": "Service", "programId": "Service1", "runnableId": "Runnable1", "statusCode": 200, "provisioned": 2, "requested": 2}, {"appId": "App1", "programType": "Procedure", "programId": "Proc2", "statusCode": 200, "provisioned": 1, "requested": 3}, {"appId": "App2", "programType": "Flow", "programId": "Flow1", "runnableId": "Flowlet1", "statusCode": 404, "error": "Runnable": Flowlet1 not found"}]
 * @param request
 * @param responder
 */
@POST @Path("String_Node_Str") public void getInstances(HttpRequest request,HttpResponder responder){
  programLifecycleHttpHandler.getInstances(rewriteRequest(request),responder,Constants.DEFAULT_NAMESPACE);
}

Fixed version (ground truth):
/** 
 * Returns the number of instances for all program runnables that are passed into the data. The data is an array of Json objects where each object must contain the following three elements: appId, programType, and programId (flow name, service name, or procedure name). Retrieving instances only applies to flows, procedures, and user services. For flows and procedures, another parameter, "runnableId", must be provided. This corresponds to the flowlet/runnable for which to retrieve the instances. This does not apply to procedures. Example input: [{"appId": "App1", "programType": "Service", "programId": "Service1", "runnableId": "Runnable1"}, {"appId": "App1", "programType": "Procedure", "programId": "Proc2"}, {"appId": "App2", "programType": "Flow", "programId": "Flow1", "runnableId": "Flowlet1"}] The response will be an array of JsonObjects each of which will contain the three input parameters as well as 3 fields: "provisioned" which maps to the number of instances actually provided for the input runnable, "requested" which maps to the number of instances the user has requested for the input runnable, "statusCode" which maps to the http status code for the data in that JsonObjects. (200, 400, 404) If an error occurs in the input (i.e. in the example above, Flowlet1 does not exist), then all JsonObjects for which the parameters have a valid instances will have the provisioned and requested fields status code fields but all JsonObjects for which the parameters are not valid will have an error message and statusCode. E.g. given the above data, if there is no Flowlet1, then the response would be 200 OK with following possible data: [{"appId": "App1", "programType": "Service", "programId": "Service1", "runnableId": "Runnable1", "statusCode": 200, "provisioned": 2, "requested": 2}, {"appId": "App1", "programType": "Procedure", "programId": "Proc2", "statusCode": 200, "provisioned": 1, "requested": 3}, {"appId": "App2", "programType": "Flow", "programId": "Flow1", "runnableId": "Flowlet1", "statusCode": 404, "error": "Runnable": Flowlet1 not found"}]
 * @param request
 * @param responder
 */
@POST @Path("String_Node_Str") public void getInstances(HttpRequest request,HttpResponder responder){
  programLifecycleHttpHandler.getInstances(RESTMigrationUtils.rewriteV2RequestToV3(request),responder,Constants.DEFAULT_NAMESPACE);
}