nus-yam/ex-repair huggingface dataset:
Program: 59733
Project: 59733
Buggy source:
@Override public Configuration getConfiguration(AllocatedEvaluator allocatedEvaluator){
  try {
    final NumberedSplit<InputSplit> numberedSplit=evaluatorToPartitionMapper.getInputSplit(allocatedEvaluator.getId());
    final Configuration contextIdConfiguration=ContextConfiguration.CONF.set(ContextConfiguration.IDENTIFIER,"String_Node_Str" + numberedSplit.getIndex()).build();
    final Tang tang=Tang.Factory.getTang();
    final JavaConfigurationBuilder jcb=tang.newConfigurationBuilder(contextIdConfiguration);
    if (inMemory) {
      jcb.bindImplementation(DataSet.class,InMemoryInputFormatDataSet.class);
    }
 else {
      jcb.bindImplementation(DataSet.class,InputFormatDataSet.class);
    }
    jcb.bindNamedParameter(InputFormatExternalConstructor.SerializedJobConf.class,serializedJobConf);
    jcb.bindNamedParameter(InputSplitExternalConstructor.SerializedInputSplit.class,WritableSerializer.serialize(numberedSplit.getEntry()));
    jcb.bindConstructor(InputSplit.class,(Class<? extends ExternalConstructor<InputSplit>>)InputSplitExternalConstructor.class);
    return jcb.build();
  }
 catch (  BindException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public Configuration getConfiguration(AllocatedEvaluator allocatedEvaluator){
  try {
    final NumberedSplit<InputSplit> numberedSplit=evaluatorToPartitionMapper.getInputSplit(allocatedEvaluator.getEvaluatorDescriptor().getNodeDescriptor().getName(),allocatedEvaluator.getId());
    final Configuration contextIdConfiguration=ContextConfiguration.CONF.set(ContextConfiguration.IDENTIFIER,"String_Node_Str" + numberedSplit.getIndex()).build();
    final Tang tang=Tang.Factory.getTang();
    final JavaConfigurationBuilder jcb=tang.newConfigurationBuilder(contextIdConfiguration);
    if (inMemory) {
      jcb.bindImplementation(DataSet.class,InMemoryInputFormatDataSet.class);
    }
 else {
      jcb.bindImplementation(DataSet.class,InputFormatDataSet.class);
    }
    jcb.bindNamedParameter(InputFormatExternalConstructor.SerializedJobConf.class,serializedJobConf);
    jcb.bindNamedParameter(InputSplitExternalConstructor.SerializedInputSplit.class,WritableSerializer.serialize(numberedSplit.getEntry()));
    jcb.bindConstructor(InputSplit.class,(Class<? extends ExternalConstructor<InputSplit>>)InputSplitExternalConstructor.class);
    return jcb.build();
  }
 catch (  BindException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 59734
Project: 59734
Buggy source:
/** 
 * Cancels the running process if it is running.
 */
public void cancel(){
  if (this.isStarted() && !this.isEnded()) {
    this.process.destroy();
  }
  if (this.isStarted() && !this.isEnded()) {
    LOG.log(Level.WARNING,"String_Node_Str");
    if (OSUtils.isLinux()) {
      LOG.log(Level.WARNING,"String_Node_Str");
      try {
        final long pid=readPID();
        OSUtils.kill(pid);
      }
 catch (      final IOException|InterruptedException e) {
        LOG.log(Level.SEVERE,"String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Cancels the running process if it is running.
 */
public final void cancel(){
  this.stateLock.lock();
  try {
    if (this.processIsRunning()) {
      this.process.destroy();
      this.doneCond.await(DESTROY_WAIT_TIME,TimeUnit.MILLISECONDS);
    }
    if (this.processIsRunning()) {
      LOG.log(Level.WARNING,"String_Node_Str");
      if (OSUtils.isLinux()) {
        LOG.log(Level.WARNING,"String_Node_Str");
        try {
          final long pid=readPID();
          OSUtils.kill(pid);
        }
 catch (        final IOException|InterruptedException e) {
          LOG.log(Level.SEVERE,"String_Node_Str",e);
        }
      }
    }
  }
 catch (  final InterruptedException ex) {
    LOG.log(Level.SEVERE,"String_Node_Str",new Object[]{this.id,ex});
  }
 finally {
    this.stateLock.unlock();
  }
}
Program: 59735
Project: 59735
Buggy source:
private long readPID() throws IOException {
  final String PIDFileName=this.folder.getAbsolutePath() + "String_Node_Str" + PIDStoreStartHandler.PID_FILE_NAME;
  try (final BufferedReader r=new BufferedReader(new FileReader(PIDFileName))){
    return Long.valueOf(r.readLine());
  }
 }

Fixed version (ground truth):
/** 
 * @return the PID stored in the PID file.
 * @throws IOException if the file can't be read.
 */
private long readPID() throws IOException {
  final String PIDFileName=this.folder.getAbsolutePath() + "String_Node_Str" + PIDStoreStartHandler.PID_FILE_NAME;
  try (final BufferedReader r=new BufferedReader(new FileReader(PIDFileName))){
    return Long.valueOf(r.readLine());
  }
 }
Program: 59736
Project: 59736
Buggy source:
/** 
 * @param command the command to execute.
 * @param id      The ID of the process. This is used to name files and in the logs created by this process.
 * @param folder  The folder in which this will store its stdout and stderr output
 */
public RunnableProcess(final List<String> command,final String id,final File folder){
  this.command=new ArrayList<>(command);
  this.id=id;
  this.folder=folder;
  assert(this.folder.isDirectory());
  this.folder.mkdirs();
}

Fixed version (ground truth):
/** 
 * @param command the command to execute.
 * @param id      The ID of the process. This is used to name files and in the logs created by this process.
 * @param folder  The folder in which this will store its stdout and stderr output
 */
public RunnableProcess(final List<String> command,final String id,final File folder){
  this.command=new ArrayList<>(command);
  this.id=id;
  this.folder=folder;
  assert(this.folder.isDirectory());
  this.folder.mkdirs();
  LOG.log(Level.FINEST,"String_Node_Str");
}
Program: 59737
Project: 59737
Buggy source:
@Override public void run(){
  if (isEnded() || isStarted()) {
    throw new IllegalStateException("String_Node_Str");
  }
  final File errFile=new File(folder,STD_ERROR_FILE_NAME);
  final File outFile=new File(folder,STD_OUT_FILE_NAME);
  try {
    LOG.log(Level.FINEST,"String_Node_Str",new Object[]{this.id,errFile.getAbsolutePath(),outFile.getAbsolutePath()});
    this.process=new ProcessBuilder().command(this.command).directory(this.folder).redirectError(errFile).redirectOutput(outFile).start();
    this.started=true;
  }
 catch (  final IOException ex) {
    LOG.log(Level.SEVERE,"String_Node_Str",new Object[]{this.id,this.command,ex});
  }
  try {
    final int returnCode=process.waitFor();
    this.ended=true;
    LOG.log(Level.FINEST,"String_Node_Str",new Object[]{this.id,returnCode});
  }
 catch (  final InterruptedException ex) {
    LOG.log(Level.SEVERE,"String_Node_Str",new Object[]{this.id,ex});
  }
}

Fixed version (ground truth):
/** 
 * Runs the configured process.
 * @throws java.lang.IllegalStateException if the process is already running or has been running before.
 */
@Override public final void run(){
  this.stateLock.lock();
  try {
    if (this.getState() != State.INIT) {
      throw new IllegalStateException("String_Node_Str");
    }
    final File errFile=new File(folder,STD_ERROR_FILE_NAME);
    final File outFile=new File(folder,STD_OUT_FILE_NAME);
    try {
      LOG.log(Level.FINEST,"String_Node_Str",new Object[]{this.id,errFile.getAbsolutePath(),outFile.getAbsolutePath()});
      this.process=new ProcessBuilder().command(this.command).directory(this.folder).redirectError(errFile).redirectOutput(outFile).start();
      this.setState(State.RUNNING);
    }
 catch (    final IOException ex) {
      LOG.log(Level.SEVERE,"String_Node_Str",new Object[]{this.id,this.command,ex});
    }
  }
  finally {
    this.stateLock.unlock();
  }
  try {
    final int returnValue=process.waitFor();
    this.stateLock.lock();
    try {
      this.setState(State.ENDED);
      this.doneCond.signalAll();
    }
  finally {
      this.stateLock.unlock();
    }
    LOG.log(Level.FINEST,"String_Node_Str",new Object[]{this.id,returnValue});
  }
 catch (  final InterruptedException ex) {
    LOG.log(Level.SEVERE,"String_Node_Str",new Object[]{this.id,ex});
  }
}
Program: 59738
Project: 59738
Buggy source:
/** 
 * Check to see if two boundConstructors take indistinguishable arguments. If so (and they are in the same class), then this would lead to ambiguous injection targets, and we want to fail fast. TODO could be faster. Currently O(n^2) in number of parameters.
 * @param def
 * @return
 */
private boolean equalsIgnoreOrder(ConstructorDef<?> def){
  if (getArgs().length != def.getArgs().length) {
    return false;
  }
  for (int i=0; i < getArgs().length; i++) {
    boolean found=false;
    for (int j=0; j < getArgs().length; j++) {
      if (getArgs()[i].getName().equals(getArgs()[j].getName())) {
        found=true;
      }
    }
    if (!found) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Check to see if two boundConstructors take indistinguishable arguments. If so (and they are in the same class), then this would lead to ambiguous injection targets, and we want to fail fast. TODO could be faster. Currently O(n^2) in number of parameters.
 * @param def
 * @return
 */
private boolean equalsIgnoreOrder(ConstructorDef<?> def){
  if (getArgs().length != def.getArgs().length) {
    return false;
  }
  for (int i=0; i < getArgs().length; i++) {
    boolean found=false;
    for (int j=0; j < def.getArgs().length; j++) {
      if (getArgs()[i].getName().equals(def.getArgs()[j].getName())) {
        found=true;
      }
    }
    if (!found) {
      return false;
    }
  }
  return true;
}
Program: 59739
Project: 59739
Buggy source:
@Override public void addLibrary(final File file){
  this.files.add(file);
}

Fixed version (ground truth):
@Override public void addLibrary(final File file){
  this.libraries.add(file);
}
Program: 59740
Project: 59740
Buggy source:
/** 
 * Creates the given number of temp files.
 * @param n
 * @return
 * @throws IOException
 */
private Set<File> getTempFiles(final int n) throws IOException {
  final Set<File> theFiles=new HashSet<>();
  for (int i=0; i < n; ++i) {
    final File tempFile=this.tempFileCreator.createTempFile("String_Node_Str","String_Node_Str");
    tempFile.deleteOnExit();
    theFiles.add(tempFile);
  }
  return theFiles;
}

Fixed version (ground truth):
/** 
 * Creates the given number of temp files.
 * @param n
 * @return
 * @throws IOException
 */
private Set<File> getTempFiles(final int n) throws IOException, InjectionException {
  final TempFileCreator tempFileCreator=Tang.Factory.getTang().newInjector(testEnvironment.getRuntimeConfiguration()).getInstance(TempFileCreator.class);
  final Set<File> theFiles=new HashSet<>();
  for (int i=0; i < n; ++i) {
    final File tempFile=tempFileCreator.createTempFile("String_Node_Str","String_Node_Str");
    tempFile.deleteOnExit();
    theFiles.add(tempFile);
  }
  return theFiles;
}
Program: 59741
Project: 59741
Buggy source:
/** 
 * Assembles the configuration based on TestDriverConfiguration
 * @param theFiles
 * @return
 * @throws BindException
 * @throws IOException
 */
private static Configuration getTestDriverConfiguration(final Set<File> theFiles) throws BindException, IOException {
  ConfigurationModule testDriverConfigurationModule=TestDriverConfiguration.CONF;
  for (  final File f : theFiles) {
    LOG.log(Level.INFO,"String_Node_Str" + f.getName());
    testDriverConfigurationModule=testDriverConfigurationModule.set(TestDriverConfiguration.EXPECTED_FILE_NAME,f.getName());
  }
  final Configuration testDriverConfiguration=testDriverConfigurationModule.build();
  return testDriverConfiguration;
}

Fixed version (ground truth):
/** 
 * Assembles the configuration based on TestDriverConfiguration
 * @param theFiles
 * @return
 * @throws BindException
 * @throws IOException
 */
private static Configuration getTestDriverConfiguration(final Set<File> theFiles) throws BindException, IOException {
  ConfigurationModule testDriverConfigurationModule=TestDriverConfiguration.CONF;
  for (  final File f : theFiles) {
    LOG.log(Level.FINEST,"String_Node_Str" + f.getName());
    testDriverConfigurationModule=testDriverConfigurationModule.set(TestDriverConfiguration.EXPECTED_FILE_NAME,f.getName());
  }
  final Configuration testDriverConfiguration=testDriverConfigurationModule.build();
  return testDriverConfiguration;
}
Program: 59742
Project: 59742
Buggy source:
/** 
 * Assembles the driver configuration using the DriverConfiguration class.
 * @param theFiles
 * @return
 * @throws BindException
 */
private static Configuration getDriverConfiguration(final Set<File> theFiles) throws BindException {
  ConfigurationModule driverConfigurationModule=EnvironmentUtils.addClasspath(DriverConfiguration.CONF,DriverConfiguration.GLOBAL_LIBRARIES).set(DriverConfiguration.DRIVER_IDENTIFIER,"String_Node_Str").set(DriverConfiguration.ON_DRIVER_STARTED,Driver.StartHandler.class).set(DriverConfiguration.ON_EVALUATOR_ALLOCATED,Driver.EvaluatorAllocatedHandler.class);
  for (  final File f : theFiles) {
    LOG.log(Level.INFO,"String_Node_Str" + f.getAbsolutePath());
    driverConfigurationModule=driverConfigurationModule.set(DriverConfiguration.LOCAL_FILES,f.getAbsolutePath());
  }
  return driverConfigurationModule.build();
}

Fixed version (ground truth):
/** 
 * Assembles the driver configuration using the DriverConfiguration class.
 * @param theFiles
 * @return
 * @throws BindException
 */
private static Configuration getDriverConfiguration(final Set<File> theFiles) throws BindException {
  ConfigurationModule driverConfigurationModule=EnvironmentUtils.addClasspath(DriverConfiguration.CONF,DriverConfiguration.GLOBAL_LIBRARIES).set(DriverConfiguration.DRIVER_IDENTIFIER,"String_Node_Str").set(DriverConfiguration.ON_DRIVER_STARTED,Driver.StartHandler.class).set(DriverConfiguration.ON_EVALUATOR_ALLOCATED,Driver.EvaluatorAllocatedHandler.class);
  for (  final File f : theFiles) {
    LOG.log(Level.FINEST,"String_Node_Str" + f.getAbsolutePath());
    driverConfigurationModule=driverConfigurationModule.set(DriverConfiguration.LOCAL_FILES,f.getAbsolutePath());
  }
  return driverConfigurationModule.build();
}
Program: 59743
Project: 59743
Buggy source:
/** 
 * Get a set of all classpath entries EXCEPT of those under excludeEnv directories. Every excludeEnv entry is an environment variable name.
 * @return A set of classpath entries as strings.
 */
public static Set<String> getAllClasspathJars(final String... excludeEnv){
  final Set<String> jars=new HashSet<>();
  final Set<Path> excludePaths=new HashSet<>();
  for (  final String env : excludeEnv) {
    final File file=new File(env);
    if (file.exists()) {
      excludePaths.add(file.toPath());
    }
  }
  for (  final String path : System.getProperty("String_Node_Str").split(File.pathSeparator)) {
    try {
      final File file=new File(path);
      if (file.exists()) {
        final Path absolutePath=file.toPath();
        boolean toBeAdded=true;
        for (        final Path prefix : excludePaths) {
          if (absolutePath.startsWith(prefix)) {
            toBeAdded=false;
          }
        }
        if (toBeAdded) {
          jars.add(absolutePath.toString());
        }
      }
    }
 catch (    final InvalidPathException ex) {
      LOG.log(Level.FINE,"String_Node_Str",new Object[]{path,ex});
    }
  }
  return jars;
}

Fixed version (ground truth):
/** 
 * Get a set of all classpath entries EXCEPT of those under excludeEnv directories. Every excludeEnv entry is an environment variable name.
 * @return A set of classpath entries as strings.
 */
public static Set<String> getAllClasspathJars(final String... excludeEnv){
  final Set<String> jars=new HashSet<>();
  final Set<Path> excludePaths=new HashSet<>();
  for (  final String env : excludeEnv) {
    final String path=System.getenv(env);
    if (null != path) {
      final File file=new File(path);
      if (file.exists()) {
        excludePaths.add(file.toPath());
      }
    }
  }
  for (  final String path : System.getProperty("String_Node_Str").split(File.pathSeparator)) {
    try {
      final File file=new File(path);
      if (file.exists()) {
        final Path absolutePath=file.toPath();
        boolean toBeAdded=true;
        for (        final Path prefix : excludePaths) {
          if (absolutePath.startsWith(prefix)) {
            toBeAdded=false;
          }
        }
        if (toBeAdded) {
          jars.add(absolutePath.toString());
        }
      }
    }
 catch (    final InvalidPathException ex) {
      LOG.log(Level.FINE,"String_Node_Str",new Object[]{path,ex});
    }
  }
  return jars;
}
Program: 59744
Project: 59744
Buggy source:
@Override public void onNext(final RemoteMessage<ReefServiceProtos.RuntimeErrorProto> error){
  LOG.log(Level.WARNING,"String_Node_Str",new Object[]{error.getIdentifier(),error.getMessage().getMessage()});
  this.runningJobMap.remove(error.getIdentifier());
  this.runtimeErrorHandlerFuture.get().onNext(new FailedRuntime(error.getMessage()));
}

Fixed version (ground truth):
@Override public void onNext(final RemoteMessage<ReefServiceProtos.RuntimeErrorProto> error){
  LOG.log(Level.WARNING,"String_Node_Str",new Object[]{error.getIdentifier(),error.getMessage().getMessage()});
  this.runningJobMap.remove(error.getIdentifier().toString());
  this.runtimeErrorHandlerFuture.get().onNext(new FailedRuntime(error.getMessage()));
}
Program: 59745
Project: 59745
Buggy source:
@Override public void submit(final EvaluatorRequest req){
  LOG.log(Level.FINEST,"String_Node_Str");
  final DriverRuntimeProtocol.ResourceRequestProto.Builder request=DriverRuntimeProtocol.ResourceRequestProto.newBuilder();
switch (req.getSize()) {
case MEDIUM:
    request.setResourceSize(ReefServiceProtos.SIZE.MEDIUM);
  break;
case LARGE:
request.setResourceSize(ReefServiceProtos.SIZE.LARGE);
break;
case XLARGE:
request.setResourceSize(ReefServiceProtos.SIZE.XLARGE);
break;
default :
request.setResourceSize(ReefServiceProtos.SIZE.SMALL);
}
request.setResourceCount(req.getNumber());
if (req.getMegaBytes() > 0) {
request.setMemorySize(req.getMegaBytes());
}
final ResourceCatalog.Descriptor descriptor=req.getDescriptor();
if (descriptor != null) {
if (descriptor instanceof RackDescriptor) {
request.addRackName(descriptor.getName());
}
 else if (descriptor instanceof NodeDescriptor) {
request.addNodeName(descriptor.getName());
}
}
this.futureResourceRequestHandler.get().onNext(request.build());
}

Fixed version (ground truth):
@Override public void submit(final EvaluatorRequest req){
  LOG.log(Level.FINEST,"String_Node_Str");
  final DriverRuntimeProtocol.ResourceRequestProto.Builder request=DriverRuntimeProtocol.ResourceRequestProto.newBuilder();
  if (null != req.getSize()) {
switch (req.getSize()) {
case MEDIUM:
      request.setResourceSize(ReefServiceProtos.SIZE.MEDIUM);
    break;
case LARGE:
  request.setResourceSize(ReefServiceProtos.SIZE.LARGE);
break;
case XLARGE:
request.setResourceSize(ReefServiceProtos.SIZE.XLARGE);
break;
default :
request.setResourceSize(ReefServiceProtos.SIZE.SMALL);
}
}
 else {
if (req.getMegaBytes() <= 0) {
throw new RuntimeException("String_Node_Str");
}
}
request.setResourceCount(req.getNumber());
if (req.getMegaBytes() > 0) {
request.setMemorySize(req.getMegaBytes());
}
final ResourceCatalog.Descriptor descriptor=req.getDescriptor();
if (descriptor != null) {
if (descriptor instanceof RackDescriptor) {
request.addRackName(descriptor.getName());
}
 else if (descriptor instanceof NodeDescriptor) {
request.addNodeName(descriptor.getName());
}
}
this.futureResourceRequestHandler.get().onNext(request.build());
}
Program: 59746
Project: 59746
Buggy source:
/** 
 * Update job status and notify the waiting thread.
 */
private synchronized void setStatusAndNotify(final LauncherStatus status){
  this.status=status;
  this.notify();
}

Fixed version (ground truth):
/** 
 * Update job status and notify the waiting thread.
 */
private synchronized void setStatusAndNotify(final LauncherStatus status){
  LOG.log(Level.FINEST,"String_Node_Str",new Object[]{this.status,status});
  this.status=status;
  this.notify();
}
Program: 59747
Project: 59747
Buggy source:
@Override public void onNext(final RemoteMessage<RuntimeErrorProto> error){
  LOG.log(Level.WARNING,"String_Node_Str",error.getMessage().getMessage());
  this.runtimeErrorHandlerFuture.get().onNext(new FailedRuntime(error.getMessage()));
}

Fixed version (ground truth):
@Override public void onNext(final RemoteMessage<RuntimeErrorProto> error){
  LOG.log(Level.WARNING,"String_Node_Str",new Object[]{error.getIdentifier(),error.getMessage().getMessage()});
  runningJobMap.remove(error.getIdentifier());
  this.runtimeErrorHandlerFuture.get().onNext(new FailedRuntime(error.getMessage()));
}
Program: 59748
Project: 59748
Buggy source:
public DispatchingEStage(final REEFErrorHandler errorHandler,final int numThreads){
  this.errorHandler=errorHandler;
  this.stage=new ThreadPoolStage<>(new EventHandler<DelayedOnNext>(){
    @Override public void onNext(    final DelayedOnNext promise){
      promise.handler.onNext(promise.message);
    }
  }
,numThreads);
}

Fixed version (ground truth):
public DispatchingEStage(final REEFErrorHandler errorHandler,final int numThreads){
  this.errorHandler=errorHandler;
  this.stage=new ThreadPoolStage<>(new EventHandler<DelayedOnNext>(){
    @Override public void onNext(    final DelayedOnNext promise){
      try {
        promise.handler.onNext(promise.message);
      }
  finally {
        queueLength.decrementAndGet();
      }
    }
  }
,numThreads);
}
Program: 59749
Project: 59749
Buggy source:
public <T,U extends T>DelayedOnNext(final EventHandler<T> handler,final U message){
  this.handler=(EventHandler<Object>)handler;
  this.message=message;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public <T,U extends T>DelayedOnNext(final EventHandler<T> handler,final U message){
  this.handler=(EventHandler<Object>)handler;
  this.message=message;
}
Program: 59750
Project: 59750
Buggy source:
/** 
 * Dispatch a new message by type.
 * @param type Type of event handler - must match the register() call.
 * @param message A message to process. Must be a subclass of T.
 * @param < T > Message type that event handler supports.
 * @param < U > input message type. Must be a subclass of T.
 */
public <T,U extends T>void onNext(final Class<T> type,final U message){
  final EventHandler<T> handler=(EventHandler<T>)this.handlers.get(type);
  this.stage.onNext(new DelayedOnNext(handler,message));
}

Fixed version (ground truth):
/** 
 * Dispatch a new message by type.
 * @param type Type of event handler - must match the register() call.
 * @param message A message to process. Must be a subclass of T.
 * @param < T > Message type that event handler supports.
 * @param < U > input message type. Must be a subclass of T.
 */
@SuppressWarnings("String_Node_Str") public <T,U extends T>void onNext(final Class<T> type,final U message){
  final EventHandler<T> handler=(EventHandler<T>)this.handlers.get(type);
  this.queueLength.incrementAndGet();
  this.stage.onNext(new DelayedOnNext(handler,message));
}
Program: 59751
Project: 59751
Buggy source:
@Override public void onNext(final IdleClock idleClock){
  LOG.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",new Object[]{idleClock,runtimeStatusProto.getState(),runtimeStatusProto.getOutstandingContainerRequests(),runtimeStatusProto.getContainerAllocationCount()});
synchronized (DriverManager.this.evaluators) {
    if (ReefServiceProtos.State.RUNNING == runtimeStatusProto.getState() && 0 == runtimeStatusProto.getOutstandingContainerRequests() && 0 == runtimeStatusProto.getContainerAllocationCount()) {
      LOG.log(Level.FINEST,"String_Node_Str");
      DriverManager.this.clockFuture.get().close();
    }
  }
}

Fixed version (ground truth):
@Override public void onNext(final IdleClock idleClock){
  LOG.log(Level.INFO,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",new Object[]{idleClock,runtimeStatusProto.getState(),runtimeStatusProto.getOutstandingContainerRequests(),runtimeStatusProto.getContainerAllocationCount()});
synchronized (DriverManager.this.evaluators) {
    if (ReefServiceProtos.State.RUNNING == runtimeStatusProto.getState() && 0 == runtimeStatusProto.getOutstandingContainerRequests() && 0 == runtimeStatusProto.getContainerAllocationCount() && DriverManager.this.evaluatorsClosed()) {
      try {
        Thread.sleep(500);
      }
 catch (      final InterruptedException ex) {
        LOG.log(Level.WARNING,"String_Node_Str",ex);
      }
      LOG.log(Level.FINEST,"String_Node_Str");
      DriverManager.this.clockFuture.get().close();
    }
  }
}
Program: 59752
Project: 59752
Buggy source:
/** 
 * @return current running task, or null if there is not one.
 */
final RunningTask getRunningTask(){
synchronized (this.evaluatorDescriptor) {
    return this.runningTask;
  }
}

Fixed version (ground truth):
/** 
 * @return current running task, or null if there is not one.
 */
RunningTask getRunningTask(){
synchronized (this.evaluatorDescriptor) {
    return this.runningTask;
  }
}
Program: 59753
Project: 59753
Buggy source:
private final void removeEvaluatorContext(final EvaluatorContext context){
  this.activeContextList.remove(context);
  this.activeContextIds.remove(context.getId());
}

Fixed version (ground truth):
private void removeEvaluatorContext(final EvaluatorContext context){
  this.activeContextList.remove(context);
  this.activeContextIds.remove(context.getId());
}
Program: 59754
Project: 59754
Buggy source:
@Override public final String getId(){
  return this.evaluatorId;
}

Fixed version (ground truth):
@Override public String getId(){
  return this.evaluatorId;
}
Program: 59755
Project: 59755
Buggy source:
public final EvaluatorDescriptor getEvaluatorDescriptor(){
  return this.evaluatorDescriptor;
}

Fixed version (ground truth):
public EvaluatorDescriptor getEvaluatorDescriptor(){
  return this.evaluatorDescriptor;
}
Program: 59756
Project: 59756
Buggy source:
private final void addEvaluatorContext(final EvaluatorContext context){
  this.activeContextList.add(context);
  this.activeContextIds.add(context.getId());
}

Fixed version (ground truth):
private void addEvaluatorContext(final EvaluatorContext context){
  this.activeContextList.add(context);
  this.activeContextIds.add(context.getId());
}
Program: 59757
Project: 59757
Buggy source:
/** 
 * Resource status information from the (actual) resource manager.
 */
final void handle(final DriverRuntimeProtocol.ResourceStatusProto resourceStatusProto){
synchronized (this.evaluatorDescriptor) {
    LOG.log(Level.FINEST,"String_Node_Str",resourceStatusProto.getState());
    if (resourceStatusProto.getState() == ReefServiceProtos.State.DONE || resourceStatusProto.getState() == ReefServiceProtos.State.FAILED) {
      if (this.state.ordinal() < STATE.DONE.ordinal()) {
        final StringBuilder sb=new StringBuilder();
        sb.append("String_Node_Str" + this.evaluatorId + "String_Node_Str"+ resourceStatusProto.getState()+ "String_Node_Str"+ this.state);
        if (resourceStatusProto.getDiagnostics() != null && "String_Node_Str".equals(resourceStatusProto.getDiagnostics())) {
          sb.append("String_Node_Str" + resourceStatusProto.getDiagnostics());
        }
        if (runningTask != null) {
          sb.append("String_Node_Str" + runningTask.getId() + "String_Node_Str");
        }
        this.isResourceReleased=true;
        handle(new EvaluatorException(this.evaluatorId,sb.toString(),runningTask));
        this.state=STATE.KILLED;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Resource status information from the (actual) resource manager.
 */
void handle(final DriverRuntimeProtocol.ResourceStatusProto resourceStatusProto){
synchronized (this.evaluatorDescriptor) {
    LOG.log(Level.FINEST,"String_Node_Str",resourceStatusProto.getState());
    if (resourceStatusProto.getState() == ReefServiceProtos.State.DONE || resourceStatusProto.getState() == ReefServiceProtos.State.FAILED) {
      if (this.state.ordinal() < State.DONE.ordinal()) {
        final StringBuilder sb=new StringBuilder();
        sb.append("String_Node_Str" + this.evaluatorId + "String_Node_Str"+ resourceStatusProto.getState()+ "String_Node_Str"+ this.state);
        if (resourceStatusProto.getDiagnostics() != null && "String_Node_Str".equals(resourceStatusProto.getDiagnostics())) {
          sb.append("String_Node_Str" + resourceStatusProto.getDiagnostics());
        }
        if (runningTask != null) {
          sb.append("String_Node_Str" + runningTask.getId() + "String_Node_Str");
        }
        this.isResourceReleased=true;
        handle(new EvaluatorException(this.evaluatorId,sb.toString(),runningTask));
        this.state=State.KILLED;
      }
    }
  }
}
Program: 59758
Project: 59758
Buggy source:
/** 
 * @return NodeDescriptor for the node executing this evaluator
 */
final NodeDescriptor getNodeDescriptor(){
  return this.getEvaluatorDescriptor().getNodeDescriptor();
}

Fixed version (ground truth):
/** 
 * @return NodeDescriptor for the node executing this evaluator
 */
NodeDescriptor getNodeDescriptor(){
  return this.getEvaluatorDescriptor().getNodeDescriptor();
}
Program: 59759
Project: 59759
Buggy source:
@Override public final void close(){
synchronized (this.evaluatorDescriptor) {
    if (STATE.RUNNING == this.state) {
      LOG.log(Level.WARNING,"String_Node_Str",getId());
      try {
        final EvaluatorRuntimeProtocol.EvaluatorControlProto evaluatorControlProto=EvaluatorRuntimeProtocol.EvaluatorControlProto.newBuilder().setTimestamp(System.currentTimeMillis()).setIdentifier(getId()).setKillEvaluator(EvaluatorRuntimeProtocol.KillEvaluatorProto.newBuilder().build()).build();
        handle(evaluatorControlProto);
      }
  finally {
        this.state=STATE.KILLED;
      }
    }
  }
  if (!this.isResourceReleased) {
    this.isResourceReleased=true;
    try {
      this.clock.scheduleAlarm(100,new EventHandler<Alarm>(){
        @Override public void onNext(        final Alarm alarm){
          EvaluatorManager.this.resourceReleaseHandler.onNext(DriverRuntimeProtocol.ResourceReleaseProto.newBuilder().setIdentifier(EvaluatorManager.this.evaluatorId).build());
        }
      }
);
    }
 catch (    final IllegalStateException e) {
      LOG.log(Level.WARNING,"String_Node_Str",e);
      EvaluatorManager.this.resourceReleaseHandler.onNext(DriverRuntimeProtocol.ResourceReleaseProto.newBuilder().setIdentifier(EvaluatorManager.this.evaluatorId).build());
    }
 finally {
      EvaluatorManager.this.driverManager.release(EvaluatorManager.this);
    }
  }
}

Fixed version (ground truth):
@Override public void close(){
synchronized (this.evaluatorDescriptor) {
    if (State.RUNNING == this.state) {
      LOG.log(Level.WARNING,"String_Node_Str",getId());
      try {
        final EvaluatorRuntimeProtocol.EvaluatorControlProto evaluatorControlProto=EvaluatorRuntimeProtocol.EvaluatorControlProto.newBuilder().setTimestamp(System.currentTimeMillis()).setIdentifier(getId()).setKillEvaluator(EvaluatorRuntimeProtocol.KillEvaluatorProto.newBuilder().build()).build();
        handle(evaluatorControlProto);
      }
  finally {
        this.state=State.KILLED;
      }
    }
  }
  if (!this.isResourceReleased) {
    this.isResourceReleased=true;
    try {
      this.clock.scheduleAlarm(100,new EventHandler<Alarm>(){
        @Override public void onNext(        final Alarm alarm){
          EvaluatorManager.this.resourceReleaseHandler.onNext(DriverRuntimeProtocol.ResourceReleaseProto.newBuilder().setIdentifier(EvaluatorManager.this.evaluatorId).build());
        }
      }
);
    }
 catch (    final IllegalStateException e) {
      LOG.log(Level.WARNING,"String_Node_Str",e);
      EvaluatorManager.this.resourceReleaseHandler.onNext(DriverRuntimeProtocol.ResourceReleaseProto.newBuilder().setIdentifier(EvaluatorManager.this.evaluatorId).build());
    }
 finally {
      EvaluatorManager.this.driverManager.release(EvaluatorManager.this);
    }
  }
}
Program: 59760
Project: 59760
Buggy source:
private final EvaluatorContext getEvaluatorContext(final String id){
  for (  final EvaluatorContext context : this.activeContextList) {
    if (context.getId().equals(id))     return context;
  }
  throw new RuntimeException("String_Node_Str" + id);
}

Fixed version (ground truth):
private EvaluatorContext getEvaluatorContext(final String id){
  for (  final EvaluatorContext context : this.activeContextList) {
    if (context.getId().equals(id))     return context;
  }
  throw new RuntimeException("String_Node_Str" + id);
}
Program: 59761
Project: 59761
Buggy source:
public AutoCloseable registerHandler(final Class<? extends T> messageType,final EventHandler<RemoteMessage<? extends T>> theHandler){
  final EventHandler<RemoteMessage<? extends T>> handler=msgTypeToHandlerMap.put(messageType,theHandler);
  if (handler != null) {
    msgTypeToHandlerMap.replace(messageType,theHandler);
  }
  LOG.log(Level.FINER,"String_Node_Str",messageType);
  return new Subscription(messageType,this);
}

Fixed version (ground truth):
/** 
 * Registers an event handler for a message type and returns a subscription
 * @param <T,         U extends T>
 * @param messageType
 * @param theHandler
 */
@Override public <T,U extends T>AutoCloseable registerHandler(final Class<U> messageType,final EventHandler<RemoteMessage<T>> theHandler){
  if (LOG.isLoggable(Level.FINE)) {
    LOG.log(Level.FINE,"String_Node_Str",new Object[]{this.name,messageType.getName(),theHandler.getClass().getName()});
  }
  return this.handlerContainer.registerHandler(messageType,theHandler);
}
Program: 59762
Project: 59762
Buggy source:
public AutoCloseable registerErrorHandler(final EventHandler<Exception> theHandler){
  transport.registerErrorHandler(theHandler);
  return new Subscription(new Exception(),this);
}

Fixed version (ground truth):
/** 
 * Registers an exception handler and returns a subscription
 * @param theHandler
 */
@Override public AutoCloseable registerErrorHandler(final EventHandler<Exception> theHandler){
  if (LOG.isLoggable(Level.FINE)) {
    LOG.log(Level.FINE,"String_Node_Str",new Object[]{this.name,theHandler.getClass().getName()});
  }
  return this.handlerContainer.registerErrorHandler(theHandler);
}
Program: 59763
Project: 59763
Buggy source:
/** 
 * Returns my identifier
 */
@Override public RemoteIdentifier getMyIdentifier(){
  return myIdentifier;
}

Fixed version (ground truth):
/** 
 * Returns my identifier
 */
@Override public RemoteIdentifier getMyIdentifier(){
  return this.myIdentifier;
}
Program: 59765
Project: 59765
Buggy source:
@Test public void testThreeConstructors() throws BindException, InjectionException {
  JavaConfigurationBuilder cb=tang.newConfigurationBuilder();
  cb.bindNamedParameter(TCInt.class,"String_Node_Str");
  cb.bindNamedParameter(TCString.class,"String_Node_Str");
  ThreeConstructors tc=tang.newInjector(cb.build()).getInstance(ThreeConstructors.class);
  Assert.assertEquals(1,tc.i);
  Assert.assertEquals("String_Node_Str",tc.s);
  cb=tang.newConfigurationBuilder();
  cb.bindNamedParameter(TCInt.class,"String_Node_Str");
  tc=tang.newInjector(cb.build()).getInstance(ThreeConstructors.class);
  Assert.assertEquals(1,tc.i);
  Assert.assertEquals("String_Node_Str",tc.s);
  cb=tang.newConfigurationBuilder();
  cb.bindNamedParameter(TCString.class,"String_Node_Str");
  tc=tang.newInjector(cb.build()).getInstance(ThreeConstructors.class);
  Assert.assertEquals(-1,tc.i);
  Assert.assertEquals("String_Node_Str",tc.s);
  cb=tang.newConfigurationBuilder();
  cb.bindNamedParameter(TCFloat.class,"String_Node_Str");
  tc=tang.newInjector(cb.build()).getInstance(ThreeConstructors.class);
  Assert.assertEquals(-1,tc.i);
  Assert.assertEquals("String_Node_Str",tc.s);
  Assert.assertEquals(2.0f,tc.f);
}

Fixed version (ground truth):
@Test public void testThreeConstructors() throws BindException, InjectionException {
  JavaConfigurationBuilder cb=tang.newConfigurationBuilder();
  cb.bindNamedParameter(TCInt.class,"String_Node_Str");
  cb.bindNamedParameter(TCString.class,"String_Node_Str");
  ThreeConstructors tc=tang.newInjector(cb.build()).getInstance(ThreeConstructors.class);
  Assert.assertEquals(1,tc.i);
  Assert.assertEquals("String_Node_Str",tc.s);
  cb=tang.newConfigurationBuilder();
  cb.bindNamedParameter(TCInt.class,"String_Node_Str");
  tc=tang.newInjector(cb.build()).getInstance(ThreeConstructors.class);
  Assert.assertEquals(1,tc.i);
  Assert.assertEquals("String_Node_Str",tc.s);
  cb=tang.newConfigurationBuilder();
  cb.bindNamedParameter(TCString.class,"String_Node_Str");
  tc=tang.newInjector(cb.build()).getInstance(ThreeConstructors.class);
  Assert.assertEquals(-1,tc.i);
  Assert.assertEquals("String_Node_Str",tc.s);
  cb=tang.newConfigurationBuilder();
  cb.bindNamedParameter(TCFloat.class,"String_Node_Str");
  tc=tang.newInjector(cb.build()).getInstance(ThreeConstructors.class);
  Assert.assertEquals(-1,tc.i);
  Assert.assertEquals("String_Node_Str",tc.s);
  Assert.assertEquals(2.0f,tc.f,1e-9);
}
Program: 59767
Project: 59767
Buggy source:
/** 
 * Main method that starts the Retained Evaluators job.
 * @param args command line parameters.
 */
public static void main(final String[] args){
  try {
    final Configuration commandLineConf=parseCommandLine(args);
    final Configuration runtimeConfig=getClientConfiguration(commandLineConf);
    LOG.log(Level.INFO,"String_Node_Str",ConfigurationFile.toConfigurationString(runtimeConfig));
    final Configuration driverConfig=EnvironmentUtils.addClasspath(DriverConfiguration.CONF,DriverConfiguration.GLOBAL_LIBRARIES).set(DriverConfiguration.DRIVER_IDENTIFIER,"String_Node_Str" + System.currentTimeMillis()).set(DriverConfiguration.ON_EVALUATOR_ALLOCATED,JobDriver.AllocatedEvaluatorHandler.class).set(DriverConfiguration.ON_EVALUATOR_FAILED,JobDriver.FailedEvaluatorHandler.class).set(DriverConfiguration.ON_CONTEXT_ACTIVE,JobDriver.ActiveContextHandler.class).set(DriverConfiguration.ON_CONTEXT_CLOSED,JobDriver.ClosedContextHandler.class).set(DriverConfiguration.ON_CONTEXT_FAILED,JobDriver.FailedContextHandler.class).set(DriverConfiguration.ON_ACTIVITY_COMPLETED,JobDriver.CompletedActivityHandler.class).set(DriverConfiguration.ON_DRIVER_STARTED,JobDriver.StartHandler.class).set(DriverConfiguration.ON_DRIVER_STOP,JobDriver.StopHandler.class).build();
    DriverLauncher.getLauncher(runtimeConfig).run(TANGUtils.merge(driverConfig,commandLineConf),0);
  }
 catch (  final BindException|InjectionException|IOException ex) {
    LOG.log(Level.SEVERE,"String_Node_Str",ex);
  }
}

Fixed version (ground truth):
/** 
 * Main method that starts the Retained Evaluators job.
 * @param args command line parameters.
 */
public static void main(final String[] args){
  try {
    final Configuration commandLineConf=parseCommandLine(args);
    final Configuration runtimeConfig=getClientConfiguration(commandLineConf);
    LOG.log(Level.INFO,"String_Node_Str",ConfigurationFile.toConfigurationString(runtimeConfig));
    final Configuration driverConfig=EnvironmentUtils.addClasspath(DriverConfiguration.CONF,DriverConfiguration.GLOBAL_LIBRARIES).set(DriverConfiguration.DRIVER_IDENTIFIER,"String_Node_Str" + System.currentTimeMillis()).set(DriverConfiguration.ON_DRIVER_STARTED,JobDriver.StartHandler.class).set(DriverConfiguration.ON_EVALUATOR_ALLOCATED,JobDriver.AllocatedEvaluatorHandler.class).set(DriverConfiguration.ON_ACTIVITY_RUNNING,JobDriver.RunningActivityHandler.class).set(DriverConfiguration.ON_ACTIVITY_COMPLETED,JobDriver.CompletedActivityHandler.class).build();
    DriverLauncher.getLauncher(runtimeConfig).run(TANGUtils.merge(driverConfig,commandLineConf),0);
  }
 catch (  final BindException|InjectionException|IOException ex) {
    LOG.log(Level.SEVERE,"String_Node_Str",ex);
  }
}
Program: 59768
Project: 59768
Buggy source:
public <T,U extends T>void addParser(Class<U> clazz,Class<? extends ExternalConstructor<T>> ec) throws BindException {
  Constructor<? extends ExternalConstructor<T>> c;
  try {
    c=ec.getConstructor(String.class);
  }
 catch (  NoSuchMethodException e) {
    throw new BindException("String_Node_Str" + ReflectionUtilities.getFullName(ec) + "String_Node_Str",e);
  }
  c.setAccessible(true);
  parsers.put(ReflectionUtilities.getFullName(clazz),c);
}

Fixed version (ground truth):
public <T,U extends T>void addParser(Class<U> clazz,Class<? extends ExternalConstructor<T>> ec) throws BindException {
  Constructor<? extends ExternalConstructor<T>> c;
  try {
    c=ec.getDeclaredConstructor(String.class);
    c.setAccessible(true);
  }
 catch (  NoSuchMethodException e) {
    throw new BindException("String_Node_Str" + ReflectionUtilities.getFullName(ec) + "String_Node_Str",e);
  }
  c.setAccessible(true);
  parsers.put(ReflectionUtilities.getFullName(clazz),c);
}
Program: 59769
Project: 59769
Buggy source:
@SuppressWarnings("String_Node_Str") private <T>void addConfiguration(ClassHierarchy ns,ConfigurationBuilderImpl builder) throws BindException {
  namespace=namespace.merge(ns);
  ((ClassHierarchyImpl)namespace).parameterParser.mergeIn(((ClassHierarchyImpl)namespace).parameterParser);
  for (  ClassNode<?> cn : builder.boundImpls.keySet()) {
    bind(cn.getFullName(),builder.boundImpls.get(cn).getFullName());
  }
  for (  ClassNode<?> cn : builder.boundConstructors.keySet()) {
    bind(cn.getFullName(),builder.boundConstructors.get(cn).getFullName());
  }
  for (  NamedParameterNode<?> np : builder.namedParameters.keySet()) {
    bind(np.getFullName(),builder.namedParameters.get(np));
  }
  for (  ClassNode<?> cn : builder.legacyConstructors.keySet()) {
    registerLegacyConstructor(cn,builder.legacyConstructors.get(cn).getArgs());
  }
  for (  Entry<NamedParameterNode<Set<?>>,Object> e : builder.boundSetEntries) {
    String name=((NamedParameterNode<Set<T>>)(NamedParameterNode<?>)e.getKey()).getFullName();
    if (e.getValue() instanceof Node) {
      bindSetEntry(name,(Node)e.getValue());
    }
 else     if (e.getValue() instanceof String) {
      bindSetEntry(name,(String)e.getValue());
    }
 else {
      throw new IllegalStateException();
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private <T>void addConfiguration(ClassHierarchy ns,ConfigurationBuilderImpl builder) throws BindException {
  namespace=namespace.merge(ns);
  if ((namespace instanceof ClassHierarchyImpl || builder.namespace instanceof ClassHierarchyImpl)) {
    if ((namespace instanceof ClassHierarchyImpl && builder.namespace instanceof ClassHierarchyImpl)) {
      ((ClassHierarchyImpl)namespace).parameterParser.mergeIn(((ClassHierarchyImpl)builder.namespace).parameterParser);
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  for (  ClassNode<?> cn : builder.boundImpls.keySet()) {
    bind(cn.getFullName(),builder.boundImpls.get(cn).getFullName());
  }
  for (  ClassNode<?> cn : builder.boundConstructors.keySet()) {
    bind(cn.getFullName(),builder.boundConstructors.get(cn).getFullName());
  }
  for (  NamedParameterNode<?> np : builder.namedParameters.keySet()) {
    bind(np.getFullName(),builder.namedParameters.get(np));
  }
  for (  ClassNode<?> cn : builder.legacyConstructors.keySet()) {
    registerLegacyConstructor(cn,builder.legacyConstructors.get(cn).getArgs());
  }
  for (  Entry<NamedParameterNode<Set<?>>,Object> e : builder.boundSetEntries) {
    String name=((NamedParameterNode<Set<T>>)(NamedParameterNode<?>)e.getKey()).getFullName();
    if (e.getValue() instanceof Node) {
      bindSetEntry(name,(Node)e.getValue());
    }
 else     if (e.getValue() instanceof String) {
      bindSetEntry(name,(String)e.getValue());
    }
 else {
      throw new IllegalStateException();
    }
  }
}
Program: 59770
Project: 59770
Buggy source:
private static String getNthPrefix(String str,int n){
  n++;
  for (int i=0; i < str.length(); i++) {
    char c=str.charAt(i);
    if (c == '.' || c == '$') {
      n--;
    }
    if (n == 0) {
      return str.substring(0,i);
    }
  }
  if (n == 1) {
    return str;
  }
 else {
    throw new ArrayIndexOutOfBoundsException();
  }
}

Fixed version (ground truth):
private static String getNthPrefix(String str,int n){
  n++;
  for (int i=0; i < str.length(); i++) {
    char c=str.charAt(i);
    if (c == '.' || c == '$' || c == '+') {
      n--;
    }
    if (n == 0) {
      return str.substring(0,i);
    }
  }
  if (n == 1) {
    return str;
  }
 else {
    throw new ArrayIndexOutOfBoundsException();
  }
}
Program: 59771
Project: 59771
Buggy source:
public void validatePlan() throws IOException, BindException, InjectionException {
  final Tang t=Tang.Factory.getTang();
  final InputStream chin=new FileInputStream(ch);
  final ClassHierarchyProto.Node root;
  try {
    root=ClassHierarchyProto.Node.parseFrom(chin);
  }
  finally {
    chin.close();
  }
  final ClassHierarchy ch=new ProtocolBufferClassHierarchy(root);
  final ConfigurationBuilder cb=t.newConfigurationBuilder(ch);
  ConfigurationFile.addConfiguration(cb,inConfig);
  if (target != null) {
    Injector i=t.newInjector(cb.build());
    InjectionPlan<?> ip=i.getInjectionPlan(target);
    if (!ip.isInjectable()) {
      throw new InjectionException(target + "String_Node_Str" + ip.toCantInjectString());
    }
  }
  ConfigurationFile.writeConfigurationFile(cb.build(),outConfig);
}

Fixed version (ground truth):
public void validatePlan() throws IOException, BindException, InjectionException {
  final Tang t=Tang.Factory.getTang();
  final InputStream chin=new FileInputStream(ch);
  final ClassHierarchyProto.Node root;
  try {
    root=ClassHierarchyProto.Node.parseFrom(chin);
  }
  finally {
    chin.close();
  }
  final ClassHierarchy ch=new ProtocolBufferClassHierarchy(root);
  final ConfigurationBuilder cb=t.newConfigurationBuilder(ch);
  if (!inConfig.canRead()) {
    throw new IOException("String_Node_Str" + inConfig);
  }
  ConfigurationFile.addConfiguration(cb,inConfig);
  if (target != null) {
    Injector i=t.newInjector(cb.build());
    InjectionPlan<?> ip=i.getInjectionPlan(target);
    if (!ip.isInjectable()) {
      throw new InjectionException(target + "String_Node_Str" + ip.toCantInjectString());
    }
  }
  ConfigurationFile.writeConfigurationFile(cb.build(),outConfig);
}
Program: 59773
Project: 59773
Buggy source:
@Override protected String toAmbiguousInjectString(){
  if (alternatives.length == 1) {
    return alternatives[0].toAmbiguousInjectString();
  }
 else   if (selectedIndex != -1) {
    return alternatives[selectedIndex].toAmbiguousInjectString();
  }
 else {
    List<InjectionPlan<?>> alts=new ArrayList<>();
    for (    InjectionPlan<?> alt : alternatives) {
      if (alt.isAmbiguous()) {
        alts.add(alt);
      }
    }
    if (alts.size() == 1) {
      return alts.get(0).toAmbiguousInjectString();
    }
    StringBuffer sb=new StringBuffer("String_Node_Str" + getNode().getFullName());
    for (    InjectionPlan<?> alt : alts) {
      sb.append("String_Node_Str" + alt.toShallowString() + "String_Node_Str");
    }
    sb.append("String_Node_Str");
    return sb.toString();
  }
}

Fixed version (ground truth):
@Override protected String toAmbiguousInjectString(){
  if (alternatives.length == 1) {
    return alternatives[0].toAmbiguousInjectString();
  }
 else   if (selectedIndex != -1) {
    return alternatives[selectedIndex].toAmbiguousInjectString();
  }
 else {
    List<InjectionPlan<?>> alts=new ArrayList<>();
    List<InjectionPlan<?>> ambig=new ArrayList<>();
    for (    InjectionPlan<?> alt : alternatives) {
      if (alt.isFeasible()) {
        alts.add(alt);
      }
      if (alt.isAmbiguous()) {
        ambig.add(alt);
      }
    }
    StringBuffer sb=new StringBuffer("String_Node_Str" + getNode().getFullName());
    for (    InjectionPlan<?> alt : alts) {
      sb.append("String_Node_Str" + alt.toShallowString() + "String_Node_Str");
    }
    for (    InjectionPlan<?> alt : ambig) {
      sb.append("String_Node_Str" + alt.toShallowString() + "String_Node_Str");
    }
    sb.append("String_Node_Str");
    return sb.toString();
  }
}