Program: 6335
Project: 6335
Buggy source:
/** 
 * Sets the number of instances of a worker.
 */
@PUT @Path("String_Node_Str") public void setWorkerInstances(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appId,@PathParam("String_Node_Str") String workerId) throws ExecutionException, InterruptedException {
  int instances;
  try {
    try {
      instances=getInstances(request);
    }
 catch (    IllegalArgumentException e) {
      responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
catch (    JsonSyntaxException e) {
      responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
    if (instances < 1) {
      responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
  }
 catch (  Throwable th) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
    return;
  }
  try {
    Id.Program programId=Id.Program.from(namespaceId,appId,ProgramType.WORKER,workerId);
    int oldInstances=store.getWorkerInstances(programId);
    if (oldInstances != instances) {
      store.setWorkerInstances(programId,instances);
      ProgramRuntimeService.RuntimeInfo runtimeInfo=findRuntimeInfo(namespaceId,appId,workerId,ProgramType.WORKER,runtimeService);
      if (runtimeInfo != null) {
        runtimeInfo.getController().command(ProgramOptionConstants.INSTANCES,ImmutableMap.of(programId.getId(),String.valueOf(instances))).get();
      }
    }
    responder.sendStatus(HttpResponseStatus.OK);
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
  }
catch (  Throwable e) {
    if (respondIfElementNotFound(e,responder)) {
      return;
    }
    throw e;
  }
}

Fixed version (ground truth):
/** 
 * Sets the number of instances of a worker.
 */
@PUT @Path("String_Node_Str") public void setWorkerInstances(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@PathParam("String_Node_Str") String appId,@PathParam("String_Node_Str") String workerId) throws ExecutionException, InterruptedException {
  int instances;
  try {
    try {
      instances=getInstances(request);
    }
 catch (    IllegalArgumentException e) {
      responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
catch (    JsonSyntaxException e) {
      responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
    if (instances < 1) {
      responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
  }
 catch (  Throwable th) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
    return;
  }
  try {
    Id.Program programId=Id.Program.from(namespaceId,appId,ProgramType.WORKER,workerId);
    int oldInstances=store.getWorkerInstances(programId);
    if (oldInstances != instances) {
      store.setWorkerInstances(programId,instances);
      ProgramRuntimeService.RuntimeInfo runtimeInfo=findRuntimeInfo(programId,runtimeService);
      if (runtimeInfo != null) {
        runtimeInfo.getController().command(ProgramOptionConstants.INSTANCES,ImmutableMap.of(programId.getId(),String.valueOf(instances))).get();
      }
    }
    responder.sendStatus(HttpResponseStatus.OK);
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
  }
catch (  Throwable e) {
    if (respondIfElementNotFound(e,responder)) {
      return;
    }
    throw e;
  }
}