Program: 7740
Project: 7740
Buggy source:
/** 
 * Increases number of instance for a flowlet within a flow.
 */
@PUT @Path("String_Node_Str") public void setFlowletInstances(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String appId,@PathParam("String_Node_Str") final String flowId,@PathParam("String_Node_Str") final String flowletId,@PathParam("String_Node_Str") final String instanceCount){
  short instances=0;
  try {
    Short count=Short.parseShort(instanceCount);
    instances=count.shortValue();
    if (instances < 1) {
      responder.sendStatus(HttpResponseStatus.BAD_REQUEST);
      return;
    }
  }
 catch (  NumberFormatException e) {
    responder.sendStatus(HttpResponseStatus.BAD_REQUEST);
    return;
  }
  try {
    String accountId=getAuthenticatedAccountId(request);
    AuthToken token=new AuthToken(request.getHeader(GatewayAuthenticator.CONTINUUITY_API_KEY));
    TProtocol protocol=getThriftProtocol(Services.APP_FABRIC,endpointStrategy);
    AppFabricService.Client client=new AppFabricService.Client(protocol);
    try {
      client.setInstances(token,new ProgramId(accountId,appId,flowId),flowletId,instances);
      responder.sendStatus(HttpResponseStatus.OK);
    }
  finally {
      if (client.getInputProtocol().getTransport().isOpen()) {
        client.getInputProtocol().getTransport().close();
      }
      if (client.getOutputProtocol().getTransport().isOpen()) {
        client.getOutputProtocol().getTransport().close();
      }
    }
    responder.sendStatus(HttpResponseStatus.OK);
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.FORBIDDEN);
  }
catch (  Exception e) {
    responder.sendStatus(HttpResponseStatus.NOT_FOUND);
  }
}

Fixed version (ground truth):
/** 
 * Increases number of instance for a flowlet within a flow.
 */
@PUT @Path("String_Node_Str") public void setFlowletInstances(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String appId,@PathParam("String_Node_Str") final String flowId,@PathParam("String_Node_Str") final String flowletId,@PathParam("String_Node_Str") final String instanceCount){
  short instances=0;
  try {
    Short count=Short.parseShort(instanceCount);
    instances=count.shortValue();
    if (instances < 1) {
      responder.sendStatus(HttpResponseStatus.BAD_REQUEST);
      return;
    }
  }
 catch (  NumberFormatException e) {
    responder.sendStatus(HttpResponseStatus.BAD_REQUEST);
    return;
  }
  try {
    String accountId=getAuthenticatedAccountId(request);
    AuthToken token=new AuthToken(request.getHeader(GatewayAuthenticator.CONTINUUITY_API_KEY));
    TProtocol protocol=getThriftProtocol(Constants.Service.APP_FABRIC,endpointStrategy);
    AppFabricService.Client client=new AppFabricService.Client(protocol);
    try {
      client.setInstances(token,new ProgramId(accountId,appId,flowId),flowletId,instances);
      responder.sendStatus(HttpResponseStatus.OK);
    }
  finally {
      if (client.getInputProtocol().getTransport().isOpen()) {
        client.getInputProtocol().getTransport().close();
      }
      if (client.getOutputProtocol().getTransport().isOpen()) {
        client.getOutputProtocol().getTransport().close();
      }
    }
    responder.sendStatus(HttpResponseStatus.OK);
  }
 catch (  SecurityException e) {
    responder.sendStatus(HttpResponseStatus.FORBIDDEN);
  }
catch (  Exception e) {
    responder.sendStatus(HttpResponseStatus.NOT_FOUND);
  }
}