nus-yam/ex-repair huggingface dataset:
Program: 87692
Project: 87692
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean equals(final Object obj){
  if (!(obj instanceof AbstractJobResult)) {
    return false;
  }
  final AbstractJobResult ajr=(AbstractJobResult)obj;
  if (this.returnCode == null) {
    if (ajr.getReturnCode() != null) {
      return false;
    }
  }
 else {
    if (!this.returnCode.equals(ajr.getReturnCode())) {
      return false;
    }
  }
  if (this.description == null) {
    if (this.description != null) {
      return false;
    }
  }
 else {
    if (!this.description.equals(ajr.getDescription())) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean equals(final Object obj){
  if (!(obj instanceof AbstractJobResult)) {
    return false;
  }
  final AbstractJobResult ajr=(AbstractJobResult)obj;
  if (this.returnCode == null) {
    if (ajr.getReturnCode() != null) {
      return false;
    }
  }
 else {
    if (!this.returnCode.equals(ajr.getReturnCode())) {
      return false;
    }
  }
  if (this.description == null) {
  }
 else {
    if (!this.description.equals(ajr.getDescription())) {
      return false;
    }
  }
  return true;
}
Program: 87693
Project: 87693
Buggy source:
/** 
 * Returns the next code point at the current position in the buffer. The buffer's position will be incremented. Any mark set on this buffer will be changed by this method!
 */
public static int bytesToCodePoint(final ByteBuffer bytes){
  bytes.mark();
  final byte b=bytes.get();
  bytes.reset();
  final int extraBytesToRead=bytesFromUTF8[(b & 0xFF)];
  if (extraBytesToRead < 0) {
    return -1;
  }
  int ch=0;
switch (extraBytesToRead) {
case 5:
    ch+=(bytes.get() & 0xFF);
  ch<<=6;
case 4:
ch+=(bytes.get() & 0xFF);
ch<<=6;
case 3:
ch+=(bytes.get() & 0xFF);
ch<<=6;
case 2:
ch+=(bytes.get() & 0xFF);
ch<<=6;
case 1:
ch+=(bytes.get() & 0xFF);
ch<<=6;
case 0:
ch+=(bytes.get() & 0xFF);
}
ch-=offsetsFromUTF8[extraBytesToRead];
return ch;
}

Fixed version (ground truth):
/** 
 * Returns the next code point at the current position in the buffer. The buffer's position will be incremented. Any mark set on this buffer will be changed by this method!
 */
public static int bytesToCodePoint(final ByteBuffer bytes){
  bytes.mark();
  final byte b=bytes.get();
  bytes.reset();
  final int extraBytesToRead=bytesFromUTF8[(b & 0xFF)];
  if (extraBytesToRead < 0) {
    return -1;
  }
  int ch=0;
switch (extraBytesToRead) {
case 5:
    ch+=(bytes.get() & 0xFF);
  ch<<=6;
case 4:
ch+=(bytes.get() & 0xFF);
ch<<=6;
case 3:
ch+=(bytes.get() & 0xFF);
ch<<=6;
case 2:
ch+=(bytes.get() & 0xFF);
ch<<=6;
case 1:
ch+=(bytes.get() & 0xFF);
ch<<=6;
case 0:
ch+=(bytes.get() & 0xFF);
default :
break;
}
ch-=offsetsFromUTF8[extraBytesToRead];
return ch;
}
Program: 87695
Project: 87695
Buggy source:
/** 
 * Reads a hard-coded tree topology from file and creates a tree according to the hard-coded topology from the file.
 * @param nodes
 * @return
 */
private MulticastForwardingTable createHardCodedTree(LinkedList<TreeNode> nodes){
  try {
    FileInputStream fstream=new FileInputStream(this.hardcodedtreefilepath);
    DataInputStream in=new DataInputStream(fstream);
    BufferedReader br=new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine=br.readLine()) != null) {
      String[] values=strLine.split("String_Node_Str");
      String actualhostname=values[0];
      for (      TreeNode n : nodes) {
        if (n.toString().equals(actualhostname)) {
          for (int i=1; i < values.length; i++) {
            for (            TreeNode childnode : nodes) {
              if (childnode.toString().equals(values[i])) {
                n.addChild(childnode);
              }
            }
          }
        }
      }
    }
    return nodes.getFirst().createForwardingTable();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Reads a hard-coded tree topology from file and creates a tree according to the hard-coded topology from the file.
 * @param nodes
 * @return
 */
private MulticastForwardingTable createHardCodedTree(LinkedList<TreeNode> nodes){
  try {
    FileInputStream fstream=new FileInputStream(this.hardcodedtreefilepath);
    DataInputStream in=new DataInputStream(fstream);
    BufferedReader br=new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine=br.readLine()) != null) {
      String[] values=strLine.split("String_Node_Str");
      String actualhostname=values[0];
      for (      TreeNode n : nodes) {
        if (n.toString().equals(actualhostname)) {
          for (int i=1; i < values.length; i++) {
            for (            TreeNode childnode : nodes) {
              if (childnode.toString().equals(values[i])) {
                n.addChild(childnode);
              }
            }
          }
        }
      }
    }
    br.close();
    return nodes.getFirst().createForwardingTable();
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
    return null;
  }
}
Program: 87696
Project: 87696
Buggy source:
/** 
 * Auxiliary method that reads penalties for tree nodes from the given file. Expects penalties in format <HOSTNAME> <PENALTY_AS_INTEGER> and saves the penalty value in the corresponding TreeNode objects within the provided list.
 * @param f
 * @param nodes List with the nodes
 */
private void readPenalitesFromFile(File f,List<TreeNode> nodes){
  try {
    FileInputStream fstream=new FileInputStream(f);
    DataInputStream in=new DataInputStream(fstream);
    BufferedReader br=new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine=br.readLine()) != null) {
      String[] values=strLine.split("String_Node_Str");
      String actualhostname=values[0];
      int actualpenalty=Integer.valueOf(values[1]);
      for (      TreeNode n : nodes) {
        if (n.toString().equals(actualhostname)) {
          System.out.println("String_Node_Str" + n.toString() + "String_Node_Str"+ actualpenalty);
          n.setProperty("String_Node_Str",actualpenalty);
        }
      }
    }
    in.close();
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Auxiliary method that reads penalties for tree nodes from the given file. Expects penalties in format <HOSTNAME> <PENALTY_AS_INTEGER> and saves the penalty value in the corresponding TreeNode objects within the provided list.
 * @param f
 * @param nodes List with the nodes
 */
private void readPenalitesFromFile(File f,List<TreeNode> nodes){
  try {
    FileInputStream fstream=new FileInputStream(f);
    DataInputStream in=new DataInputStream(fstream);
    BufferedReader br=new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine=br.readLine()) != null) {
      String[] values=strLine.split("String_Node_Str");
      String actualhostname=values[0];
      int actualpenalty=Integer.valueOf(values[1]);
      for (      TreeNode n : nodes) {
        if (n.toString().equals(actualhostname)) {
          System.out.println("String_Node_Str" + n.toString() + "String_Node_Str"+ actualpenalty);
          n.setProperty("String_Node_Str",actualpenalty);
        }
      }
    }
    br.close();
    in.close();
    fstream.close();
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
}
Program: 87697
Project: 87697
Buggy source:
@Override public Schema create(Iterable<EvaluationExpression> keyExpressions){
  List<ObjectAccess> objectAccesses=new ArrayList<ObjectAccess>();
  List<ArrayAccess> arrayAccesses=new ArrayList<ArrayAccess>();
  List<EvaluationExpression> mappings=new ArrayList<EvaluationExpression>();
  for (  EvaluationExpression evaluationExpression : keyExpressions) {
    mappings.add(evaluationExpression);
    if (evaluationExpression instanceof ObjectAccess) {
      objectAccesses.add((ObjectAccess)evaluationExpression);
    }
    if (evaluationExpression instanceof ArrayAccess) {
      arrayAccesses.add((ArrayAccess)evaluationExpression);
    }
  }
  if (mappings.isEmpty())   return new DirectSchema();
  if (objectAccesses.size() == mappings.size()) {
    ObjectSchema schema=new ObjectSchema();
    schema.setMappingsWithAccesses(objectAccesses);
    return schema;
  }
 else   if (arrayAccesses.size() == mappings.size()) {
    int startIndex=arrayAccesses.get(0).getStartIndex();
    int endIndex=arrayAccesses.get(arrayAccesses.size()).getEndIndex();
    if (startIndex == 0) {
      HeadArraySchema schema=new HeadArraySchema();
      schema.setHeadSize(endIndex + 1);
      return schema;
    }
 else {
      TailArraySchema schema=new TailArraySchema();
      schema.setTailSize(endIndex - startIndex + 1);
      return schema;
    }
  }
 else {
    return new GeneralSchema(mappings);
  }
}

Fixed version (ground truth):
@Override public Schema create(Iterable<EvaluationExpression> keyExpressions){
  List<ObjectAccess> objectAccesses=new ArrayList<ObjectAccess>();
  List<ArrayAccess> arrayAccesses=new ArrayList<ArrayAccess>();
  List<EvaluationExpression> mappings=new ArrayList<EvaluationExpression>();
  for (  EvaluationExpression evaluationExpression : keyExpressions) {
    mappings.add(evaluationExpression);
    if (evaluationExpression instanceof ObjectAccess) {
      objectAccesses.add((ObjectAccess)evaluationExpression);
    }
    if (evaluationExpression instanceof ArrayAccess) {
      arrayAccesses.add((ArrayAccess)evaluationExpression);
    }
  }
  if (mappings.isEmpty())   return new DirectSchema();
  if (objectAccesses.size() == mappings.size()) {
    ObjectSchema schema=new ObjectSchema();
    schema.setMappingsWithAccesses(objectAccesses);
    return schema;
  }
 else   if (arrayAccesses.size() == mappings.size()) {
    int startIndex=arrayAccesses.get(0).getStartIndex();
    int endIndex=arrayAccesses.get(arrayAccesses.size() - 1).getEndIndex();
    if (startIndex == 0) {
      HeadArraySchema schema=new HeadArraySchema();
      schema.setHeadSize(endIndex + 1);
      return schema;
    }
 else {
      TailArraySchema schema=new TailArraySchema();
      schema.setTailSize(endIndex - startIndex + 1);
      return schema;
    }
  }
 else {
    return new GeneralSchema(mappings);
  }
}
Program: 87698
Project: 87698
Buggy source:
void restart(){
  changeExecutionState(ExecutionState.STARTING,null);
  this.restartRequested.set(true);
  interrupt();
  this.interruptCalled.set(true);
}

Fixed version (ground truth):
void restart(){
  changeExecutionState(ExecutionState.STARTING,null);
  this.restartRequested.set(true);
  changeExecutionState(ExecutionState.REPLAYING,null);
}
Program: 87700
Project: 87700
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  while (true) {
    changeExecutionState(ExecutionState.REPLAYING,null);
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
      return;
    }
    resetAllOutputBroker();
    try {
      replayCheckpoint();
      if (this.executionObserver.isCanceled()) {
        throw new InterruptedException();
      }
    }
 catch (    Exception e) {
      if (isRestartRequested()) {
        continue;
      }
      if (this.executionObserver.isCanceled()) {
        changeExecutionState(ExecutionState.CANCELED,null);
      }
 else {
        changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
      }
      return;
    }
    if (isRestartRequested()) {
      continue;
    }
    break;
  }
  changeExecutionState(ExecutionState.FINISHING,null);
  try {
    waitForAllOutputBrokerToFinish();
  }
 catch (  Exception e) {
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHED,null);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  changeExecutionState(ExecutionState.REPLAYING,null);
  if (this.executionObserver.isCanceled()) {
    changeExecutionState(ExecutionState.CANCELED,null);
    return;
  }
  resetAllOutputBroker();
  try {
    replayCheckpoint();
    if (this.executionObserver.isCanceled()) {
      throw new InterruptedException();
    }
  }
 catch (  Exception e) {
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHING,null);
  try {
    waitForAllOutputBrokerToFinish();
  }
 catch (  Exception e) {
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHED,null);
}
Program: 87701
Project: 87701
Buggy source:
boolean followsLog(){
  if (this.numberOfInitialLogEntries == 0) {
    return false;
  }
synchronized (this) {
    return this.announcedEnvelopesAsIntBuffer.hasRemaining();
  }
}

Fixed version (ground truth):
boolean followsLog(){
  if (this.numberOfInitialLogEntries == 0) {
    return false;
  }
synchronized (this) {
    return this.outstandingEnvelopesAsIntBuffer.hasRemaining();
  }
}
Program: 87703
Project: 87703
Buggy source:
/** 
 * Sets up Nephele in local mode.
 */
@BeforeClass public static void startNephele(){
  if (jobManagerThread == null) {
    JobManager jobManager=null;
    try {
      final String userDir=System.getProperty("String_Node_Str");
      String configDir=userDir + File.separator + CONFIGURATION_DIRECTORY;
      if (!new File(configDir).exists()) {
        configDir=userDir + "String_Node_Str" + CONFIGURATION_DIRECTORY;
      }
      final Constructor<JobManager> c=JobManager.class.getDeclaredConstructor(new Class[]{String.class,String.class});
      c.setAccessible(true);
      jobManager=c.newInstance(new Object[]{configDir,new String("String_Node_Str")});
    }
 catch (    SecurityException e) {
      fail(e.getMessage());
    }
catch (    NoSuchMethodException e) {
      fail(e.getMessage());
    }
catch (    IllegalArgumentException e) {
      fail(e.getMessage());
    }
catch (    InstantiationException e) {
      fail(e.getMessage());
    }
catch (    IllegalAccessException e) {
      fail(e.getMessage());
    }
catch (    InvocationTargetException e) {
      fail(e.getMessage());
    }
    configuration=GlobalConfiguration.getConfiguration(new String[]{ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY});
    if (jobManager != null) {
      jobManagerThread=new JobManagerThread(jobManager);
      jobManagerThread.start();
    }
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets up Nephele in local mode.
 */
@BeforeClass public static void startNephele(){
  if (jobManagerThread == null) {
    JobManager jobManager=null;
    try {
      final String userDir=System.getProperty("String_Node_Str");
      String configDir=userDir + File.separator + CONFIGURATION_DIRECTORY;
      if (!new File(configDir).exists()) {
        configDir=userDir + "String_Node_Str" + CONFIGURATION_DIRECTORY;
      }
      final Constructor<JobManager> c=JobManager.class.getDeclaredConstructor(new Class[]{String.class,String.class});
      c.setAccessible(true);
      jobManager=c.newInstance(new Object[]{configDir,new String("String_Node_Str")});
    }
 catch (    SecurityException e) {
      fail(e.getMessage());
    }
catch (    NoSuchMethodException e) {
      fail(e.getMessage());
    }
catch (    IllegalArgumentException e) {
      fail(e.getMessage());
    }
catch (    InstantiationException e) {
      fail(e.getMessage());
    }
catch (    IllegalAccessException e) {
      fail(e.getMessage());
    }
catch (    InvocationTargetException e) {
      fail(e.getMessage());
    }
    configuration=GlobalConfiguration.getConfiguration(new String[]{ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY});
    if (jobManager != null) {
      jobManagerThread=new JobManagerThread(jobManager);
      jobManagerThread.start();
    }
    try {
      ServerTestUtils.waitForJobManagerToBecomeReady(jobManager);
    }
 catch (    Exception e) {
      fail(StringUtils.stringifyException(e));
    }
  }
}
Program: 87704
Project: 87704
Buggy source:
/** 
 * Sets up Nephele in local mode.
 */
@BeforeClass public static void startNephele(){
  if (jobManagerThread == null) {
    JobManager jobManager=null;
    try {
      Constructor<JobManager> c=JobManager.class.getDeclaredConstructor(new Class[]{String.class,String.class});
      c.setAccessible(true);
      jobManager=c.newInstance(new Object[]{ServerTestUtils.getConfigDir(),new String("String_Node_Str")});
    }
 catch (    SecurityException e) {
      fail(e.getMessage());
    }
catch (    NoSuchMethodException e) {
      fail(e.getMessage());
    }
catch (    IllegalArgumentException e) {
      fail(e.getMessage());
    }
catch (    InstantiationException e) {
      fail(e.getMessage());
    }
catch (    IllegalAccessException e) {
      fail(e.getMessage());
    }
catch (    InvocationTargetException e) {
      fail(e.getMessage());
    }
    configuration=GlobalConfiguration.getConfiguration(new String[]{ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY});
    if (jobManager != null) {
      jobManagerThread=new JobManagerThread(jobManager);
      jobManagerThread.start();
    }
    try {
      Thread.sleep(10000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets up Nephele in local mode.
 */
@BeforeClass public static void startNephele(){
  if (jobManagerThread == null) {
    JobManager jobManager=null;
    try {
      Constructor<JobManager> c=JobManager.class.getDeclaredConstructor(new Class[]{String.class,String.class});
      c.setAccessible(true);
      jobManager=c.newInstance(new Object[]{ServerTestUtils.getConfigDir(),new String("String_Node_Str")});
    }
 catch (    SecurityException e) {
      fail(e.getMessage());
    }
catch (    NoSuchMethodException e) {
      fail(e.getMessage());
    }
catch (    IllegalArgumentException e) {
      fail(e.getMessage());
    }
catch (    InstantiationException e) {
      fail(e.getMessage());
    }
catch (    IllegalAccessException e) {
      fail(e.getMessage());
    }
catch (    InvocationTargetException e) {
      fail(e.getMessage());
    }
    configuration=GlobalConfiguration.getConfiguration(new String[]{ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY});
    if (jobManager != null) {
      jobManagerThread=new JobManagerThread(jobManager);
      jobManagerThread.start();
    }
    try {
      ServerTestUtils.waitForJobManagerToBecomeReady(jobManager);
    }
 catch (    Exception e) {
      fail(StringUtils.stringifyException(e));
    }
  }
}
Program: 87705
Project: 87705
Buggy source:
private boolean isRestartRequested(){
  if (this.restartRequested.compareAndSet(true,false)) {
    if (!this.interruptCalled.compareAndSet(true,false)) {
      while (!Thread.currentThread().isInterrupted()) {
      }
      this.interruptCalled.set(false);
    }
    Thread.interrupted();
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean isRestartRequested(){
  if (this.restartRequested.compareAndSet(true,false)) {
    if (!this.interruptCalled.compareAndSet(true,false)) {
      try {
        Thread.sleep(10L);
      }
 catch (      InterruptedException e) {
      }
      this.interruptCalled.set(false);
    }
    Thread.interrupted();
    return true;
  }
  return false;
}
Program: 87707
Project: 87707
Buggy source:
/** 
 * Private constructor used to duplicate execution vertices.
 * @param vertexID the ID of the new execution vertex.
 * @param invokableClass the task that is assigned to this execution vertex
 * @param executionGraph the execution graph the new vertex belongs to
 * @param groupVertex the group vertex the new vertex belongs to
 * @param environment the environment for the newly created vertex
 */
private ExecutionVertex(final ExecutionVertexID vertexID,final Class<? extends AbstractInvokable> invokableClass,final ExecutionGraph executionGraph,final ExecutionGroupVertex groupVertex,final RuntimeEnvironment environment){
  this.vertexID=vertexID;
  this.invokableClass=invokableClass;
  this.executionGraph=executionGraph;
  this.groupVertex=groupVertex;
  this.environment=environment;
  this.checkpointState=new AtomicEnum<CheckpointState>(groupVertex.getInitialCheckpointState());
  this.retriesLeft=new AtomicInteger(groupVertex.getNumberOfExecutionRetries());
  registerExecutionListener(this.executionGraph);
}

Fixed version (ground truth):
/** 
 * Private constructor used to duplicate execution vertices.
 * @param vertexID the ID of the new execution vertex.
 * @param invokableClass the task that is assigned to this execution vertex
 * @param executionGraph the execution graph the new vertex belongs to
 * @param groupVertex the group vertex the new vertex belongs to
 * @param environment the environment for the newly created vertex
 */
private ExecutionVertex(final ExecutionVertexID vertexID,final Class<? extends AbstractInvokable> invokableClass,final ExecutionGraph executionGraph,final ExecutionGroupVertex groupVertex,final RuntimeEnvironment environment){
  this.vertexID=vertexID;
  this.invokableClass=invokableClass;
  this.executionGraph=executionGraph;
  this.groupVertex=groupVertex;
  this.environment=environment;
  this.retriesLeft=new AtomicInteger(groupVertex.getNumberOfExecutionRetries());
  registerExecutionListener(this.executionGraph);
}
Program: 87708
Project: 87708
Buggy source:
/** 
 * Returns a duplicate of this execution vertex.
 * @param preserveVertexID <code>true</code> to copy the vertex's ID to the duplicated vertex, <code>false</code> to create a new ID
 * @return a duplicate of this execution vertex
 * @throws Exception any exception that might be thrown by the user code during instantiation and registration of input and output channels
 */
public ExecutionVertex duplicateVertex(final boolean preserveVertexID) throws Exception {
  ExecutionVertexID newVertexID;
  if (preserveVertexID) {
    newVertexID=this.vertexID;
  }
 else {
    newVertexID=new ExecutionVertexID();
  }
  final RuntimeEnvironment duplicatedEnvironment=this.environment.duplicateEnvironment();
  final ExecutionVertex duplicatedVertex=new ExecutionVertex(newVertexID,this.invokableClass,this.executionGraph,this.groupVertex,duplicatedEnvironment);
  duplicatedVertex.setAllocatedResource(this.allocatedResource);
  return duplicatedVertex;
}

Fixed version (ground truth):
/** 
 * Returns a duplicate of this execution vertex.
 * @param preserveVertexID <code>true</code> to copy the vertex's ID to the duplicated vertex, <code>false</code> to create a new ID
 * @return a duplicate of this execution vertex
 * @throws Exception any exception that might be thrown by the user code during instantiation and registration of input and output channels
 */
public ExecutionVertex duplicateVertex(final boolean preserveVertexID) throws Exception {
  ExecutionVertexID newVertexID;
  if (preserveVertexID) {
    newVertexID=this.vertexID;
  }
 else {
    newVertexID=new ExecutionVertexID();
  }
  final RuntimeEnvironment duplicatedEnvironment=this.environment.duplicateEnvironment();
  final ExecutionVertex duplicatedVertex=new ExecutionVertex(newVertexID,this.invokableClass,this.executionGraph,this.groupVertex,duplicatedEnvironment);
  duplicatedVertex.checkpointState.set(this.checkpointState.get());
  duplicatedVertex.setAllocatedResource(this.allocatedResource);
  return duplicatedVertex;
}
Program: 87709
Project: 87709
Buggy source:
void restart(){
  this.restartRequested.set(true);
}

Fixed version (ground truth):
void restart(){
  changeExecutionState(ExecutionState.STARTING,null);
  this.restartRequested.set(true);
  interrupt();
}
Program: 87711
Project: 87711
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  changeExecutionState(ExecutionState.REPLAYING,null);
  if (this.executionObserver.isCanceled()) {
    changeExecutionState(ExecutionState.CANCELED,null);
    return;
  }
  try {
    replayCheckpoint();
    if (this.executionObserver.isCanceled()) {
      throw new InterruptedException();
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHING,null);
  try {
    waitForAllOutputBrokerToFinish();
  }
 catch (  Exception e) {
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHED,null);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  while (true) {
    changeExecutionState(ExecutionState.REPLAYING,null);
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
      return;
    }
    resetAllOutputBroker();
    try {
      replayCheckpoint();
      if (this.executionObserver.isCanceled()) {
        throw new InterruptedException();
      }
    }
 catch (    Exception e) {
      if (this.restartRequested.compareAndSet(true,false)) {
        while (!Thread.currentThread().isInterrupted()) {
        }
        Thread.interrupted();
        continue;
      }
      if (this.executionObserver.isCanceled()) {
        changeExecutionState(ExecutionState.CANCELED,null);
      }
 else {
        changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
      }
      return;
    }
    if (this.restartRequested.compareAndSet(true,false)) {
      while (!Thread.currentThread().isInterrupted()) {
      }
      Thread.interrupted();
      continue;
    }
    break;
  }
  changeExecutionState(ExecutionState.FINISHING,null);
  try {
    waitForAllOutputBrokerToFinish();
  }
 catch (  Exception e) {
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHED,null);
}
Program: 87713
Project: 87713
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void logQueuedEnvelopes(){
  this.encapsulatedContext.logQueuedEnvelopes();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void logQueuedEnvelopes(){
  if (this.encapsulatedContext != null) {
    this.encapsulatedContext.logQueuedEnvelopes();
  }
}
Program: 87714
Project: 87714
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void processEvent(final AbstractEvent event){
  if (event instanceof ByteBufferedChannelCloseEvent) {
    LOG.info("String_Node_Str");
  }
 else   if (event instanceof UnexpectedEnvelopeEvent) {
    final UnexpectedEnvelopeEvent uee=(UnexpectedEnvelopeEvent)event;
    if (uee.getExpectedSequenceNumber() > this.nextEnvelopeToSend) {
      this.nextEnvelopeToSend=uee.getExpectedSequenceNumber();
    }
  }
 else {
    LOG.warn("String_Node_Str" + event);
  }
  getNext().processEvent(event);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void processEvent(final AbstractEvent event){
  if (event instanceof ByteBufferedChannelCloseEvent) {
    LOG.info("String_Node_Str");
  }
 else   if (event instanceof UnexpectedEnvelopeEvent) {
    final UnexpectedEnvelopeEvent uee=(UnexpectedEnvelopeEvent)event;
    if (uee.getExpectedSequenceNumber() > this.nextEnvelopeToSend) {
      this.nextEnvelopeToSend=uee.getExpectedSequenceNumber();
    }
  }
 else   if (event instanceof ReceiverNotFoundEvent) {
    final ReceiverNotFoundEvent rnfe=(ReceiverNotFoundEvent)event;
    LOG.warn("String_Node_Str" + rnfe.getReceiverID() + "String_Node_Str"+ rnfe.getSequenceNumber());
  }
 else {
    LOG.warn("String_Node_Str" + event);
  }
  getNext().processEvent(event);
}
Program: 87716
Project: 87716
Buggy source:
/** 
 * Updates the vertex's current execution state.
 * @param newExecutionState the new execution state
 * @param optionalMessage an optional message related to the state change
 */
public ExecutionState updateExecutionState(ExecutionState newExecutionState,final String optionalMessage){
  if (newExecutionState == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (this.executionState.get() == ExecutionState.CANCELING && newExecutionState == ExecutionState.FINISHED) {
    LOG.info("String_Node_Str" + toString() + "String_Node_Str");
    newExecutionState=ExecutionState.CANCELED;
  }
  final ExecutionState previousState=this.executionState.getAndSet(newExecutionState);
  if (previousState == newExecutionState) {
    return previousState;
  }
  ExecutionStateTransition.checkTransition(true,toString(),previousState,newExecutionState);
  final Iterator<ExecutionListener> it=this.executionListeners.values().iterator();
  while (it.hasNext()) {
    it.next().executionStateChanged(this.executionGraph.getJobID(),this.vertexID,newExecutionState,optionalMessage);
  }
  return previousState;
}

Fixed version (ground truth):
/** 
 * Updates the vertex's current execution state.
 * @param newExecutionState the new execution state
 * @param optionalMessage an optional message related to the state change
 */
public ExecutionState updateExecutionState(ExecutionState newExecutionState,final String optionalMessage){
  if (newExecutionState == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final ExecutionState currentExecutionState=this.executionState.get();
  if (currentExecutionState == ExecutionState.CANCELING) {
    if (newExecutionState == ExecutionState.FINISHING) {
      return currentExecutionState;
    }
    if (newExecutionState == ExecutionState.FINISHED) {
      LOG.info("String_Node_Str" + toString() + "String_Node_Str");
      newExecutionState=ExecutionState.CANCELED;
    }
  }
  final ExecutionState previousState=this.executionState.getAndSet(newExecutionState);
  if (previousState == newExecutionState) {
    return previousState;
  }
  ExecutionStateTransition.checkTransition(true,toString(),previousState,newExecutionState);
  final Iterator<ExecutionListener> it=this.executionListeners.values().iterator();
  while (it.hasNext()) {
    it.next().executionStateChanged(this.executionGraph.getJobID(),this.vertexID,newExecutionState,optionalMessage);
  }
  return previousState;
}
Program: 87718
Project: 87718
Buggy source:
public void executionStateChanged(final JobID jobID,final ExecutionVertexID id,final ExecutionState newExecutionState,final String optionalDescription){
  if (newExecutionState == ExecutionState.FINISHED || newExecutionState == ExecutionState.CANCELED || newExecutionState == ExecutionState.FAILED) {
    unregisterTask(id);
  }
synchronized (this.jobManager) {
    try {
      this.jobManager.updateTaskExecutionState(new TaskExecutionState(jobID,id,newExecutionState,optionalDescription));
    }
 catch (    IOException e) {
      LOG.error(StringUtils.stringifyException(e));
    }
  }
}

Fixed version (ground truth):
public void executionStateChanged(final JobID jobID,final ExecutionVertexID id,final ExecutionState newExecutionState,final String optionalDescription){
  if (newExecutionState == ExecutionState.CANCELING) {
    return;
  }
  if (newExecutionState == ExecutionState.FINISHED || newExecutionState == ExecutionState.CANCELED || newExecutionState == ExecutionState.FAILED) {
    unregisterTask(id);
  }
synchronized (this.jobManager) {
    try {
      this.jobManager.updateTaskExecutionState(new TaskExecutionState(jobID,id,newExecutionState,optionalDescription));
    }
 catch (    IOException e) {
      LOG.error(StringUtils.stringifyException(e));
    }
  }
}
Program: 87719
Project: 87719
Buggy source:
void restart(){
  changeExecutionState(ExecutionState.STARTING,null);
  this.restartRequested.set(true);
  interrupt();
}

Fixed version (ground truth):
void restart(){
  changeExecutionState(ExecutionState.STARTING,null);
  this.restartRequested.set(true);
  interrupt();
  this.interruptCalled.set(true);
}
Program: 87720
Project: 87720
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  while (true) {
    changeExecutionState(ExecutionState.REPLAYING,null);
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
      return;
    }
    resetAllOutputBroker();
    try {
      replayCheckpoint();
      if (this.executionObserver.isCanceled()) {
        throw new InterruptedException();
      }
    }
 catch (    Exception e) {
      if (this.restartRequested.compareAndSet(true,false)) {
        while (!Thread.currentThread().isInterrupted()) {
        }
        Thread.interrupted();
        continue;
      }
      if (this.executionObserver.isCanceled()) {
        changeExecutionState(ExecutionState.CANCELED,null);
      }
 else {
        changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
      }
      return;
    }
    if (this.restartRequested.compareAndSet(true,false)) {
      while (!Thread.currentThread().isInterrupted()) {
      }
      Thread.interrupted();
      continue;
    }
    break;
  }
  changeExecutionState(ExecutionState.FINISHING,null);
  try {
    waitForAllOutputBrokerToFinish();
  }
 catch (  Exception e) {
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHED,null);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void run(){
  while (true) {
    changeExecutionState(ExecutionState.REPLAYING,null);
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
      return;
    }
    resetAllOutputBroker();
    try {
      replayCheckpoint();
      if (this.executionObserver.isCanceled()) {
        throw new InterruptedException();
      }
    }
 catch (    Exception e) {
      if (isRestartRequested()) {
        continue;
      }
      if (this.executionObserver.isCanceled()) {
        changeExecutionState(ExecutionState.CANCELED,null);
      }
 else {
        changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
      }
      return;
    }
    if (isRestartRequested()) {
      continue;
    }
    break;
  }
  changeExecutionState(ExecutionState.FINISHING,null);
  try {
    waitForAllOutputBrokerToFinish();
  }
 catch (  Exception e) {
    if (this.executionObserver.isCanceled()) {
      changeExecutionState(ExecutionState.CANCELED,null);
    }
 else {
      changeExecutionState(ExecutionState.FAILED,StringUtils.stringifyException(e));
    }
    return;
  }
  changeExecutionState(ExecutionState.FINISHED,null);
}
Program: 87723
Project: 87723
Buggy source:
/** 
 * Sets up Nephele in local mode.
 */
@BeforeClass public static void startNephele(){
  if (jobManagerThread == null) {
    JobManager jobManager=null;
    try {
      Constructor<JobManager> c=JobManager.class.getDeclaredConstructor(new Class[]{String.class,String.class});
      c.setAccessible(true);
      jobManager=c.newInstance(new Object[]{ServerTestUtils.getConfigDir(),new String("String_Node_Str")});
    }
 catch (    SecurityException e) {
      fail(e.getMessage());
    }
catch (    NoSuchMethodException e) {
      fail(e.getMessage());
    }
catch (    IllegalArgumentException e) {
      fail(e.getMessage());
    }
catch (    InstantiationException e) {
      fail(e.getMessage());
    }
catch (    IllegalAccessException e) {
      fail(e.getMessage());
    }
catch (    InvocationTargetException e) {
      fail(e.getMessage());
    }
    configuration=GlobalConfiguration.getConfiguration(new String[]{ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY});
    if (jobManager != null) {
      jobManagerThread=new JobManagerThread(jobManager);
      jobManagerThread.start();
    }
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets up Nephele in local mode.
 */
@BeforeClass public static void startNephele(){
  if (jobManagerThread == null) {
    JobManager jobManager=null;
    try {
      Constructor<JobManager> c=JobManager.class.getDeclaredConstructor(new Class[]{String.class,String.class});
      c.setAccessible(true);
      jobManager=c.newInstance(new Object[]{ServerTestUtils.getConfigDir(),new String("String_Node_Str")});
    }
 catch (    SecurityException e) {
      fail(e.getMessage());
    }
catch (    NoSuchMethodException e) {
      fail(e.getMessage());
    }
catch (    IllegalArgumentException e) {
      fail(e.getMessage());
    }
catch (    InstantiationException e) {
      fail(e.getMessage());
    }
catch (    IllegalAccessException e) {
      fail(e.getMessage());
    }
catch (    InvocationTargetException e) {
      fail(e.getMessage());
    }
    configuration=GlobalConfiguration.getConfiguration(new String[]{ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY});
    if (jobManager != null) {
      jobManagerThread=new JobManagerThread(jobManager);
      jobManagerThread.start();
    }
    try {
      Thread.sleep(10000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}
Program: 87725
Project: 87725
Buggy source:
/** 
 * Cancels or kills the task.
 * @param cancel <code>true/code> if the task shall be canceled, <code>false</code> if it shall be killed
 */
private void cancelOrKillExecution(final boolean cancel){
  final Thread executingThread=this.environment.getExecutingThread();
  if (executingThread == null) {
    return;
  }
  if (this.executionState != ExecutionState.RUNNING && this.executionState != ExecutionState.REPLAYING && this.executionState != ExecutionState.FINISHING) {
    return;
  }
  LOG.info((cancel ? "String_Node_Str" : "String_Node_Str") + this.environment.getTaskNameWithIndex());
  if (cancel) {
    this.isCanceled=true;
    executionStateChanged(ExecutionState.CANCELING,null);
  }
  try {
    final AbstractInvokable invokable=this.environment.getInvokable();
    if (invokable != null) {
      invokable.cancel();
    }
  }
 catch (  Throwable e) {
    LOG.error(StringUtils.stringifyException(e));
  }
  while (true) {
    executingThread.interrupt();
    if (!executingThread.isAlive()) {
      break;
    }
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      break;
    }
    LOG.info((cancel == true ? "String_Node_Str" : "String_Node_Str") + this.environment.getTaskName() + "String_Node_Str"+ this.executionState);
  }
}

Fixed version (ground truth):
/** 
 * Cancels or kills the task.
 * @param cancel <code>true/code> if the task shall be canceled, <code>false</code> if it shall be killed
 */
private void cancelOrKillExecution(final boolean cancel){
  final Thread executingThread=this.environment.getExecutingThread();
  if (executingThread == null) {
    return;
  }
  if (this.executionState != ExecutionState.RUNNING && this.executionState != ExecutionState.REPLAYING && this.executionState != ExecutionState.FINISHING) {
    return;
  }
  LOG.info((cancel ? "String_Node_Str" : "String_Node_Str") + this.environment.getTaskNameWithIndex());
  if (cancel) {
    this.isCanceled=true;
    executionStateChanged(ExecutionState.CANCELING,null);
    try {
      final AbstractInvokable invokable=this.environment.getInvokable();
      if (invokable != null) {
        invokable.cancel();
      }
    }
 catch (    Throwable e) {
      LOG.error(StringUtils.stringifyException(e));
    }
  }
  while (true) {
    executingThread.interrupt();
    if (!executingThread.isAlive()) {
      break;
    }
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      break;
    }
    LOG.info((cancel == true ? "String_Node_Str" : "String_Node_Str") + this.environment.getTaskName() + "String_Node_Str"+ this.executionState);
  }
}
Program: 87726
Project: 87726
Buggy source:
/** 
 * Constructs a new ephemeral checkpoint.
 * @param task the task this checkpoint belongs to
 * @param ephemeral <code>true</code> if the checkpoint is initially ephemeral, <code>false</code> if the checkpoint shall be persistent from the beginning
 */
public EphemeralCheckpoint(final RuntimeTask task,final boolean ephemeral){
  this.task=task;
  int nooc=0;
  final RuntimeEnvironment environment=task.getRuntimeEnvironment();
  for (int i=0; i < environment.getNumberOfOutputGates(); ++i) {
    nooc+=environment.getOutputGate(i).getNumberOfOutputChannels();
  }
  this.numberOfConnectedChannels=nooc;
  this.checkpointingDecision=(ephemeral ? CheckpointingDecisionState.UNDECIDED : CheckpointingDecisionState.CHECKPOINTING);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + task.getVertexID() + "String_Node_Str"+ this.checkpointingDecision);
  }
  if (this.checkpointingDecision == CheckpointingDecisionState.CHECKPOINTING) {
    this.task.checkpointStateChanged(CheckpointState.PARTIAL);
    this.writeThread=new WriteThread(FileBufferManager.getInstance(),this.task.getVertexID(),this.numberOfConnectedChannels);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a new ephemeral checkpoint.
 * @param task the task this checkpoint belongs to
 * @param ephemeral <code>true</code> if the checkpoint is initially ephemeral, <code>false</code> if the checkpoint shall be persistent from the beginning
 */
public EphemeralCheckpoint(final RuntimeTask task,final boolean ephemeral){
  this.task=task;
  int nooc=0;
  final RuntimeEnvironment environment=task.getRuntimeEnvironment();
  for (int i=0; i < environment.getNumberOfOutputGates(); ++i) {
    nooc+=environment.getOutputGate(i).getNumberOfOutputChannels();
  }
  this.numberOfConnectedChannels=nooc;
  this.checkpointingDecision=(ephemeral ? CheckpointingDecisionState.UNDECIDED : CheckpointingDecisionState.CHECKPOINTING);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + task.getVertexID() + "String_Node_Str"+ this.checkpointingDecision);
  }
  if (this.checkpointingDecision == CheckpointingDecisionState.CHECKPOINTING) {
    this.task.checkpointStateChanged(CheckpointState.PARTIAL);
    this.writeThread=new WriteThread(FileBufferManager.getInstance(),this.task.getVertexID(),this.numberOfConnectedChannels);
    this.writeThread.start();
  }
}
Program: 87727
Project: 87727
Buggy source:
public EphemeralCheckpointForwarder(final EphemeralCheckpoint ephemeralCheckpoint,final AbstractOutputChannelForwarder next){
  super(next);
  if (next == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.ephemeralCheckpoint=ephemeralCheckpoint;
}

Fixed version (ground truth):
public EphemeralCheckpointForwarder(final EphemeralCheckpoint ephemeralCheckpoint,final AbstractOutputChannelForwarder next){
  super(next);
  this.ephemeralCheckpoint=ephemeralCheckpoint;
}
Program: 87728
Project: 87728
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public boolean hasDataLeft() throws IOException, InterruptedException {
  if (this.ephemeralCheckpoint.hasDataLeft()) {
    return true;
  }
  return getNext().hasDataLeft();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public boolean hasDataLeft() throws IOException, InterruptedException {
  if (this.ephemeralCheckpoint.hasDataLeft()) {
    return true;
  }
  final AbstractOutputChannelForwarder next=getNext();
  if (next != null) {
    return getNext().hasDataLeft();
  }
  return false;
}
Program: 87729
Project: 87729
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void push(final TransferEnvelope transferEnvelope) throws IOException, InterruptedException {
  this.ephemeralCheckpoint.forward(transferEnvelope);
  getNext().push(transferEnvelope);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void push(final TransferEnvelope transferEnvelope) throws IOException, InterruptedException {
  this.ephemeralCheckpoint.forward(transferEnvelope);
  final AbstractOutputChannelForwarder next=getNext();
  if (next != null) {
    next.push(transferEnvelope);
  }
 else {
    recycleTransferEnvelope(transferEnvelope);
  }
}
Program: 87730
Project: 87730
Buggy source:
/** 
 * Constructs a new replay input channel context.
 * @param encapsulatedContext the encapsulated input channel context
 */
ReplayInputChannelContext(final InputChannelContext encapsulatedContext){
  this.encapsulatedContext=encapsulatedContext;
}

Fixed version (ground truth):
/** 
 * Constructs a new replay input channel context.
 * @param channelID the ID of the input channel this context belongs to
 * @param encapsulatedContext the encapsulated input channel context
 */
ReplayInputChannelContext(final ChannelID channelID,final InputChannelContext encapsulatedContext){
  this.channelID=channelID;
  this.encapsulatedContext=encapsulatedContext;
}
Program: 87731
Project: 87731
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public ChannelID getChannelID(){
  return this.encapsulatedContext.getChannelID();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public ChannelID getChannelID(){
  return this.channelID;
}
Program: 87732
Project: 87732
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void destroy(){
  this.encapsulatedContext.destroy();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void destroy(){
  if (this.encapsulatedContext != null) {
    this.encapsulatedContext.destroy();
  }
}
Program: 87733
Project: 87733
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public InputChannelContext createInputChannelContext(ChannelID channelID,InputChannelContext previousContext){
  return new ReplayInputChannelContext(previousContext);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public InputChannelContext createInputChannelContext(final ChannelID channelID,final InputChannelContext previousContext){
  return new ReplayInputChannelContext(channelID,previousContext);
}