Program: 7645
Project: 7645
Buggy source:
@Override public ProgramController run(Program program,ProgramOptions options){
  BasicFlowletContext flowletContext=null;
  try {
    String flowletName=options.getName();
    int instanceId=Integer.parseInt(options.getArguments().getOption(ProgramOptionConstants.INSTANCE_ID,"String_Node_Str"));
    Preconditions.checkArgument(instanceId >= 0,"String_Node_Str");
    int instanceCount=Integer.parseInt(options.getArguments().getOption(ProgramOptionConstants.INSTANCES,"String_Node_Str"));
    Preconditions.checkArgument(instanceCount > 0,"String_Node_Str");
    String runIdOption=options.getArguments().getOption(ProgramOptionConstants.RUN_ID);
    Preconditions.checkNotNull(runIdOption,"String_Node_Str");
    RunId runId=RunIds.fromString(runIdOption);
    boolean disableTransaction=Boolean.parseBoolean(options.getArguments().getOption(ProgramOptionConstants.DISABLE_TRANSACTION,Boolean.toString(false)));
    ApplicationSpecification appSpec=program.getSpecification();
    Preconditions.checkNotNull(appSpec,"String_Node_Str");
    Type processorType=program.getType();
    Preconditions.checkNotNull(processorType,"String_Node_Str");
    Preconditions.checkArgument(processorType == Type.FLOW,"String_Node_Str");
    String processorName=program.getName();
    Preconditions.checkNotNull(processorName,"String_Node_Str");
    FlowSpecification flowSpec=appSpec.getFlows().get(processorName);
    FlowletDefinition flowletDef=flowSpec.getFlowlets().get(flowletName);
    Preconditions.checkNotNull(flowletDef,"String_Node_Str",flowletName);
    Class<?> clz=Class.forName(flowletDef.getFlowletSpec().getClassName(),true,program.getMainClass().getClassLoader());
    Preconditions.checkArgument(Flowlet.class.isAssignableFrom(clz),"String_Node_Str",clz);
    Class<? extends Flowlet> flowletClass=(Class<? extends Flowlet>)clz;
    DataFabricFacade dataFabricFacade=disableTransaction ? dataFabricFacadeFactory.createNoTransaction(program) : dataFabricFacadeFactory.create(program);
    DataSetContext dataSetContext=dataFabricFacade.getDataSetContext();
    flowletContext=new BasicFlowletContext(program,flowletName,instanceId,runId,instanceCount,DataSets.createDataSets(dataSetContext,flowletDef.getDatasets()),options.getUserArguments(),flowletDef.getFlowletSpec(),metricsCollectionService);
    if (dataSetContext instanceof DataSetInstantiationBase) {
      ((DataSetInstantiationBase)dataSetContext).setMetricsCollector(flowletContext.getSystemMetrics());
    }
    Table<Node,String,Set<QueueSpecification>> queueSpecs=new SimpleQueueSpecificationGenerator(Id.Application.from(program.getAccountId(),program.getApplicationId())).create(flowSpec);
    Flowlet flowlet=new InstantiatorFactory(false).get(TypeToken.of(flowletClass)).create();
    TypeToken<? extends Flowlet> flowletType=TypeToken.of(flowletClass);
    Reflections.visit(flowlet,TypeToken.of(flowlet.getClass()),new PropertyFieldSetter(flowletDef.getFlowletSpec().getProperties()),new DataSetFieldSetter(flowletContext),new MetricsFieldSetter(flowletContext.getMetrics()),new OutputEmitterFieldSetter(outputEmitterFactory(flowletContext,flowletName,dataFabricFacade,queueSpecs)));
    ImmutableList.Builder<QueueConsumerSupplier> queueConsumerSupplierBuilder=ImmutableList.builder();
    Collection<ProcessSpecification> processSpecs=createProcessSpecification(flowletContext,flowletType,processMethodFactory(flowlet),processSpecificationFactory(dataFabricFacade,queueReaderFactory,flowletName,queueSpecs,queueConsumerSupplierBuilder,createSchemaCache(program)),Lists.<ProcessSpecification>newLinkedList());
    List<QueueConsumerSupplier> queueConsumerSuppliers=queueConsumerSupplierBuilder.build();
    FlowletProcessDriver driver=new FlowletProcessDriver(flowlet,flowletContext,processSpecs,createCallback(flowlet,flowletDef.getFlowletSpec()),dataFabricFacade);
    if (disableTransaction) {
      LOG.info("String_Node_Str",flowletContext);
    }
    LOG.info("String_Node_Str",flowletContext);
    driver.start();
    LOG.info("String_Node_Str",flowletContext);
    return new FlowletProgramController(program.getName(),flowletName,flowletContext,driver,queueConsumerSuppliers);
  }
 catch (  Exception e) {
    if (flowletContext != null) {
      flowletContext.close();
    }
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@Override public ProgramController run(Program program,ProgramOptions options){
  BasicFlowletContext flowletContext=null;
  try {
    String flowletName=options.getName();
    int instanceId=Integer.parseInt(options.getArguments().getOption(ProgramOptionConstants.INSTANCE_ID,"String_Node_Str"));
    Preconditions.checkArgument(instanceId >= 0,"String_Node_Str");
    int instanceCount=Integer.parseInt(options.getArguments().getOption(ProgramOptionConstants.INSTANCES,"String_Node_Str"));
    Preconditions.checkArgument(instanceCount > 0,"String_Node_Str");
    String runIdOption=options.getArguments().getOption(ProgramOptionConstants.RUN_ID);
    Preconditions.checkNotNull(runIdOption,"String_Node_Str");
    RunId runId=RunIds.fromString(runIdOption);
    boolean disableTransaction=Boolean.parseBoolean(options.getArguments().getOption(ProgramOptionConstants.DISABLE_TRANSACTION,Boolean.toString(false)));
    ApplicationSpecification appSpec=program.getSpecification();
    Preconditions.checkNotNull(appSpec,"String_Node_Str");
    Type processorType=program.getType();
    Preconditions.checkNotNull(processorType,"String_Node_Str");
    Preconditions.checkArgument(processorType == Type.FLOW,"String_Node_Str");
    String processorName=program.getName();
    Preconditions.checkNotNull(processorName,"String_Node_Str");
    FlowSpecification flowSpec=appSpec.getFlows().get(processorName);
    FlowletDefinition flowletDef=flowSpec.getFlowlets().get(flowletName);
    Preconditions.checkNotNull(flowletDef,"String_Node_Str",flowletName);
    Class<?> clz=Class.forName(flowletDef.getFlowletSpec().getClassName(),true,program.getMainClass().getClassLoader());
    Preconditions.checkArgument(Flowlet.class.isAssignableFrom(clz),"String_Node_Str",clz);
    Class<? extends Flowlet> flowletClass=(Class<? extends Flowlet>)clz;
    DataFabricFacade dataFabricFacade=disableTransaction ? dataFabricFacadeFactory.createNoTransaction(program) : dataFabricFacadeFactory.create(program);
    DataSetContext dataSetContext=dataFabricFacade.getDataSetContext();
    flowletContext=new BasicFlowletContext(program,flowletName,instanceId,runId,instanceCount,DataSets.createDataSets(dataSetContext,flowletDef.getDatasets()),options.getUserArguments(),flowletDef.getFlowletSpec(),metricsCollectionService);
    if (dataSetContext instanceof DataSetInstantiationBase) {
      ((DataSetInstantiationBase)dataSetContext).setMetricsCollector(metricsCollectionService,flowletContext.getSystemMetrics());
    }
    Table<Node,String,Set<QueueSpecification>> queueSpecs=new SimpleQueueSpecificationGenerator(Id.Application.from(program.getAccountId(),program.getApplicationId())).create(flowSpec);
    Flowlet flowlet=new InstantiatorFactory(false).get(TypeToken.of(flowletClass)).create();
    TypeToken<? extends Flowlet> flowletType=TypeToken.of(flowletClass);
    Reflections.visit(flowlet,TypeToken.of(flowlet.getClass()),new PropertyFieldSetter(flowletDef.getFlowletSpec().getProperties()),new DataSetFieldSetter(flowletContext),new MetricsFieldSetter(flowletContext.getMetrics()),new OutputEmitterFieldSetter(outputEmitterFactory(flowletContext,flowletName,dataFabricFacade,queueSpecs)));
    ImmutableList.Builder<QueueConsumerSupplier> queueConsumerSupplierBuilder=ImmutableList.builder();
    Collection<ProcessSpecification> processSpecs=createProcessSpecification(flowletContext,flowletType,processMethodFactory(flowlet),processSpecificationFactory(dataFabricFacade,queueReaderFactory,flowletName,queueSpecs,queueConsumerSupplierBuilder,createSchemaCache(program)),Lists.<ProcessSpecification>newLinkedList());
    List<QueueConsumerSupplier> queueConsumerSuppliers=queueConsumerSupplierBuilder.build();
    FlowletProcessDriver driver=new FlowletProcessDriver(flowlet,flowletContext,processSpecs,createCallback(flowlet,flowletDef.getFlowletSpec()),dataFabricFacade);
    if (disableTransaction) {
      LOG.info("String_Node_Str",flowletContext);
    }
    LOG.info("String_Node_Str",flowletContext);
    driver.start();
    LOG.info("String_Node_Str",flowletContext);
    return new FlowletProgramController(program.getName(),flowletName,flowletContext,driver,queueConsumerSuppliers);
  }
 catch (  Exception e) {
    if (flowletContext != null) {
      flowletContext.close();
    }
    throw Throwables.propagate(e);
  }
}