nus-yam/ex-repair huggingface dataset:
Program: 6842
Project: 6842
Buggy source:
@Override public void handle(WorkflowClient.Status status){
  if (status.getCode() == WorkflowClient.Status.Code.NOT_FOUND) {
    responder.sendStatus(HttpResponseStatus.NOT_FOUND);
  }
 else   if (status.getCode() == WorkflowClient.Status.Code.OK) {
    responder.sendByteArray(HttpResponseStatus.OK,status.getResult().getBytes(),ImmutableMultimap.of(HttpHeaders.Names.CONTENT_TYPE,"String_Node_Str"));
  }
 else {
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,status.getResult());
  }
}

Fixed version (ground truth):
@Override public void handle(WorkflowClient.Status status){
  if (status.getCode() == WorkflowClient.Status.Code.NOT_FOUND) {
    responder.sendStatus(HttpResponseStatus.NOT_FOUND);
  }
 else   if (status.getCode() == WorkflowClient.Status.Code.OK) {
    responder.sendByteArray(HttpResponseStatus.OK,Bytes.toBytes(status.getResult()),ImmutableMultimap.of(HttpHeaders.Names.CONTENT_TYPE,"String_Node_Str"));
  }
 else {
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,status.getResult());
  }
}
Program: 6844
Project: 6844
Buggy source:
private void testWorkflowCommand(final Id.Program workflow) throws Exception {
  File doneFile=TMP_FOLDER.newFile();
  doneFile.delete();
  LOG.info("String_Node_Str");
  programClient.start(workflow,false,ImmutableMap.of("String_Node_Str",doneFile.getAbsolutePath()));
  assertProgramRunning(programClient,workflow);
  List<RunRecord> runRecords=programClient.getProgramRuns(workflow,"String_Node_Str",Long.MIN_VALUE,Long.MAX_VALUE,100);
  Assert.assertEquals(1,runRecords.size());
  final String pid=runRecords.get(0).getPid();
  Tasks.waitFor(1,new Callable<Integer>(){
    @Override public Integer call() throws Exception {
      return programClient.getWorkflowCurrent(workflow.getApplication(),workflow.getId(),pid).size();
    }
  }
,5,TimeUnit.SECONDS,100,TimeUnit.MILLISECONDS);
  doneFile.createNewFile();
  assertProgramStopped(programClient,workflow);
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
private void testWorkflowCommand(final Id.Program workflow) throws Exception {
  File doneFile=TMP_FOLDER.newFile();
  Assert.assertTrue(doneFile.delete());
  LOG.info("String_Node_Str");
  programClient.start(workflow,false,ImmutableMap.of("String_Node_Str",doneFile.getAbsolutePath()));
  assertProgramRunning(programClient,workflow);
  List<RunRecord> runRecords=programClient.getProgramRuns(workflow,"String_Node_Str",Long.MIN_VALUE,Long.MAX_VALUE,100);
  Assert.assertEquals(1,runRecords.size());
  final String pid=runRecords.get(0).getPid();
  Tasks.waitFor(1,new Callable<Integer>(){
    @Override public Integer call() throws Exception {
      return programClient.getWorkflowCurrent(workflow.getApplication(),workflow.getId(),pid).size();
    }
  }
,5,TimeUnit.SECONDS,100,TimeUnit.MILLISECONDS);
  Assert.assertTrue(doneFile.createNewFile());
  assertProgramStopped(programClient,workflow);
  LOG.info("String_Node_Str");
}
Program: 6845
Project: 6845
Buggy source:
@Override protected void doStop(){
  executor.shutdownNow();
}

Fixed version (ground truth):
@Override protected void doStop(){
  executor.submit(new Runnable(){
    @Override public void run(){
      LOG.debug("String_Node_Str");
      notifyStopped();
    }
  }
);
  executor.shutdown();
}
Program: 6846
Project: 6846
Buggy source:
@Override protected void doStart(){
  executor=new ScheduledThreadPoolExecutor(1,Threads.createDaemonThreadFactory("String_Node_Str")){
    @Override protected void terminated(){
      notifyStopped();
    }
  }
;
  executor.submit(new Runnable(){
    @Override public void run(){
      LOG.debug("String_Node_Str");
      try {
        janitor.cleanAll();
        LOG.debug("String_Node_Str");
      }
 catch (      Throwable e) {
        LOG.error("String_Node_Str",e);
      }
 finally {
        long now=System.currentTimeMillis();
        long delay=(now / cleanupPeriod + 1) * cleanupPeriod - now;
        if (delay <= 0) {
          executor.submit(this);
        }
 else {
          LOG.debug("String_Node_Str",delay);
          executor.schedule(this,delay,TimeUnit.MILLISECONDS);
        }
      }
    }
  }
);
  notifyStarted();
}

Fixed version (ground truth):
@Override protected void doStart(){
  executor=Executors.newSingleThreadScheduledExecutor(Threads.createDaemonThreadFactory("String_Node_Str"));
  executor.submit(new Runnable(){
    @Override public void run(){
      if (state() != State.RUNNING) {
        LOG.info("String_Node_Str");
        return;
      }
      LOG.debug("String_Node_Str");
      try {
        janitor.cleanAll();
        LOG.debug("String_Node_Str");
      }
 catch (      Throwable e) {
        LOG.error("String_Node_Str",e);
      }
 finally {
        long now=System.currentTimeMillis();
        long delay=(now / cleanupPeriod + 1) * cleanupPeriod - now;
        if (delay <= 0) {
          executor.submit(this);
        }
 else {
          LOG.debug("String_Node_Str",delay);
          executor.schedule(this,delay,TimeUnit.MILLISECONDS);
        }
      }
    }
  }
);
  notifyStarted();
}
Program: 6847
Project: 6847
Buggy source:
@Override public void run(){
  LOG.debug("String_Node_Str");
  try {
    janitor.cleanAll();
    LOG.debug("String_Node_Str");
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
 finally {
    long now=System.currentTimeMillis();
    long delay=(now / cleanupPeriod + 1) * cleanupPeriod - now;
    if (delay <= 0) {
      executor.submit(this);
    }
 else {
      LOG.debug("String_Node_Str",delay);
      executor.schedule(this,delay,TimeUnit.MILLISECONDS);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  LOG.debug("String_Node_Str");
  notifyStopped();
}
Program: 6848
Project: 6848
Buggy source:
/** 
 * Get information about all versions of the given artifact.
 * @param namespace the namespace to get artifacts from
 * @param artifactName the name of the artifact to get
 * @return unmodifiable list of information about all versions of the given artifact
 * @throws ArtifactNotExistsException if no version of the given artifact exists
 * @throws IOException if there was an exception reading the artifact information from the metastore
 */
public List<ArtifactDetail> getArtifacts(final Id.Namespace namespace,final String artifactName) throws ArtifactNotExistsException, IOException {
  List<ArtifactDetail> artifacts=metaTable.executeUnchecked(new TransactionExecutor.Function<DatasetContext<Table>,List<ArtifactDetail>>(){
    @Override public List<ArtifactDetail> apply(    DatasetContext<Table> context) throws Exception {
      List<ArtifactDetail> archives=Lists.newArrayList();
      ArtifactKey artifactKey=new ArtifactKey(namespace,artifactName);
      Row row=context.get().get(artifactKey.getRowKey());
      if (!row.isEmpty()) {
        addArchivesToList(archives,row);
      }
      return archives;
    }
  }
);
  if (artifacts.isEmpty()) {
    throw new ArtifactNotExistsException(namespace,artifactName);
  }
  return Collections.unmodifiableList(artifacts);
}

Fixed version (ground truth):
/** 
 * Get information about all versions of the given artifact.
 * @param namespace the namespace to get artifacts from
 * @param artifactName the name of the artifact to get
 * @return unmodifiable list of information about all versions of the given artifact
 * @throws ArtifactNotExistsException if no version of the given artifact exists
 * @throws IOException if there was an exception reading the artifact information from the metastore
 */
public List<ArtifactDetail> getArtifacts(final Id.Namespace namespace,final String artifactName) throws ArtifactNotExistsException, IOException {
  List<ArtifactDetail> artifacts=metaTable.executeUnchecked(new TransactionExecutor.Function<DatasetContext<Table>,List<ArtifactDetail>>(){
    @Override public List<ArtifactDetail> apply(    DatasetContext<Table> context) throws Exception {
      List<ArtifactDetail> archives=Lists.newArrayList();
      ArtifactKey artifactKey=new ArtifactKey(namespace,artifactName);
      Row row=context.get().get(artifactKey.getRowKey());
      if (!row.isEmpty()) {
        addArtifactsToList(archives,row);
      }
      return archives;
    }
  }
);
  if (artifacts.isEmpty()) {
    throw new ArtifactNotExistsException(namespace,artifactName);
  }
  return Collections.unmodifiableList(artifacts);
}
Program: 6850
Project: 6850
Buggy source:
@Test public void testPlugin() throws Exception {
  Manifest manifest=createManifest(ManifestFields.EXPORT_PACKAGE,TestPlugin.class.getPackage().getName());
  File jarFile=createJar(TestPlugin.class,new File(tmpDir,"String_Node_Str"),manifest);
  Set<ArtifactRange> parents=ImmutableSet.of(new ArtifactRange(APP_ARTIFACT_ID.getNamespace(),APP_ARTIFACT_ID.getName(),new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str")));
  Id.Artifact artifactId=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  artifactRepository.inspectArtifact(artifactId,jarFile,parents);
  SortedMap<ArtifactDescriptor,List<PluginClass>> plugins=artifactRepository.getPlugins(APP_ARTIFACT_ID);
  Assert.assertEquals(1,plugins.size());
  Assert.assertEquals(2,plugins.get(plugins.firstKey()).size());
  try (PluginInstantiator instantiator=new PluginInstantiator(cConf,appClassLoader)){
    for (    Map.Entry<ArtifactDescriptor,List<PluginClass>> entry : plugins.entrySet()) {
      for (      PluginClass pluginClass : entry.getValue()) {
        Callable<String> plugin=instantiator.newInstance(entry.getKey(),pluginClass,PluginProperties.builder().add("String_Node_Str",TEST_EMPTY_CLASS).add("String_Node_Str","String_Node_Str").build());
        Assert.assertEquals(TEST_EMPTY_CLASS,plugin.call());
      }
    }
  }
 }

Fixed version (ground truth):
@Test public void testPlugin() throws Exception {
  Manifest manifest=createManifest(ManifestFields.EXPORT_PACKAGE,TestPlugin.class.getPackage().getName());
  File jarFile=createJar(TestPlugin.class,new File(tmpDir,"String_Node_Str"),manifest);
  Set<ArtifactRange> parents=ImmutableSet.of(new ArtifactRange(APP_ARTIFACT_ID.getNamespace(),APP_ARTIFACT_ID.getName(),new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str")));
  Id.Artifact artifactId=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  artifactRepository.addArtifact(artifactId,jarFile,parents);
  SortedMap<ArtifactDescriptor,List<PluginClass>> plugins=artifactRepository.getPlugins(APP_ARTIFACT_ID);
  Assert.assertEquals(1,plugins.size());
  Assert.assertEquals(2,plugins.get(plugins.firstKey()).size());
  try (PluginInstantiator instantiator=new PluginInstantiator(cConf,appClassLoader)){
    for (    Map.Entry<ArtifactDescriptor,List<PluginClass>> entry : plugins.entrySet()) {
      for (      PluginClass pluginClass : entry.getValue()) {
        Callable<String> plugin=instantiator.newInstance(entry.getKey(),pluginClass,PluginProperties.builder().add("String_Node_Str",TEST_EMPTY_CLASS).add("String_Node_Str","String_Node_Str").build());
        Assert.assertEquals(TEST_EMPTY_CLASS,plugin.call());
      }
    }
  }
 }
Program: 6851
Project: 6851
Buggy source:
@Before public void setupData() throws Exception {
  artifactRepository.clear(Constants.DEFAULT_NAMESPACE_ID);
  File appArtifactFile=createJar(PluginTestAppTemplate.class,new File(tmpDir,"String_Node_Str"),createManifest(ManifestFields.EXPORT_PACKAGE,PluginTestRunnable.class.getPackage().getName()));
  artifactRepository.inspectArtifact(APP_ARTIFACT_ID,appArtifactFile,null);
  appClassLoader=createAppClassLoader(appArtifactFile);
}

Fixed version (ground truth):
@Before public void setupData() throws Exception {
  artifactRepository.clear(Constants.DEFAULT_NAMESPACE_ID);
  File appArtifactFile=createJar(PluginTestAppTemplate.class,new File(tmpDir,"String_Node_Str"),createManifest(ManifestFields.EXPORT_PACKAGE,PluginTestRunnable.class.getPackage().getName()));
  artifactRepository.addArtifact(APP_ARTIFACT_ID,appArtifactFile,null);
  appClassLoader=createAppClassLoader(appArtifactFile);
}
Program: 6852
Project: 6852
Buggy source:
@Test public void testGetNonexistantArtifact() throws IOException {
  Id.Namespace namespace=Id.Namespace.from("String_Node_Str");
  Assert.assertTrue(artifactStore.getArtifacts(namespace).isEmpty());
  try {
    artifactStore.getArtifacts(namespace,"String_Node_Str");
    Assert.fail();
  }
 catch (  ArtifactNotExistsException e) {
  }
  try {
    artifactStore.getArtifact(Id.Artifact.from(namespace,"String_Node_Str","String_Node_Str"));
    Assert.fail();
  }
 catch (  ArtifactNotExistsException e) {
  }
}

Fixed version (ground truth):
@Test public void testGetNonexistantArtifact() throws IOException {
  Id.Namespace namespace=Id.Namespace.from("String_Node_Str");
  Assert.assertTrue(artifactStore.getArtifacts(namespace).isEmpty());
  ArtifactRange range=new ArtifactRange(namespace,"String_Node_Str",new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str"));
  Assert.assertTrue(artifactStore.getArtifacts(range).isEmpty());
  try {
    artifactStore.getArtifacts(namespace,"String_Node_Str");
    Assert.fail();
  }
 catch (  ArtifactNotExistsException e) {
  }
  try {
    artifactStore.getArtifact(Id.Artifact.from(namespace,"String_Node_Str","String_Node_Str"));
    Assert.fail();
  }
 catch (  ArtifactNotExistsException e) {
  }
}
Program: 6854
Project: 6854
Buggy source:
@Override public void perform(Arguments arguments,PrintStream output) throws Exception {
  File file=resolver.resolvePathToFile(arguments.get(ArgumentName.APP_JAR_FILE.toString()));
  Preconditions.checkArgument(file.exists(),"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
  Preconditions.checkArgument(file.canRead(),"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
  String appConfig=arguments.get(ArgumentName.RUNTIME_ARGS.toString(),"String_Node_Str");
  applicationClient.deploy(cliConfig.getCurrentNamespace(),file);
  output.println("String_Node_Str");
}

Fixed version (ground truth):
@Override public void perform(Arguments arguments,PrintStream output) throws Exception {
  File file=resolver.resolvePathToFile(arguments.get(ArgumentName.APP_JAR_FILE.toString()));
  Preconditions.checkArgument(file.exists(),"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
  Preconditions.checkArgument(file.canRead(),"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
  String appConfig=arguments.get(ArgumentName.RUNTIME_ARGS.toString(),"String_Node_Str");
  applicationClient.deploy(cliConfig.getCurrentNamespace(),file,appConfig);
  output.println("String_Node_Str");
}
Program: 6855
Project: 6855
Buggy source:
ApplicationManager deployApplication(Id.Namespace namespace,Class<? extends Application> applicationClz,Config configObject,File... bundleEmbeddedJars);

Fixed version (ground truth):
/** 
 * Deploys an   {@link Application}.
 * @param namespace The namespace to deploy to
 * @param applicationClz The application class
 * @param configObject Configuration object to be used during deployment and can be accessedin  {@link Application#configure} via {@link ApplicationContext#getConfig}
 * @return An {@link ApplicationManager} to manage the deployed application.
 */
ApplicationManager deployApplication(Id.Namespace namespace,Class<? extends Application> applicationClz,Config configObject,File... bundleEmbeddedJars);
Program: 6857
Project: 6857
Buggy source:
@Override public void run(){
  try {
    barrier.await();
    ArtifactMeta meta=new ArtifactMeta(ImmutableList.of(new PluginClass("String_Node_Str","String_Node_Str" + writer,"String_Node_Str","String_Node_Str","String_Node_Str",ImmutableMap.<String,PluginPropertyField>of())));
    artifactStore.write(artifactId,meta,new ByteArrayInputStream(Bytes.toBytes(writer)));
    successfulWriters.add(writer);
  }
 catch (  InterruptedException|BrokenBarrierException|ArtifactAlreadyExistsException|IOException e) {
    throw new RuntimeException(e);
  }
catch (  WriteConflictException e) {
  }
 finally {
    latch.countDown();
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    barrier.await();
    ArtifactMeta meta=new ArtifactMeta(ImmutableList.of(new PluginClass("String_Node_Str","String_Node_Str" + writer,"String_Node_Str","String_Node_Str","String_Node_Str",ImmutableMap.<String,PluginPropertyField>of())));
    artifactStore.write(artifactId,meta,new ByteArrayInputStream(Bytes.toBytes(writer)));
  }
 catch (  InterruptedException|BrokenBarrierException|ArtifactAlreadyExistsException|IOException e) {
    throw new RuntimeException(e);
  }
catch (  WriteConflictException e) {
  }
 finally {
    latch.countDown();
  }
}
Program: 6859
Project: 6859
Buggy source:
@Override public void start(){
  try {
    URLConnections.setDefaultUseCaches(false);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
  createSystemHBaseNamespace();
  updateConfigurationTable();
  LogAppenderInitializer logAppenderInitializer=baseInjector.getInstance(LogAppenderInitializer.class);
  logAppenderInitializer.initialize();
  zkClient.startAndWait();
  twillRunner.start();
  Futures.getUnchecked(ZKOperations.ignoreError(zkClient.create("String_Node_Str",null,CreateMode.PERSISTENT),KeeperException.NodeExistsException.class,null));
  kafkaClient.startAndWait();
  metricsCollectionService.startAndWait();
  serviceStore.startAndWait();
  leaderElection.startAndWait();
}

Fixed version (ground truth):
@Override public void start(){
  try {
    URLConnections.setDefaultUseCaches(false);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
  createSystemHBaseNamespace();
  updateConfigurationTable();
  LogAppenderInitializer logAppenderInitializer=baseInjector.getInstance(LogAppenderInitializer.class);
  logAppenderInitializer.initialize();
  zkClient.startAndWait();
  Futures.getUnchecked(ZKOperations.ignoreError(zkClient.create("String_Node_Str",null,CreateMode.PERSISTENT),KeeperException.NodeExistsException.class,null));
  twillRunner.start();
  kafkaClient.startAndWait();
  metricsCollectionService.startAndWait();
  serviceStore.startAndWait();
  leaderElection.startAndWait();
}
Program: 6862
Project: 6862
Buggy source:
private static ClassLoader createClassFilteredClassLoader(Iterable<String> allowedClasses,ClassLoader parentClassLoader){
  Set<String> allowedResources=ImmutableSet.copyOf(Iterables.transform(allowedClasses,CLASS_TO_RESOURCE_NAME));
  return new FilterClassLoader(Predicates.in(allowedResources),Predicates.<String>alwaysTrue(),parentClassLoader);
}

Fixed version (ground truth):
private static ClassLoader createClassFilteredClassLoader(Iterable<String> allowedClasses,ClassLoader parentClassLoader){
  Set<String> allowedResources=ImmutableSet.copyOf(Iterables.transform(allowedClasses,CLASS_TO_RESOURCE_NAME));
  return FilterClassLoader.create(Predicates.in(allowedResources),Predicates.<String>alwaysTrue(),parentClassLoader);
}
Program: 6863
Project: 6863
Buggy source:
@BeforeClass public static void setupTest() throws IOException {
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",DBSource.class,KVTableSource.class,StreamBatchSource.class,TableSource.class,DBRecord.class,TimePartitionedFileSetDatasetAvroSource.class,BatchCubeSink.class,DBSink.class,KVTableSink.class,TableSink.class,TimePartitionedFileSetDatasetAvroSink.class,AvroKeyOutputFormat.class,AvroKey.class,TimePartitionedFileSetDatasetParquetSink.class,AvroParquetOutputFormat.class);
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",MetaKVTableSource.class);
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",MetaKVTableSink.class);
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",ProjectionTransform.class,ScriptFilterTransform.class,StructuredRecordToGenericRecordTransform.class);
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",JDBCDriver.class);
  addTemplatePluginJson(TEMPLATE_ID,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",JDBCDriver.class.getName());
  deployTemplate(NAMESPACE,TEMPLATE_ID,ETLBatchTemplate.class,PipelineConfigurable.class.getPackage().getName(),BatchSource.class.getPackage().getName());
}

Fixed version (ground truth):
@BeforeClass public static void setupTest() throws IOException {
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",DBSource.class,KVTableSource.class,StreamBatchSource.class,TableSource.class,DBRecord.class,TimePartitionedFileSetDatasetAvroSource.class,BatchCubeSink.class,DBSink.class,KVTableSink.class,TableSink.class,TimePartitionedFileSetDatasetAvroSink.class,AvroKeyOutputFormat.class,AvroKey.class,TimePartitionedFileSetDatasetParquetSink.class,AvroParquetOutputFormat.class);
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",MetaKVTableSource.class);
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",MetaKVTableSink.class);
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",ProjectionTransform.class,ScriptFilterTransform.class,StructuredRecordToGenericRecordTransform.class);
  addTemplatePlugins(TEMPLATE_ID,"String_Node_Str",JDBCDriver.class);
  addTemplatePluginJson(TEMPLATE_ID,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",JDBCDriver.class.getName());
  deployTemplate(NAMESPACE,TEMPLATE_ID,ETLBatchTemplate.class,PipelineConfigurable.class.getPackage().getName(),BatchSource.class.getPackage().getName(),ETLConfig.class.getPackage().getName());
}
Program: 6864
Project: 6864
Buggy source:
@Override public URL getResource(String name){
  return super.getResource(name);
}

Fixed version (ground truth):
@Override public URL getResource(String name){
  return resourceAcceptor.apply(name) ? super.getResource(name) : null;
}
Program: 6865
Project: 6865
Buggy source:
/** 
 * @param resourceAcceptor Filter for accepting resources
 * @param parentClassLoader Parent classloader
 */
public FilterClassLoader(Predicate<String> resourceAcceptor,Predicate<String> packageAcceptor,ClassLoader parentClassLoader){
  super(parentClassLoader);
  this.resourceAcceptor=resourceAcceptor;
  this.packageAcceptor=packageAcceptor;
  this.bootstrapClassLoader=new URLClassLoader(new URL[0],null);
}

Fixed version (ground truth):
/** 
 * @param resourceAcceptor Filter for accepting resources
 * @param parentClassLoader Parent classloader
 */
private FilterClassLoader(Predicate<String> resourceAcceptor,Predicate<String> packageAcceptor,ClassLoader parentClassLoader){
  super(parentClassLoader);
  this.resourceAcceptor=resourceAcceptor;
  this.packageAcceptor=packageAcceptor;
  this.bootstrapClassLoader=new URLClassLoader(new URL[0],null);
}
Program: 6866
Project: 6866
Buggy source:
/** 
 * Constructs an instance that load classes from the given directory for the given program type. <p/> The URLs for class loading are: <p/> <pre> [dir] [dir]/*.jar [dir]/lib/*.jar </pre>
 */
public static ProgramClassLoader create(File unpackedJarDir,ClassLoader parentClassLoader,@Nullable ProgramType programType) throws IOException {
  Set<String> visibleResources=ProgramResources.getVisibleResources(programType);
  ImmutableSet.Builder<String> visiblePackages=ImmutableSet.builder();
  for (  String resource : visibleResources) {
    if (resource.endsWith("String_Node_Str")) {
      int idx=resource.lastIndexOf('/');
      if (idx > 0) {
        visiblePackages.add(resource.substring(0,idx));
      }
    }
  }
  ClassLoader filteredParent=new FilterClassLoader(Predicates.in(visibleResources),Predicates.in(visiblePackages.build()),parentClassLoader);
  return new ProgramClassLoader(unpackedJarDir,filteredParent);
}

Fixed version (ground truth):
/** 
 * Constructs an instance that load classes from the given directory for the given program type. <p/> The URLs for class loading are: <p/> <pre> [dir] [dir]/*.jar [dir]/lib/*.jar </pre>
 */
public static ProgramClassLoader create(File unpackedJarDir,ClassLoader parentClassLoader,@Nullable ProgramType programType) throws IOException {
  ClassLoader filteredParent=FilterClassLoader.create(programType,parentClassLoader);
  return new ProgramClassLoader(unpackedJarDir,filteredParent);
}
Program: 6867
Project: 6867
Buggy source:
public SystemDatasetInstantiator create(@Nullable ClassLoader parentClassLoader){
  return new SystemDatasetInstantiator(datasetFramework,parentClassLoader,new DirectoryClassLoaderProvider(cConf,locationFactory),null);
}

Fixed version (ground truth):
/** 
 * Create a   {@link SystemDatasetInstantiator} that uses the given classloader as the parent when instantiatingdatasets. 
 * @param parentClassLoader the parent classloader to use when instantiating datasets. If null, the systemclassloader will be used
 * @return a {@link SystemDatasetInstantiator} using the given classloader as the parent classloader
 */
public SystemDatasetInstantiator create(@Nullable ClassLoader parentClassLoader){
  return new SystemDatasetInstantiator(datasetFramework,parentClassLoader,new DirectoryClassLoaderProvider(cConf,locationFactory),null);
}
Program: 6868
Project: 6868
Buggy source:
@Override public ClassLoader load(CacheKey key) throws Exception {
  if (key.uri == null) {
    return key.parentClassLoader;
  }
  Location jarLocation=locationFactory.create(key.uri);
  File unpackedDir=DirUtils.createTempDir(tmpDir);
  BundleJarUtil.unpackProgramJar(jarLocation,unpackedDir);
  LOG.trace("String_Node_Str",key.uri.toString(),unpackedDir.getAbsolutePath());
  return new DirectoryClassLoader(unpackedDir,key.parentClassLoader);
}

Fixed version (ground truth):
@Override public ClassLoader load(CacheKey key) throws Exception {
  if (key.uri == null) {
    return key.parentClassLoader;
  }
  Location jarLocation=locationFactory.create(key.uri);
  File unpackedDir=DirUtils.createTempDir(tmpDir);
  BundleJarUtil.unpackProgramJar(jarLocation,unpackedDir);
  LOG.trace("String_Node_Str",key.uri.toString(),unpackedDir.getAbsolutePath());
  return new DirectoryClassLoader(unpackedDir,key.parentClassLoader,"String_Node_Str");
}
Program: 6869
Project: 6869
Buggy source:
public SystemDatasetInstantiator createDatasetInstantiator(ClassLoader parentClassLoader){
  return datasetInstantiatorFactory.create(parentClassLoader);
}

Fixed version (ground truth):
/** 
 * Get a   {@link SystemDatasetInstantiator} that can instantiate datasets using the given classloader as theparent classloader for datasets. Must be closed after it is no longer needed, as dataset jars may be unpacked in order to create classloaders for custom datasets. The given parent classloader will be wrapped in a  {@link FilterClassLoader}to prevent CDAP dependencies from leaking through. For example, if a custom dataset has an avro dependency, the classloader should use the avro from the custom dataset and not from cdap.
 * @param parentClassLoader the parent classloader to use when instantiating datasets. If null, the systemclassloader will be used
 * @return a dataset instantiator that can be used to instantiate datasets
 */
public SystemDatasetInstantiator createDatasetInstantiator(@Nullable ClassLoader parentClassLoader){
  parentClassLoader=parentClassLoader == null ? Objects.firstNonNull(Thread.currentThread().getContextClassLoader(),getClass().getClassLoader()) : parentClassLoader;
  return datasetInstantiatorFactory.create(FilterClassLoader.create(parentClassLoader));
}
Program: 6870
Project: 6870
Buggy source:
public BasicWorkflowToken(Map<String,List<NodeValueEntry>> tokenValueMap,String nodeName,@Nullable Map<String,Map<String,Long>> mapReduceCounters){
  for (  Map.Entry<String,List<NodeValueEntry>> entry : tokenValueMap.entrySet()) {
    List<NodeValueEntry> nodeValueList=Lists.newArrayList();
    nodeValueList.addAll(entry.getValue());
    this.tokenValueMap.put(entry.getKey(),nodeValueList);
  }
  this.nodeName=nodeName;
  if (mapReduceCounters != null) {
    this.mapReduceCounters=copyHadoopCounters(mapReduceCounters);
  }
}

Fixed version (ground truth):
public BasicWorkflowToken(BasicWorkflowToken other){
  for (  Map.Entry<String,List<NodeValueEntry>> entry : other.tokenValueMap.entrySet()) {
    List<NodeValueEntry> nodeValueList=Lists.newArrayList();
    nodeValueList.addAll(entry.getValue());
    this.tokenValueMap.put(entry.getKey(),nodeValueList);
  }
  this.nodeName=other.nodeName;
  if (other.mapReduceCounters != null) {
    this.mapReduceCounters=copyHadoopCounters(other.mapReduceCounters);
  }
}
Program: 6871
Project: 6871
Buggy source:
/** 
 * Make a deep copy of the   {@link WorkflowToken}.
 * @return copied WorkflowToken
 */
public WorkflowToken deepCopy(){
  return new BasicWorkflowToken(tokenValueMap,nodeName,mapReduceCounters);
}

Fixed version (ground truth):
/** 
 * Make a deep copy of the   {@link WorkflowToken}.
 * @return copied WorkflowToken
 */
public WorkflowToken deepCopy(){
  return new BasicWorkflowToken(this);
}
Program: 6873
Project: 6873
Buggy source:
public ArtifactMeta(List<PluginClass> plugins){
  this.plugins=plugins;
}

Fixed version (ground truth):
public ArtifactMeta(List<PluginClass> plugins){
  this.plugins=ImmutableList.copyOf(plugins);
}
Program: 6876
Project: 6876
Buggy source:
@Test(expected=ArtifactAlreadyExistsException.class) public void testImmutability() throws Exception {
  Id.Artifact artifactId=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  ArtifactMeta artifactMeta=new ArtifactMeta(ImmutableList.<PluginClass>of());
  String artifactContents="String_Node_Str";
  artifactStore.write(artifactId,artifactMeta,new ByteArrayInputStream(Bytes.toBytes(artifactContents)));
  artifactStore.write(artifactId,artifactMeta,new ByteArrayInputStream(Bytes.toBytes(artifactContents)));
}

Fixed version (ground truth):
@Test(expected=ArtifactAlreadyExistsException.class) public void testImmutability() throws Exception {
  Id.Artifact artifactId=Id.Artifact.from(Constants.DEFAULT_NAMESPACE_ID,"String_Node_Str","String_Node_Str");
  ArtifactMeta artifactMeta=new ArtifactMeta(ImmutableList.<PluginClass>of());
  String artifactContents="String_Node_Str";
  try {
    artifactStore.write(artifactId,artifactMeta,new ByteArrayInputStream(Bytes.toBytes(artifactContents)));
  }
 catch (  ArtifactAlreadyExistsException e) {
    Assert.fail();
  }
  artifactStore.write(artifactId,artifactMeta,new ByteArrayInputStream(Bytes.toBytes(artifactContents)));
}
Program: 6877
Project: 6877
Buggy source:
@Override public void destroy(){
  DBUtils.cleanup(driverClass);
}

Fixed version (ground truth):
@Override public void destroy(){
  try {
    DriverManager.deregisterDriver(driverShim);
  }
 catch (  SQLException e) {
    LOG.warn("String_Node_Str",e);
    throw Throwables.propagate(e);
  }
  DBUtils.cleanup(driverClass);
}
Program: 6878
Project: 6878
Buggy source:
@Override public void initialize(BatchSinkContext context) throws Exception {
  super.initialize(context);
  setResultSetMetadata(context);
  driverClass=context.loadPluginClass(getJDBCPluginId());
}

Fixed version (ground truth):
@Override public void initialize(BatchSinkContext context) throws Exception {
  super.initialize(context);
  driverClass=context.loadPluginClass(getJDBCPluginId());
  setResultSetMetadata();
}
Program: 6879
Project: 6879
Buggy source:
private void setResultSetMetadata(BatchSinkContext context) throws Exception {
  ensureJDBCDriverIsAvailable(context);
  Connection connection;
  if (dbSinkConfig.user == null) {
    connection=DriverManager.getConnection(dbSinkConfig.connectionString);
  }
 else {
    connection=DriverManager.getConnection(dbSinkConfig.connectionString,dbSinkConfig.user,dbSinkConfig.password);
  }
  try {
    try (Statement statement=connection.createStatement();ResultSet rs=statement.executeQuery(String.format("String_Node_Str",dbSinkConfig.columns,dbSinkConfig.tableName))){
      resultSetMetadata=rs.getMetaData();
    }
   }
  finally {
    connection.close();
  }
}

Fixed version (ground truth):
private void setResultSetMetadata() throws Exception {
  ensureJDBCDriverIsAvailable();
  Connection connection;
  if (dbSinkConfig.user == null) {
    connection=DriverManager.getConnection(dbSinkConfig.connectionString);
  }
 else {
    connection=DriverManager.getConnection(dbSinkConfig.connectionString,dbSinkConfig.user,dbSinkConfig.password);
  }
  try {
    try (Statement statement=connection.createStatement();ResultSet rs=statement.executeQuery(String.format("String_Node_Str",dbSinkConfig.columns,dbSinkConfig.tableName))){
      resultSetMetadata=rs.getMetaData();
    }
   }
  finally {
    connection.close();
  }
}
Program: 6880
Project: 6880
Buggy source:
/** 
 * Ensures that the JDBC driver is available for   {@link DriverManager}
 * @throws Exception if the driver is not available
 */
private void ensureJDBCDriverIsAvailable(BatchSinkContext context) throws Exception {
  try {
    DriverManager.getDriver(dbSinkConfig.connectionString);
  }
 catch (  SQLException e) {
    Class<?> driverClass=context.loadPluginClass(getJDBCPluginId());
    LOG.debug("String_Node_Str",dbSinkConfig.jdbcPluginType,dbSinkConfig.jdbcPluginName,driverClass.getName(),JDBCDriverShim.class.getName());
    DriverManager.registerDriver(new JDBCDriverShim((Driver)driverClass.newInstance()));
  }
}

Fixed version (ground truth):
/** 
 * Ensures that the JDBC driver is available for   {@link DriverManager}
 * @throws Exception if the driver is not available
 */
private void ensureJDBCDriverIsAvailable() throws Exception {
  try {
    DriverManager.getDriver(dbSinkConfig.connectionString);
  }
 catch (  SQLException e) {
    LOG.debug("String_Node_Str",dbSinkConfig.jdbcPluginType,dbSinkConfig.jdbcPluginName,driverClass.getName(),JDBCDriverShim.class.getName());
    driverShim=new JDBCDriverShim(driverClass.newInstance());
    DBUtils.deregisterAllDrivers(driverClass);
    DriverManager.registerDriver(driverShim);
  }
}
Program: 6881
Project: 6881
Buggy source:
@Override public void destroy(){
  ETLDBInputFormat.deregisterDrivers();
  DBUtils.cleanup(driverClass);
}

Fixed version (ground truth):
@Override public void destroy(){
  DBUtils.cleanup(driverClass);
}
Program: 6882
Project: 6882
Buggy source:
@Override public Connection getConnection(){
  if (this.connection == null) {
    Configuration conf=getConf();
    try {
      String url=conf.get(DBConfiguration.URL_PROPERTY);
      try {
        DriverManager.getDriver(url);
      }
 catch (      SQLException e) {
        if (driver == null) {
          ClassLoader classLoader=conf.getClassLoader();
          Class<? extends Driver> driverClass=(Class<? extends Driver>)classLoader.loadClass(conf.get(DBConfiguration.DRIVER_CLASS_PROPERTY));
          driver=driverClass.newInstance();
          DBUtils.deRegisterDriver(driverClass);
          driverShim=new JDBCDriverShim(driver);
          DriverManager.registerDriver(driverShim);
          LOG.info("String_Node_Str",driverShim,driverShim.hashCode(),driverShim.getClass().getName());
          LOG.info("String_Node_Str",driver,driver.hashCode(),driver.getClass().getName());
        }
      }
      if (conf.get(DBConfiguration.USERNAME_PROPERTY) == null) {
        this.connection=DriverManager.getConnection(url);
      }
 else {
        this.connection=DriverManager.getConnection(url,conf.get(DBConfiguration.USERNAME_PROPERTY),conf.get(DBConfiguration.PASSWORD_PROPERTY));
      }
      this.connection.setAutoCommit(false);
      this.connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
    }
 catch (    Exception e) {
      throw Throwables.propagate(e);
    }
  }
  return this.connection;
}

Fixed version (ground truth):
@Override public Connection getConnection(){
  if (this.connection == null) {
    Configuration conf=getConf();
    try {
      String url=conf.get(DBConfiguration.URL_PROPERTY);
      try {
        DriverManager.getDriver(url);
      }
 catch (      SQLException e) {
        if (driverShim == null) {
          if (driver == null) {
            ClassLoader classLoader=conf.getClassLoader();
            @SuppressWarnings("String_Node_Str") Class<? extends Driver> driverClass=(Class<? extends Driver>)classLoader.loadClass(conf.get(DBConfiguration.DRIVER_CLASS_PROPERTY));
            driver=driverClass.newInstance();
            DBUtils.deregisterAllDrivers(driverClass);
          }
          driverShim=new JDBCDriverShim(driver);
          DriverManager.registerDriver(driverShim);
          LOG.debug("String_Node_Str",driverShim,driver);
        }
      }
      if (conf.get(DBConfiguration.USERNAME_PROPERTY) == null) {
        this.connection=DriverManager.getConnection(url);
      }
 else {
        this.connection=DriverManager.getConnection(url,conf.get(DBConfiguration.USERNAME_PROPERTY),conf.get(DBConfiguration.PASSWORD_PROPERTY));
      }
      this.connection.setAutoCommit(false);
      this.connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
    }
 catch (    Exception e) {
      throw Throwables.propagate(e);
    }
  }
  return this.connection;
}
Program: 6883
Project: 6883
Buggy source:
private Connection getConnection(Configuration conf){
  ClassLoader classLoader=conf.getClassLoader();
  Connection connection;
  try {
    Class<?> driverClass=classLoader.loadClass(conf.get(DBConfiguration.DRIVER_CLASS_PROPERTY));
    String url=conf.get(DBConfiguration.URL_PROPERTY);
    LOG.debug("String_Node_Str" + JDBCDriverShim.class.getName());
    DriverManager.registerDriver(new JDBCDriverShim((Driver)driverClass.newInstance()));
    if (conf.get(DBConfiguration.USERNAME_PROPERTY) == null) {
      connection=DriverManager.getConnection(url);
    }
 else {
      connection=DriverManager.getConnection(url,conf.get(DBConfiguration.USERNAME_PROPERTY),conf.get(DBConfiguration.PASSWORD_PROPERTY));
    }
    connection.setAutoCommit(false);
    connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
  return connection;
}

Fixed version (ground truth):
private Connection getConnection(Configuration conf){
  Connection connection;
  try {
    String url=conf.get(DBConfiguration.URL_PROPERTY);
    try {
      DriverManager.getDriver(url);
    }
 catch (    SQLException e) {
      if (driverShim == null) {
        if (driver == null) {
          ClassLoader classLoader=conf.getClassLoader();
          @SuppressWarnings("String_Node_Str") Class<? extends Driver> driverClass=(Class<? extends Driver>)classLoader.loadClass(conf.get(DBConfiguration.DRIVER_CLASS_PROPERTY));
          driver=driverClass.newInstance();
          DBUtils.deregisterAllDrivers(driverClass);
        }
        driverShim=new JDBCDriverShim(driver);
        DriverManager.registerDriver(driverShim);
        LOG.debug("String_Node_Str",driverShim,driver);
      }
    }
    if (conf.get(DBConfiguration.USERNAME_PROPERTY) == null) {
      connection=DriverManager.getConnection(url);
    }
 else {
      connection=DriverManager.getConnection(url,conf.get(DBConfiguration.USERNAME_PROPERTY),conf.get(DBConfiguration.PASSWORD_PROPERTY));
    }
    connection.setAutoCommit(false);
    connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
  }
 catch (  Exception e) {
    throw Throwables.propagate(e);
  }
  return connection;
}
Program: 6884
Project: 6884
Buggy source:
@Override public RecordWriter<K,V> getRecordWriter(TaskAttemptContext context) throws IOException {
  Configuration conf=context.getConfiguration();
  DBConfiguration dbConf=new DBConfiguration(conf);
  String tableName=dbConf.getOutputTableName();
  String[] fieldNames=dbConf.getOutputFieldNames();
  if (fieldNames == null) {
    fieldNames=new String[dbConf.getOutputFieldCount()];
  }
  try {
    Connection connection=getConnection(conf);
    PreparedStatement statement=connection.prepareStatement(constructQuery(tableName,fieldNames));
    return new DBRecordWriter(connection,statement);
  }
 catch (  Exception ex) {
    throw new IOException(ex.getMessage());
  }
}

Fixed version (ground truth):
@Override public RecordWriter<K,V> getRecordWriter(TaskAttemptContext context) throws IOException {
  Configuration conf=context.getConfiguration();
  DBConfiguration dbConf=new DBConfiguration(conf);
  String tableName=dbConf.getOutputTableName();
  String[] fieldNames=dbConf.getOutputFieldNames();
  if (fieldNames == null) {
    fieldNames=new String[dbConf.getOutputFieldCount()];
  }
  try {
    Connection connection=getConnection(conf);
    PreparedStatement statement=connection.prepareStatement(constructQuery(tableName,fieldNames));
    return new DBRecordWriter(connection,statement){
      @Override public void close(      TaskAttemptContext context) throws IOException {
        super.close(context);
        try {
          DriverManager.deregisterDriver(driverShim);
        }
 catch (        SQLException e) {
          throw new IOException(e);
        }
      }
    }
;
  }
 catch (  Exception ex) {
    throw new IOException(ex.getMessage());
  }
}
Program: 6885
Project: 6885
Buggy source:
@Override public void start(){
  createSystemHBaseNamespace();
  updateConfigurationTable();
  LogAppenderInitializer logAppenderInitializer=baseInjector.getInstance(LogAppenderInitializer.class);
  logAppenderInitializer.initialize();
  zkClient.startAndWait();
  Futures.getUnchecked(ZKOperations.ignoreError(zkClient.create("String_Node_Str",null,CreateMode.PERSISTENT),KeeperException.NodeExistsException.class,null));
  twillRunner.startAndWait();
  kafkaClient.startAndWait();
  metricsCollectionService.startAndWait();
  serviceStore.startAndWait();
  leaderElection.startAndWait();
}

Fixed version (ground truth):
@Override public void start(){
  try {
    URLConnections.setDefaultUseCaches(false);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
  }
  createSystemHBaseNamespace();
  updateConfigurationTable();
  LogAppenderInitializer logAppenderInitializer=baseInjector.getInstance(LogAppenderInitializer.class);
  logAppenderInitializer.initialize();
  zkClient.startAndWait();
  Futures.getUnchecked(ZKOperations.ignoreError(zkClient.create("String_Node_Str",null,CreateMode.PERSISTENT),KeeperException.NodeExistsException.class,null));
  twillRunner.startAndWait();
  kafkaClient.startAndWait();
  metricsCollectionService.startAndWait();
  serviceStore.startAndWait();
  leaderElection.startAndWait();
}
Program: 6886
Project: 6886
Buggy source:
/** 
 * Start the service.
 */
public void startUp() throws Exception {
  cleanupTempDir();
  txService.startAndWait();
  metricsCollectionService.startAndWait();
  datasetService.startAndWait();
  serviceStore.startAndWait();
  streamService.startAndWait();
  logAppenderInitializer.initialize();
  Service.State state=appFabricServer.startAndWait();
  if (state != Service.State.RUNNING) {
    throw new Exception("String_Node_Str");
  }
  metricsQueryService.startAndWait();
  router.startAndWait();
  if (userInterfaceService != null) {
    userInterfaceService.startAndWait();
  }
  if (securityEnabled) {
    externalAuthenticationServer.startAndWait();
  }
  if (exploreExecutorService != null) {
    exploreExecutorService.startAndWait();
  }
  String protocol=sslEnabled ? "String_Node_Str" : "String_Node_Str";
  int dashboardPort=sslEnabled ? configuration.getInt(Constants.Dashboard.SSL_BIND_PORT) : configuration.getInt(Constants.Dashboard.BIND_PORT);
  System.out.println("String_Node_Str");
  System.out.printf("String_Node_Str",protocol,"String_Node_Str",dashboardPort);
}

Fixed version (ground truth):
/** 
 * Start the service.
 */
public void startUp() throws Exception {
  URLConnections.setDefaultUseCaches(false);
  cleanupTempDir();
  txService.startAndWait();
  metricsCollectionService.startAndWait();
  datasetService.startAndWait();
  serviceStore.startAndWait();
  streamService.startAndWait();
  logAppenderInitializer.initialize();
  Service.State state=appFabricServer.startAndWait();
  if (state != Service.State.RUNNING) {
    throw new Exception("String_Node_Str");
  }
  metricsQueryService.startAndWait();
  router.startAndWait();
  if (userInterfaceService != null) {
    userInterfaceService.startAndWait();
  }
  if (securityEnabled) {
    externalAuthenticationServer.startAndWait();
  }
  if (exploreExecutorService != null) {
    exploreExecutorService.startAndWait();
  }
  String protocol=sslEnabled ? "String_Node_Str" : "String_Node_Str";
  int dashboardPort=sslEnabled ? configuration.getInt(Constants.Dashboard.SSL_BIND_PORT) : configuration.getInt(Constants.Dashboard.BIND_PORT);
  System.out.println("String_Node_Str");
  System.out.printf("String_Node_Str",protocol,"String_Node_Str",dashboardPort);
}
Program: 6889
Project: 6889
Buggy source:
@Override public void prepareRun(BatchSinkContext context){
  LOG.debug("String_Node_Str",dbSinkConfig.tableName,dbSinkConfig.jdbcPluginType,dbSinkConfig.jdbcPluginName,dbSinkConfig.connectionString,dbSinkConfig.columns);
  Job job=context.getHadoopJob();
  conf=job.getConfiguration();
  Class<?> driverClass=context.loadPluginClass(getJDBCPluginId());
  if (dbSinkConfig.user == null && dbSinkConfig.password == null) {
    DBConfiguration.configureDB(conf,driverClass.getName(),dbSinkConfig.connectionString);
  }
 else {
    DBConfiguration.configureDB(conf,driverClass.getName(),dbSinkConfig.connectionString,dbSinkConfig.user,dbSinkConfig.password);
  }
  List<String> fields=Lists.newArrayList(Splitter.on("String_Node_Str").omitEmptyStrings().split(dbSinkConfig.columns));
  try {
    ETLDBOutputFormat.setOutput(job,dbSinkConfig.tableName,fields.toArray(new String[fields.size()]));
  }
 catch (  IOException e) {
    throw Throwables.propagate(e);
  }
  job.setOutputFormatClass(ETLDBOutputFormat.class);
}

Fixed version (ground truth):
@Override public void prepareRun(BatchSinkContext context){
  LOG.debug("String_Node_Str",dbSinkConfig.tableName,dbSinkConfig.jdbcPluginType,dbSinkConfig.jdbcPluginName,dbSinkConfig.connectionString,dbSinkConfig.columns);
  Job job=context.getHadoopJob();
  Configuration hConf=job.getConfiguration();
  Class<? extends Driver> driverClass=context.loadPluginClass(getJDBCPluginId());
  if (dbSinkConfig.user == null && dbSinkConfig.password == null) {
    DBConfiguration.configureDB(hConf,driverClass.getName(),dbSinkConfig.connectionString);
  }
 else {
    DBConfiguration.configureDB(hConf,driverClass.getName(),dbSinkConfig.connectionString,dbSinkConfig.user,dbSinkConfig.password);
  }
  List<String> fields=Lists.newArrayList(Splitter.on("String_Node_Str").omitEmptyStrings().split(dbSinkConfig.columns));
  try {
    ETLDBOutputFormat.setOutput(job,dbSinkConfig.tableName,fields.toArray(new String[fields.size()]));
  }
 catch (  IOException e) {
    throw Throwables.propagate(e);
  }
  job.setOutputFormatClass(ETLDBOutputFormat.class);
}
Program: 6890
Project: 6890
Buggy source:
@Override public void initialize(BatchSinkContext context) throws Exception {
  super.initialize(context);
  setResultSetMetadata(context);
}

Fixed version (ground truth):
@Override public void initialize(BatchSinkContext context) throws Exception {
  super.initialize(context);
  setResultSetMetadata(context);
  driverClass=context.loadPluginClass(getJDBCPluginId());
}
Program: 6891
Project: 6891
Buggy source:
private void setResultSetMetadata(BatchSinkContext context) throws Exception {
  ensureJDBCDriverIsAvailable(context);
  Connection connection;
  if (dbSinkConfig.user == null) {
    connection=DriverManager.getConnection(dbSinkConfig.connectionString);
  }
 else {
    connection=DriverManager.getConnection(dbSinkConfig.connectionString,dbSinkConfig.user,dbSinkConfig.password);
  }
  try {
    Statement statement=connection.createStatement();
    try {
      ResultSet rs=statement.executeQuery(String.format("String_Node_Str",dbSinkConfig.columns,dbSinkConfig.tableName));
      try {
        resultSetMetadata=rs.getMetaData();
      }
  finally {
        rs.close();
      }
    }
  finally {
      statement.close();
    }
  }
  finally {
    connection.close();
  }
}

Fixed version (ground truth):
private void setResultSetMetadata(BatchSinkContext context) throws Exception {
  ensureJDBCDriverIsAvailable(context);
  Connection connection;
  if (dbSinkConfig.user == null) {
    connection=DriverManager.getConnection(dbSinkConfig.connectionString);
  }
 else {
    connection=DriverManager.getConnection(dbSinkConfig.connectionString,dbSinkConfig.user,dbSinkConfig.password);
  }
  try {
    try (Statement statement=connection.createStatement();ResultSet rs=statement.executeQuery(String.format("String_Node_Str",dbSinkConfig.columns,dbSinkConfig.tableName))){
      resultSetMetadata=rs.getMetaData();
    }
   }
  finally {
    connection.close();
  }
}