nus-yam/ex-repair huggingface dataset:
Program: 154797
Project: 154797
Buggy source:
public synchronized void applyTransactionWithoutTxId(ReadableByteChannel byteChannel,long nextTxId,int masterId) throws IOException {
  if (nextTxId != (xaTf.getLastCommittedTx() + 1)) {
    throw new IllegalStateException("String_Node_Str" + nextTxId + "String_Node_Str"+ (xaTf.getCurrentVersion() + 1));
  }
  log.fine("String_Node_Str" + logVersion + "String_Node_Str"+ nextTxId+ "String_Node_Str");
  long logEntriesFound=0;
  scanIsComplete=false;
  LogApplier logApplier=new LogApplier(byteChannel);
  int xidIdent=getNextIdentifier();
  while (logApplier.readAndWriteAndApplyEntry(xidIdent)) {
    logEntriesFound++;
  }
  byteChannel.close();
  LogEntry.Start entry=logApplier.startEntry;
  if (entry == null) {
    throw new IOException("String_Node_Str");
  }
  LogEntry.OnePhaseCommit commit=new LogEntry.OnePhaseCommit(xidIdent,nextTxId,masterId);
  LogIoUtils.writeLogEntry(commit,writeBuffer);
  Xid xid=entry.getXid();
  try {
    XaTransaction xaTx=xaRm.getXaTransaction(xid);
    xaTx.setCommitTxId(nextTxId);
    xaRm.commit(xid,true);
    LogEntry doneEntry=new LogEntry.Done(entry.getIdentifier());
    LogIoUtils.writeLogEntry(doneEntry,writeBuffer);
  }
 catch (  XAException e) {
    e.printStackTrace();
    throw new IOException(e.getMessage());
  }
  scanIsComplete=true;
  log.info("String_Node_Str" + nextTxId + "String_Node_Str"+ "String_Node_Str");
  msgLog.logMessage("String_Node_Str" + nextTxId);
}

Fixed version (ground truth):
public synchronized void applyTransactionWithoutTxId(ReadableByteChannel byteChannel,long nextTxId,int masterId) throws IOException {
  if (nextTxId != (xaTf.getLastCommittedTx() + 1)) {
    throw new IllegalStateException("String_Node_Str" + nextTxId + "String_Node_Str"+ (xaTf.getCurrentVersion() + 1));
  }
  log.fine("String_Node_Str" + logVersion + "String_Node_Str"+ nextTxId+ "String_Node_Str");
  long logEntriesFound=0;
  scanIsComplete=false;
  LogApplier logApplier=new LogApplier(byteChannel);
  int xidIdent=getNextIdentifier();
  while (logApplier.readAndWriteAndApplyEntry(xidIdent)) {
    logEntriesFound++;
  }
  byteChannel.close();
  LogEntry.Start entry=logApplier.startEntry;
  if (entry == null) {
    throw new IOException("String_Node_Str");
  }
  LogEntry.OnePhaseCommit commit=new LogEntry.OnePhaseCommit(xidIdent,nextTxId,masterId);
  LogIoUtils.writeLogEntry(commit,writeBuffer);
  Xid xid=entry.getXid();
  try {
    XaTransaction xaTx=xaRm.getXaTransaction(xid);
    xaTx.setCommitTxId(nextTxId);
    xaRm.commit(xid,true);
    LogEntry doneEntry=new LogEntry.Done(entry.getIdentifier());
    LogIoUtils.writeLogEntry(doneEntry,writeBuffer);
    xidIdentMap.remove(entry.getIdentifier());
    recoveredTxMap.remove(entry.getIdentifier());
  }
 catch (  XAException e) {
    e.printStackTrace();
    throw new IOException(e.getMessage());
  }
  scanIsComplete=true;
  msgLog.logMessage("String_Node_Str" + nextTxId);
}
Program: 154798
Project: 154798
Buggy source:
public synchronized long applyPreparedTransaction(ReadableByteChannel transaction) throws IOException {
  long txId=TxIdGenerator.DEFAULT.generate(dataSource,0);
  int masterId=TxIdGenerator.DEFAULT.getCurrentMasterId();
  log.applyTransactionWithoutTxId(transaction,txId,masterId);
  return txId;
}

Fixed version (ground truth):
public synchronized long applyPreparedTransaction(ReadableByteChannel transaction) throws IOException {
  long txId=TxIdGenerator.DEFAULT.generate(dataSource,0);
  int masterId=txIdGenerator.getCurrentMasterId();
  log.applyTransactionWithoutTxId(transaction,txId,masterId);
  return txId;
}
Program: 154799
Project: 154799
Buggy source:
public void process(WatchedEvent event){
  String path=event.getPath();
  System.out.println(this + "String_Node_Str" + new Date()+ "String_Node_Str"+ event+ "String_Node_Str"+ path+ "String_Node_Str");
  if (path == null && event.getState() == Watcher.Event.KeeperState.Expired) {
    keeperState=KeeperState.Expired;
    zooKeeper=instantiateZooKeeper();
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.SyncConnected) {
    sequenceNr=setup();
    keeperState=KeeperState.SyncConnected;
    if (firstSyncConnected) {
      firstSyncConnected=false;
    }
 else {
      receiver.somethingIsWrong(new Exception());
    }
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.Disconnected) {
    keeperState=KeeperState.Disconnected;
  }
 else   if (event.getType() == Watcher.Event.EventType.NodeDataChanged) {
    System.out.println("String_Node_Str");
    if (broker.getCachedMasterMachineId() == getMasterNotifyId()) {
      System.out.println("String_Node_Str");
      return;
    }
    receiver.somethingIsWrong(new Exception());
  }
}

Fixed version (ground truth):
public void process(WatchedEvent event){
  String path=event.getPath();
  System.out.println(this + "String_Node_Str" + new Date()+ "String_Node_Str"+ event+ "String_Node_Str"+ path+ "String_Node_Str");
  if (path == null && event.getState() == Watcher.Event.KeeperState.Expired) {
    keeperState=KeeperState.Expired;
    zooKeeper=instantiateZooKeeper();
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.SyncConnected) {
    sequenceNr=setup();
    keeperState=KeeperState.SyncConnected;
    if (firstSyncConnected) {
      firstSyncConnected=false;
    }
 else {
      receiver.somethingIsWrong(new Exception());
    }
  }
 else   if (path == null && event.getState() == Watcher.Event.KeeperState.Disconnected) {
    keeperState=KeeperState.Disconnected;
  }
 else   if (event.getType() == Watcher.Event.EventType.NodeDataChanged) {
    System.out.println("String_Node_Str");
    if (broker.getMasterMachineId() == getMasterNotifyId()) {
      System.out.println("String_Node_Str");
      return;
    }
    receiver.somethingIsWrong(new Exception());
  }
}
Program: 154800
Project: 154800
Buggy source:
IllBehavingXaDataSource() throws InstantiationException {
  super(new HashMap<Object,Object>());
}

Fixed version (ground truth):
IllBehavingXaDataSource() throws InstantiationException {
  super(MapUtil.stringMap("String_Node_Str","String_Node_Str"));
}
Program: 154801
Project: 154801
Buggy source:
@Before public void setUpFramework(){
  getTransaction().finish();
  TxModule txModule=getEmbeddedGraphDb().getConfig().getTxModule();
  tm=txModule.getTxManager();
  xaDsMgr=txModule.getXaDataSourceManager();
  java.util.Map<String,FakeXAResource> map1=new java.util.HashMap<String,FakeXAResource>();
  map1.put("String_Node_Str",new FakeXAResource("String_Node_Str"));
  java.util.Map<String,FakeXAResource> map2=new java.util.HashMap<String,FakeXAResource>();
  map2.put("String_Node_Str",new FakeXAResource("String_Node_Str"));
  try {
    xaDsMgr.registerDataSource("String_Node_Str",new DummyXaDataSource(map1),"String_Node_Str".getBytes());
    xaDsMgr.registerDataSource("String_Node_Str",new DummyXaDataSource(map2),"String_Node_Str".getBytes());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  try {
    tm.commit();
  }
 catch (  Exception e) {
  }
  Transaction tx=null;
  try {
    tx=tm.getTransaction();
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str");
  }
  if (tx != null) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Before public void setUpFramework(){
  getTransaction().finish();
  TxModule txModule=getEmbeddedGraphDb().getConfig().getTxModule();
  tm=txModule.getTxManager();
  xaDsMgr=txModule.getXaDataSourceManager();
  java.util.Map<String,Object> map1=new java.util.HashMap<String,Object>();
  map1.put("String_Node_Str",new FakeXAResource("String_Node_Str"));
  map1.put("String_Node_Str","String_Node_Str");
  java.util.Map<String,Object> map2=new java.util.HashMap<String,Object>();
  map2.put("String_Node_Str",new FakeXAResource("String_Node_Str"));
  map2.put("String_Node_Str","String_Node_Str");
  try {
    xaDsMgr.registerDataSource("String_Node_Str",new DummyXaDataSource(map1),"String_Node_Str".getBytes());
    xaDsMgr.registerDataSource("String_Node_Str",new DummyXaDataSource(map2),"String_Node_Str".getBytes());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  try {
    tm.commit();
  }
 catch (  Exception e) {
  }
  Transaction tx=null;
  try {
    tx=tm.getTransaction();
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str");
  }
  if (tx != null) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 154802
Project: 154802
Buggy source:
@Test public void testTxIdGeneration() throws Exception {
  DummyXaDataSource xaDs1=null;
  DummyXaConnection xaC1=null;
  try {
    xaDsMgr.registerDataSource("String_Node_Str",new DummyXaDataSource(new java.util.HashMap<Object,Object>()),"String_Node_Str".getBytes());
    xaDs1=(DummyXaDataSource)xaDsMgr.getXaDataSource("String_Node_Str");
    xaC1=(DummyXaConnection)xaDs1.getXaConnection();
    tm.begin();
    xaC1.enlistWithTx();
    int currentTxId=xaC1.getTransactionId();
    xaC1.doStuff1();
    xaC1.delistFromTx();
    tm.commit();
    tm.begin();
    Node node=getGraphDb().createNode();
    xaC1.enlistWithTx();
    assertEquals(++currentTxId,xaC1.getTransactionId());
    xaC1.doStuff1();
    xaC1.delistFromTx();
    tm.commit();
    tm.begin();
    node=getGraphDb().getNodeById((int)node.getId());
    xaC1.enlistWithTx();
    assertEquals(++currentTxId,xaC1.getTransactionId());
    xaC1.doStuff2();
    xaC1.delistFromTx();
    node.delete();
    tm.commit();
  }
  finally {
    xaDsMgr.unregisterDataSource("String_Node_Str");
    if (xaC1 != null) {
      xaC1.destroy();
    }
  }
  File dir=new File("String_Node_Str");
  File files[]=dir.listFiles(new FilenameFilter(){
    public boolean accept(    File dir,    String fileName){
      return fileName.startsWith(resourceFile());
    }
  }
);
  for (int i=0; i < files.length; i++) {
    files[i].delete();
  }
}

Fixed version (ground truth):
@Test public void testTxIdGeneration() throws Exception {
  DummyXaDataSource xaDs1=null;
  DummyXaConnection xaC1=null;
  try {
    Map<Object,Object> config=new HashMap<Object,Object>();
    config.put("String_Node_Str","String_Node_Str");
    xaDsMgr.registerDataSource("String_Node_Str",new DummyXaDataSource(config),"String_Node_Str".getBytes());
    xaDs1=(DummyXaDataSource)xaDsMgr.getXaDataSource("String_Node_Str");
    xaC1=(DummyXaConnection)xaDs1.getXaConnection();
    tm.begin();
    xaC1.enlistWithTx();
    int currentTxId=xaC1.getTransactionId();
    xaC1.doStuff1();
    xaC1.delistFromTx();
    tm.commit();
    tm.begin();
    Node node=getGraphDb().createNode();
    xaC1.enlistWithTx();
    assertEquals(++currentTxId,xaC1.getTransactionId());
    xaC1.doStuff1();
    xaC1.delistFromTx();
    tm.commit();
    tm.begin();
    node=getGraphDb().getNodeById((int)node.getId());
    xaC1.enlistWithTx();
    assertEquals(++currentTxId,xaC1.getTransactionId());
    xaC1.doStuff2();
    xaC1.delistFromTx();
    node.delete();
    tm.commit();
  }
  finally {
    xaDsMgr.unregisterDataSource("String_Node_Str");
    if (xaC1 != null) {
      xaC1.destroy();
    }
  }
  File dir=new File("String_Node_Str");
  File files[]=dir.listFiles(new FilenameFilter(){
    public boolean accept(    File dir,    String fileName){
      return fileName.startsWith(resourceFile());
    }
  }
);
  for (int i=0; i < files.length; i++) {
    files[i].delete();
  }
}
Program: 154803
Project: 154803
Buggy source:
@Test public void testCreateXaResource() throws Exception {
  xaDsMgr.registerDataSource("String_Node_Str",new DummyXaDataSource(new java.util.HashMap<Object,Object>()),"String_Node_Str".getBytes());
  XaDataSource xaDs=xaDsMgr.getXaDataSource("String_Node_Str");
  DummyXaConnection xaC=null;
  try {
    xaC=(DummyXaConnection)xaDs.getXaConnection();
    try {
      xaC.doStuff1();
      fail("String_Node_Str");
    }
 catch (    XAException e) {
    }
    Xid xid=new XidImpl(new byte[0],new byte[0]);
    xaC.getXaResource().start(xid,XAResource.TMNOFLAGS);
    try {
      xaC.doStuff1();
      xaC.doStuff2();
    }
 catch (    XAException e) {
      fail("String_Node_Str");
    }
    xaC.getXaResource().end(xid,XAResource.TMSUCCESS);
    xaC.getXaResource().prepare(xid);
    xaC.getXaResource().commit(xid,false);
  }
  finally {
    xaDsMgr.unregisterDataSource("String_Node_Str");
    if (xaC != null) {
      xaC.destroy();
    }
  }
  File dir=new File("String_Node_Str");
  File files[]=dir.listFiles(new FilenameFilter(){
    public boolean accept(    File dir,    String fileName){
      return fileName.startsWith(resourceFile());
    }
  }
);
  for (int i=0; i < files.length; i++) {
    files[i].delete();
  }
}

Fixed version (ground truth):
@Test public void testCreateXaResource() throws Exception {
  Map<Object,Object> config=new HashMap<Object,Object>();
  config.put("String_Node_Str","String_Node_Str");
  xaDsMgr.registerDataSource("String_Node_Str",new DummyXaDataSource(config),"String_Node_Str".getBytes());
  XaDataSource xaDs=xaDsMgr.getXaDataSource("String_Node_Str");
  DummyXaConnection xaC=null;
  try {
    xaC=(DummyXaConnection)xaDs.getXaConnection();
    try {
      xaC.doStuff1();
      fail("String_Node_Str");
    }
 catch (    XAException e) {
    }
    Xid xid=new XidImpl(new byte[0],new byte[0]);
    xaC.getXaResource().start(xid,XAResource.TMNOFLAGS);
    try {
      xaC.doStuff1();
      xaC.doStuff2();
    }
 catch (    XAException e) {
      fail("String_Node_Str");
    }
    xaC.getXaResource().end(xid,XAResource.TMSUCCESS);
    xaC.getXaResource().prepare(xid);
    xaC.getXaResource().commit(xid,false);
  }
  finally {
    xaDsMgr.unregisterDataSource("String_Node_Str");
    if (xaC != null) {
      xaC.destroy();
    }
  }
  File dir=new File("String_Node_Str");
  File files[]=dir.listFiles(new FilenameFilter(){
    public boolean accept(    File dir,    String fileName){
      return fileName.startsWith(resourceFile());
    }
  }
);
  for (int i=0; i < files.length; i++) {
    files[i].delete();
  }
}
Program: 154804
Project: 154804
Buggy source:
public void somethingIsWrong(Exception e){
  new Thread(){
    @Override public void run(){
      for (int i=0; i < 5; i++) {
        try {
          reevaluateMyself();
          break;
        }
 catch (        ZooKeeperException e) {
          e.printStackTrace();
        }
catch (        HaCommunicationException e) {
          e.printStackTrace();
        }
      }
    }
  }
.start();
}

Fixed version (ground truth):
public void somethingIsWrong(Exception e){
  e.printStackTrace();
  new Thread(){
    @Override public void run(){
      for (int i=0; i < 5; i++) {
        try {
          reevaluateMyself();
          break;
        }
 catch (        ZooKeeperException e) {
          e.printStackTrace();
        }
catch (        HaCommunicationException e) {
          e.printStackTrace();
        }
      }
    }
  }
.start();
}
Program: 154805
Project: 154805
Buggy source:
@SuppressWarnings("String_Node_Str") protected static Pair<ChannelBuffer,SlaveContext> handleRequest(Master realMaster,ChannelBuffer buffer,Channel channel,MasterServer server) throws IOException {
  RequestType type=RequestType.values()[buffer.readByte()];
  SlaveContext context=null;
  if (type.includesSlaveContext()) {
    context=readSlaveContext(buffer);
    server.mapSlave(channel,context);
  }
  System.out.println(Thread.currentThread() + "String_Node_Str" + type+ "String_Node_Str"+ context);
  Response<?> response=type.caller.callMaster(realMaster,context,buffer);
  System.out.println(Thread.currentThread() + "String_Node_Str" + response.response()+ "String_Node_Str");
  ChannelBuffer targetBuffer=ChannelBuffers.dynamicBuffer();
  type.serializer.write(response.response(),targetBuffer);
  if (type.includesSlaveContext()) {
    writeTransactionStreams(response.transactions(),targetBuffer);
  }
  return new Pair<ChannelBuffer,SlaveContext>(targetBuffer,context);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected static ChannelBuffer handleRequest(Master realMaster,ChannelBuffer buffer,Channel channel,MasterServer server) throws IOException {
  RequestType type=RequestType.values()[buffer.readByte()];
  SlaveContext context=null;
  if (type.includesSlaveContext()) {
    context=readSlaveContext(buffer);
    server.mapSlave(channel,context);
  }
  System.out.println(Thread.currentThread() + "String_Node_Str" + type+ "String_Node_Str"+ context);
  Response<?> response=type.caller.callMaster(realMaster,context,buffer);
  System.out.println(Thread.currentThread() + "String_Node_Str" + response.response()+ "String_Node_Str");
  ChannelBuffer targetBuffer=ChannelBuffers.dynamicBuffer();
  type.serializer.write(response.response(),targetBuffer);
  if (type.includesSlaveContext()) {
    writeTransactionStreams(response.transactions(),targetBuffer);
  }
  return targetBuffer;
}
Program: 154806
Project: 154806
Buggy source:
private void releaseChannel(){
synchronized (channels) {
    Channel channel=channels.remove(Thread.currentThread());
    if (channel != null) {
      if (unusedChannels.size() < 5) {
        unusedChannels.push(channel);
      }
 else {
        channel.close();
      }
    }
  }
}

Fixed version (ground truth):
private void releaseChannel(){
synchronized (channels) {
    Channel channel=channels.remove(Thread.currentThread());
    if (channel != null) {
      if (unusedChannels.size() < 5) {
        unusedChannels.push(channel);
      }
 else {
        new Exception("String_Node_Str" + channel).printStackTrace();
        channel.close();
      }
    }
  }
}
Program: 154807
Project: 154807
Buggy source:
public ChannelPipeline getPipeline() throws Exception {
  ChannelPipeline pipeline=Channels.pipeline();
  pipeline.addLast("String_Node_Str",new LengthFieldBasedFrameDecoder(MAX_FRAME_LENGTH,0,4,0,4));
  pipeline.addLast("String_Node_Str",new LengthFieldPrepender(4));
  pipeline.addLast("String_Node_Str",new BlockingReadHandler<ChannelBuffer>());
  return pipeline;
}

Fixed version (ground truth):
public ChannelPipeline getPipeline() throws Exception {
  ChannelPipeline pipeline=Channels.pipeline();
  pipeline.addLast("String_Node_Str",new LengthFieldBasedFrameDecoder(MAX_FRAME_LENGTH,0,4,0,4));
  pipeline.addLast("String_Node_Str",new LengthFieldPrepender(4));
  BlockingReadHandler<ChannelBuffer> reader=new BlockingReadHandler<ChannelBuffer>();
  pipeline.addLast("String_Node_Str",reader);
  return pipeline;
}
Program: 154808
Project: 154808
Buggy source:
public void shutdown(){
synchronized (unusedChannels) {
    for (    Channel channel : unusedChannels) {
      channel.close();
    }
  }
synchronized (channels) {
    for (    Channel channel : channels.values()) {
      channel.close();
    }
  }
}

Fixed version (ground truth):
public void shutdown(){
synchronized (channels) {
    for (    Channel channel : unusedChannels) {
      new Exception("String_Node_Str" + channel).printStackTrace();
      channel.close();
    }
    for (    Channel channel : channels.values()) {
      new Exception("String_Node_Str" + channel).printStackTrace();
      channel.close();
    }
  }
}
Program: 154809
Project: 154809
Buggy source:
public Response<Void> rollbackTransaction(SlaveContext context){
  Transaction otherTx=suspendOtherAndResumeThis(context);
  try {
    Transaction tx=transactions.remove(context);
    if (tx == null) {
      throw new RuntimeException("String_Node_Str");
    }
    graphDbConfig.getTxModule().getTxManager().rollback();
    System.out.println(Thread.currentThread() + "String_Node_Str" + context);
    return packResponse(context,null,ALL);
  }
 catch (  IllegalStateException e) {
    throw new RuntimeException(e);
  }
catch (  SecurityException e) {
    throw new RuntimeException(e);
  }
catch (  SystemException e) {
    throw new RuntimeException(e);
  }
 finally {
    suspendThisAndResumeOther(otherTx,context);
  }
}

Fixed version (ground truth):
public Response<Void> rollbackTransaction(SlaveContext context){
  Transaction otherTx=suspendOtherAndResumeThis(context);
  try {
    Transaction tx=transactions.remove(context);
    if (tx == null) {
      throw new RuntimeException("String_Node_Str");
    }
    graphDbConfig.getTxModule().getTxManager().rollback();
    System.out.println("String_Node_Str" + context);
    return packResponse(context,null,ALL);
  }
 catch (  IllegalStateException e) {
    throw new RuntimeException(e);
  }
catch (  SecurityException e) {
    throw new RuntimeException(e);
  }
catch (  SystemException e) {
    throw new RuntimeException(e);
  }
 finally {
    suspendThisAndResumeOther(otherTx,context);
  }
}
Program: 154810
Project: 154810
Buggy source:
Transaction suspendOtherAndResumeThis(SlaveContext txId){
  try {
    TransactionManager txManager=graphDbConfig.getTxModule().getTxManager();
    Transaction otherTx=txManager.getTransaction();
    Transaction transaction=getTx(txId);
    if (otherTx != null && otherTx == transaction) {
      return null;
    }
 else {
      if (otherTx != null) {
        txManager.suspend();
        System.out.println(Thread.currentThread() + "String_Node_Str");
      }
      if (transaction == null) {
        beginTx(txId);
      }
 else {
        System.out.println(Thread.currentThread() + "String_Node_Str" + txId);
        txManager.resume(transaction);
      }
      return otherTx;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
Transaction suspendOtherAndResumeThis(SlaveContext txId){
  try {
    TransactionManager txManager=graphDbConfig.getTxModule().getTxManager();
    Transaction otherTx=txManager.getTransaction();
    Transaction transaction=getTx(txId);
    if (otherTx != null && otherTx == transaction) {
      return null;
    }
 else {
      if (otherTx != null) {
        txManager.suspend();
        System.out.println("String_Node_Str");
      }
      if (transaction == null) {
        beginTx(txId);
      }
 else {
        System.out.println("String_Node_Str" + txId);
        txManager.resume(transaction);
      }
      return otherTx;
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}
Program: 154811
Project: 154811
Buggy source:
private Transaction beginTx(SlaveContext txId){
  try {
    TransactionManager txManager=graphDbConfig.getTxModule().getTxManager();
    txManager.begin();
    System.out.println(Thread.currentThread() + "String_Node_Str" + txId);
    Transaction tx=txManager.getTransaction();
    transactions.put(txId,tx);
    return tx;
  }
 catch (  NotSupportedException e) {
    throw new RuntimeException(e);
  }
catch (  SystemException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private Transaction beginTx(SlaveContext txId){
  try {
    TransactionManager txManager=graphDbConfig.getTxModule().getTxManager();
    txManager.begin();
    System.out.println("String_Node_Str" + txId);
    Transaction tx=txManager.getTransaction();
    transactions.put(txId,tx);
    return tx;
  }
 catch (  NotSupportedException e) {
    throw new RuntimeException(e);
  }
catch (  SystemException e) {
    throw new RuntimeException(e);
  }
}
Program: 154812
Project: 154812
Buggy source:
void rollbackThisAndResumeOther(Transaction otherTx,SlaveContext txId){
  try {
    TransactionManager txManager=graphDbConfig.getTxModule().getTxManager();
    txManager.rollback();
    System.out.println(Thread.currentThread() + "String_Node_Str" + txId);
    transactions.remove(txId);
    if (otherTx != null) {
      System.out.println(Thread.currentThread() + "String_Node_Str" + txId);
      txManager.resume(otherTx);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
void rollbackThisAndResumeOther(Transaction otherTx,SlaveContext txId){
  try {
    TransactionManager txManager=graphDbConfig.getTxModule().getTxManager();
    txManager.rollback();
    System.out.println("String_Node_Str" + txId);
    transactions.remove(txId);
    if (otherTx != null) {
      System.out.println("String_Node_Str" + txId);
      txManager.resume(otherTx);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}
Program: 154813
Project: 154813
Buggy source:
void suspendThisAndResumeOther(Transaction otherTx,SlaveContext txId){
  try {
    TransactionManager txManager=graphDbConfig.getTxModule().getTxManager();
    txManager.suspend();
    System.out.println(Thread.currentThread() + "String_Node_Str" + txId);
    if (otherTx != null) {
      System.out.println(Thread.currentThread() + "String_Node_Str" + txId);
      txManager.resume(otherTx);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
void suspendThisAndResumeOther(Transaction otherTx,SlaveContext txId){
  try {
    TransactionManager txManager=graphDbConfig.getTxModule().getTxManager();
    txManager.suspend();
    System.out.println("String_Node_Str" + txId);
    if (otherTx != null) {
      System.out.println("String_Node_Str" + txId);
      txManager.resume(otherTx);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
}
Program: 154814
Project: 154814
Buggy source:
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  try {
    ChannelBuffer message=(ChannelBuffer)e.getMessage();
    Pair<ChannelBuffer,SlaveContext> result=handleRequest(realMaster,message,e.getChannel(),MasterServer.this);
    e.getChannel().write(result.first());
  }
 catch (  Exception e1) {
    e1.printStackTrace();
    throw e1;
  }
}

Fixed version (ground truth):
@Override public void messageReceived(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  try {
    ChannelBuffer message=(ChannelBuffer)e.getMessage();
    ChannelBuffer result=handleRequest(realMaster,message,e.getChannel(),MasterServer.this);
    e.getChannel().write(result);
  }
 catch (  Exception e1) {
    e1.printStackTrace();
    throw e1;
  }
}
Program: 154815
Project: 154815
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,ExceptionEvent e) throws Exception {
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,ExceptionEvent e) throws Exception {
  e.getCause().printStackTrace();
}
Program: 154816
Project: 154816
Buggy source:
public void run(){
  checkForDeadConnections();
}

Fixed version (ground truth):
public void run(){
}
Program: 154817
Project: 154817
Buggy source:
public MasterServer(Master realMaster,final int port){
  this.realMaster=realMaster;
  ExecutorService executor=Executors.newCachedThreadPool();
  channelFactory=new NioServerSocketChannelFactory(executor,executor);
  bootstrap=new ServerBootstrap(channelFactory);
  bootstrap.setPipelineFactory(this);
  channelGroup=new DefaultChannelGroup();
  executor.execute(new Runnable(){
    public void run(){
      Channel channel=bootstrap.bind(new InetSocketAddress(port));
      channelGroup.add(channel);
      System.out.println("String_Node_Str" + port);
    }
  }
);
  deadConnectionsPoller=new ScheduledThreadPoolExecutor(1);
  deadConnectionsPoller.scheduleWithFixedDelay(new Runnable(){
    public void run(){
      checkForDeadConnections();
    }
  }
,DEAD_CONNECTIONS_CHECK_INTERVAL,DEAD_CONNECTIONS_CHECK_INTERVAL,TimeUnit.SECONDS);
}

Fixed version (ground truth):
public MasterServer(Master realMaster,final int port){
  this.realMaster=realMaster;
  ExecutorService executor=Executors.newCachedThreadPool();
  channelFactory=new NioServerSocketChannelFactory(executor,executor,MAX_NUMBER_OF_CONCURRENT_TRANSACTIONS);
  bootstrap=new ServerBootstrap(channelFactory);
  bootstrap.setPipelineFactory(this);
  channelGroup=new DefaultChannelGroup();
  executor.execute(new Runnable(){
    public void run(){
      Channel channel=bootstrap.bind(new InetSocketAddress(port));
      channelGroup.add(channel);
      System.out.println("String_Node_Str" + port);
    }
  }
);
  deadConnectionsPoller=new ScheduledThreadPoolExecutor(1);
  deadConnectionsPoller.scheduleWithFixedDelay(new Runnable(){
    public void run(){
    }
  }
,DEAD_CONNECTIONS_CHECK_INTERVAL,DEAD_CONNECTIONS_CHECK_INTERVAL,TimeUnit.SECONDS);
}
Program: 154818
Project: 154818
Buggy source:
private List<LogEntry> extractTransactionFromLog(long txId,long expectedVersion,ReadableByteChannel log) throws IOException {
  long[] header=readAndAssertLogHeader(buffer,log,expectedVersion);
  long prevTxId=header[1];
  assertLogCanContainTx(txId,prevTxId);
  List<LogEntry> logEntryList=null;
  Map<Integer,List<LogEntry>> transactions=new HashMap<Integer,List<LogEntry>>();
  LogEntry entry;
  while ((entry=LogIoUtils.readEntry(buffer,log,cf)) != null && logEntryList == null) {
    if (entry instanceof LogEntry.Start) {
      List<LogEntry> list=new LinkedList<LogEntry>();
      list.add(entry);
      transactions.put(entry.getIdentifier(),list);
    }
 else     if (entry instanceof LogEntry.Commit) {
      if (((LogEntry.Commit)entry).getTxId() == txId) {
        logEntryList=transactions.get(entry.getIdentifier());
        logEntryList.add(entry);
      }
 else {
        transactions.remove(entry.getIdentifier());
      }
    }
 else     if (entry instanceof LogEntry.Command) {
      transactions.get(entry.getIdentifier()).add(entry);
    }
 else     if (entry instanceof LogEntry.Done) {
      transactions.remove(entry.getIdentifier());
    }
 else {
      throw new RuntimeException("String_Node_Str" + entry);
    }
  }
  if (logEntryList == null) {
    throw new IOException("String_Node_Str" + txId + "String_Node_Str"+ expectedVersion+ "String_Node_Str"+ prevTxId+ "String_Node_Str");
  }
  return logEntryList;
}

Fixed version (ground truth):
private List<LogEntry> extractTransactionFromLog(long txId,long expectedVersion,ReadableByteChannel log) throws IOException {
  long[] header=readAndAssertLogHeader(buffer,log,expectedVersion);
  long prevTxId=header[1];
  assertLogCanContainTx(txId,prevTxId);
  List<LogEntry> logEntryList=null;
  Map<Integer,List<LogEntry>> transactions=new HashMap<Integer,List<LogEntry>>();
  LogEntry entry;
  while ((entry=LogIoUtils.readEntry(buffer,log,cf)) != null && logEntryList == null) {
    if (entry instanceof LogEntry.Start) {
      List<LogEntry> list=new LinkedList<LogEntry>();
      list.add(entry);
      transactions.put(entry.getIdentifier(),list);
    }
 else     if (entry instanceof LogEntry.Commit) {
      if (((LogEntry.Commit)entry).getTxId() == txId) {
        logEntryList=transactions.get(entry.getIdentifier());
        logEntryList.add(entry);
      }
 else {
        transactions.remove(entry.getIdentifier());
      }
    }
 else     if (entry instanceof LogEntry.Command || entry instanceof LogEntry.Prepare) {
      transactions.get(entry.getIdentifier()).add(entry);
    }
 else     if (entry instanceof LogEntry.Done) {
      transactions.remove(entry.getIdentifier());
    }
 else {
      throw new RuntimeException("String_Node_Str" + entry);
    }
  }
  if (logEntryList == null) {
    throw new IOException("String_Node_Str" + txId + "String_Node_Str"+ expectedVersion+ "String_Node_Str"+ prevTxId+ "String_Node_Str");
  }
  return logEntryList;
}
Program: 154819
Project: 154819
Buggy source:
synchronized void doneInternal(int identifier) throws IOException {
  buffer.clear();
  buffer.put(DONE).putInt(identifier);
  buffer.flip();
  fileChannel.write(buffer);
  xidIdentMap.remove(identifier);
}

Fixed version (ground truth):
synchronized void doneInternal(int identifier) throws IOException {
  buffer.clear();
  buffer.put(DONE).putInt(identifier);
  buffer.flip();
  fileChannel.write(buffer);
  xidIdentMap.remove(identifier);
  fileChannel.force(false);
}
Program: 154820
Project: 154820
Buggy source:
public static void writeLogEntry(LogEntry entry,LogBuffer buffer) throws IOException {
  if (entry instanceof LogEntry.Command) {
    buffer.put(LogEntry.COMMAND).putInt(entry.getIdentifier());
    XaCommand command=((LogEntry.Command)entry).getXaCommand();
    command.writeToFile(buffer);
  }
 else   if (entry instanceof LogEntry.Start) {
    LogEntry.Start start=(LogEntry.Start)entry;
    Xid xid=start.getXid();
    byte globalId[]=xid.getGlobalTransactionId();
    byte branchId[]=xid.getBranchQualifier();
    int formatId=xid.getFormatId();
    int identifier=start.getIdentifier();
    buffer.put(LogEntry.TX_START).put((byte)globalId.length).put((byte)branchId.length).put(globalId).put(branchId).putInt(identifier).putInt(formatId);
  }
 else   if (entry instanceof LogEntry.Done) {
    buffer.put(LogEntry.DONE).putInt(entry.getIdentifier());
  }
 else   if (entry instanceof LogEntry.OnePhaseCommit) {
    buffer.put(LogEntry.TX_1P_COMMIT).putInt(entry.getIdentifier()).putLong(((LogEntry.OnePhaseCommit)entry).getTxId());
  }
 else   if (entry instanceof LogEntry.Prepare) {
    buffer.put(LogEntry.TX_PREPARE).putInt(entry.getIdentifier());
  }
 else   if (entry instanceof LogEntry.TwoPhaseCommit) {
    buffer.put(LogEntry.TX_2P_COMMIT).putInt(entry.getIdentifier()).putLong(((LogEntry.OnePhaseCommit)entry).getTxId());
  }
}

Fixed version (ground truth):
public static void writeLogEntry(LogEntry entry,LogBuffer buffer) throws IOException {
  if (entry instanceof LogEntry.Command) {
    buffer.put(LogEntry.COMMAND).putInt(entry.getIdentifier());
    XaCommand command=((LogEntry.Command)entry).getXaCommand();
    command.writeToFile(buffer);
  }
 else   if (entry instanceof LogEntry.Start) {
    LogEntry.Start start=(LogEntry.Start)entry;
    Xid xid=start.getXid();
    byte globalId[]=xid.getGlobalTransactionId();
    byte branchId[]=xid.getBranchQualifier();
    int formatId=xid.getFormatId();
    int identifier=start.getIdentifier();
    buffer.put(LogEntry.TX_START).put((byte)globalId.length).put((byte)branchId.length).put(globalId).put(branchId).putInt(identifier).putInt(formatId);
  }
 else   if (entry instanceof LogEntry.Done) {
    buffer.put(LogEntry.DONE).putInt(entry.getIdentifier());
  }
 else   if (entry instanceof LogEntry.OnePhaseCommit) {
    buffer.put(LogEntry.TX_1P_COMMIT).putInt(entry.getIdentifier()).putLong(((LogEntry.Commit)entry).getTxId());
  }
 else   if (entry instanceof LogEntry.Prepare) {
    buffer.put(LogEntry.TX_PREPARE).putInt(entry.getIdentifier());
  }
 else   if (entry instanceof LogEntry.TwoPhaseCommit) {
    buffer.put(LogEntry.TX_2P_COMMIT).putInt(entry.getIdentifier()).putLong(((LogEntry.Commit)entry).getTxId());
  }
}
Program: 154821
Project: 154821
Buggy source:
private void applyStartEntry(LogEntry.Start entry) throws IOException {
  int identifier=entry.getIdentifier();
  if (identifier >= nextIdentifier) {
    nextIdentifier=(identifier + 1);
  }
  Xid xid=entry.getXid();
  xidIdentMap.put(identifier,entry);
  XaTransaction xaTx=xaTf.create(identifier);
  xaTx.setRecovered();
  recoveredTxMap.put(identifier,xaTx);
  xaRm.injectStart(xid,xaTx);
}

Fixed version (ground truth):
private void applyStartEntry(LogEntry.Start entry) throws IOException {
  int identifier=entry.getIdentifier();
  if (identifier >= nextIdentifier) {
    nextIdentifier=(identifier + 1);
  }
  Xid xid=entry.getXid();
  xidIdentMap.put(identifier,entry);
  XaTransaction xaTx=xaTf.create(identifier);
  xaTx.setRecovered();
  recoveredTxMap.put(identifier,xaTx);
  xaRm.injectStart(xid,xaTx);
  fileChannel.force(false);
}
Program: 154822
Project: 154822
Buggy source:
public synchronized void applyTransaction(ReadableByteChannel byteChannel) throws IOException {
  long logEntriesFound=0;
  LogApplier logApplier=new LogApplier(byteChannel);
  int xidIdent=getNextIdentifier();
  while (logApplier.readAndApplyAndWriteEntry(xidIdent)) {
    logEntriesFound++;
  }
  byteChannel.close();
}

Fixed version (ground truth):
public synchronized void applyTransaction(ReadableByteChannel byteChannel) throws IOException {
  long logEntriesFound=0;
  scanIsComplete=false;
  LogApplier logApplier=new LogApplier(byteChannel);
  int xidIdent=getNextIdentifier();
  while (logApplier.readAndApplyAndWriteEntry(xidIdent)) {
    logEntriesFound++;
  }
  byteChannel.close();
  scanIsComplete=true;
}
Program: 154823
Project: 154823
Buggy source:
public synchronized void applyTransactionWithoutTxId(ReadableByteChannel byteChannel,long nextTxId) throws IOException {
  if (nextTxId != (xaTf.getLastCommittedTx() + 1)) {
    throw new IllegalStateException("String_Node_Str" + nextTxId + "String_Node_Str"+ (xaTf.getCurrentVersion() + 1));
  }
  log.fine("String_Node_Str" + logVersion + "String_Node_Str"+ nextTxId+ "String_Node_Str");
  long logEntriesFound=0;
  LogApplier logApplier=new LogApplier(byteChannel);
  int xidIdent=getNextIdentifier();
  while (logApplier.readAndApplyAndWriteEntry(xidIdent)) {
    logEntriesFound++;
  }
  byteChannel.close();
  LogEntry.Start entry=logApplier.startEntry;
  if (entry == null) {
    throw new IOException("String_Node_Str");
  }
  LogEntry.OnePhaseCommit commit=new LogEntry.OnePhaseCommit(xidIdent,nextTxId);
  LogIoUtils.writeLogEntry(commit,writeBuffer);
  Xid xid=entry.getXid();
  try {
    XaTransaction xaTx=xaRm.getXaTransaction(xid);
    xaTx.setCommitTxId(nextTxId);
    xaRm.commit(xid,true);
  }
 catch (  XAException e) {
    e.printStackTrace();
    throw new IOException(e.getMessage());
  }
  log.info("String_Node_Str" + nextTxId + "String_Node_Str"+ "String_Node_Str");
  msgLog.logMessage("String_Node_Str" + nextTxId);
}

Fixed version (ground truth):
public synchronized void applyTransactionWithoutTxId(ReadableByteChannel byteChannel,long nextTxId) throws IOException {
  if (nextTxId != (xaTf.getLastCommittedTx() + 1)) {
    throw new IllegalStateException("String_Node_Str" + nextTxId + "String_Node_Str"+ (xaTf.getCurrentVersion() + 1));
  }
  log.fine("String_Node_Str" + logVersion + "String_Node_Str"+ nextTxId+ "String_Node_Str");
  long logEntriesFound=0;
  scanIsComplete=false;
  LogApplier logApplier=new LogApplier(byteChannel);
  int xidIdent=getNextIdentifier();
  while (logApplier.readAndApplyAndWriteEntry(xidIdent)) {
    logEntriesFound++;
  }
  byteChannel.close();
  LogEntry.Start entry=logApplier.startEntry;
  if (entry == null) {
    throw new IOException("String_Node_Str");
  }
  LogEntry.OnePhaseCommit commit=new LogEntry.OnePhaseCommit(xidIdent,nextTxId);
  LogIoUtils.writeLogEntry(commit,writeBuffer);
  Xid xid=entry.getXid();
  try {
    XaTransaction xaTx=xaRm.getXaTransaction(xid);
    xaTx.setCommitTxId(nextTxId);
    xaRm.commit(xid,true);
    LogEntry doneEntry=new LogEntry.Done(entry.getIdentifier());
    LogIoUtils.writeLogEntry(doneEntry,writeBuffer);
  }
 catch (  XAException e) {
    e.printStackTrace();
    throw new IOException(e.getMessage());
  }
  scanIsComplete=true;
  log.info("String_Node_Str" + nextTxId + "String_Node_Str"+ "String_Node_Str");
  msgLog.logMessage("String_Node_Str" + nextTxId);
}
Program: 154824
Project: 154824
Buggy source:
public synchronized void applyLog(ReadableByteChannel byteChannel) throws IOException {
  if (!backupSlave) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (xidIdentMap.size() > 0) {
    throw new IllegalStateException("String_Node_Str");
  }
  long[] header=readLogHeader(buffer,byteChannel,true);
  logVersion=header[0];
  long previousCommittedTx=header[1];
  if (logVersion != xaTf.getCurrentVersion()) {
    throw new IllegalStateException("String_Node_Str" + logVersion + "String_Node_Str"+ xaTf.getCurrentVersion());
  }
  log.fine("String_Node_Str" + logVersion + "String_Node_Str"+ previousCommittedTx+ "String_Node_Str");
  msgLog.logMessage("String_Node_Str" + logVersion + "String_Node_Str"+ previousCommittedTx+ "String_Node_Str");
  long logEntriesFound=0;
  LogApplier logApplier=new LogApplier(byteChannel);
  while (logApplier.readAndApplyEntry()) {
    logEntriesFound++;
  }
  byteChannel.close();
  xaTf.flushAll();
  xaTf.getAndSetNewVersion();
  xaRm.reset();
  msgLog.logMessage("String_Node_Str" + logVersion + "String_Node_Str"+ logEntriesFound+ "String_Node_Str");
  log.info("String_Node_Str" + fileName + "String_Node_Str"+ logVersion+ "String_Node_Str");
}

Fixed version (ground truth):
public synchronized void applyLog(ReadableByteChannel byteChannel) throws IOException {
  if (!backupSlave) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (xidIdentMap.size() > 0) {
    throw new IllegalStateException("String_Node_Str");
  }
  long[] header=readLogHeader(buffer,byteChannel,true);
  logVersion=header[0];
  long previousCommittedTx=header[1];
  if (logVersion != xaTf.getCurrentVersion()) {
    throw new IllegalStateException("String_Node_Str" + logVersion + "String_Node_Str"+ xaTf.getCurrentVersion());
  }
  log.fine("String_Node_Str" + logVersion + "String_Node_Str"+ previousCommittedTx+ "String_Node_Str");
  msgLog.logMessage("String_Node_Str" + logVersion + "String_Node_Str"+ previousCommittedTx+ "String_Node_Str");
  long logEntriesFound=0;
  LogApplier logApplier=new LogApplier(byteChannel);
  scanIsComplete=false;
  while (logApplier.readAndApplyEntry()) {
    logEntriesFound++;
  }
  scanIsComplete=true;
  byteChannel.close();
  xaTf.flushAll();
  xaTf.getAndSetNewVersion();
  xaRm.reset();
  msgLog.logMessage("String_Node_Str" + logVersion + "String_Node_Str"+ logEntriesFound+ "String_Node_Str");
  log.info("String_Node_Str" + fileName + "String_Node_Str"+ logVersion+ "String_Node_Str");
}
Program: 154825
Project: 154825
Buggy source:
@Override protected Iterator<T> createNestedIterator(final BufferedReader input){
  return new PrefetchingIterator<T>(){
    @Override protected T fetchNextOrNull(){
      try {
        String line;
        while (null != (line=input.readLine())) {
          try {
            return type.cast(Class.forName(line).newInstance());
          }
 catch (          Exception e) {
          }
        }
        return null;
      }
 catch (      IOException e) {
        return null;
      }
    }
  }
;
}

Fixed version (ground truth):
@Override protected Iterator<T> createNestedIterator(final BufferedReader input){
  return new PrefetchingIterator<T>(){
    @Override protected T fetchNextOrNull(){
      try {
        String line;
        while (null != (line=input.readLine())) {
          try {
            return type.cast(Class.forName(line).newInstance());
          }
 catch (          Exception e) {
            return null;
          }
catch (          LinkageError e) {
            return null;
          }
        }
        return null;
      }
 catch (      IOException e) {
        return null;
      }
    }
  }
;
}
Program: 154826
Project: 154826
Buggy source:
private static <T>Iterable<T> java6Loader(Class<T> type){
  try {
    @SuppressWarnings("String_Node_Str") Iterable<T> result=(Iterable<T>)Class.forName("String_Node_Str").getMethod("String_Node_Str",Class.class).invoke(null,type);
    return filterExceptions(result);
  }
 catch (  Exception e) {
    return null;
  }
}

Fixed version (ground truth):
private static <T>Iterable<T> java6Loader(Class<T> type){
  try {
    @SuppressWarnings("String_Node_Str") Iterable<T> result=(Iterable<T>)Class.forName("String_Node_Str").getMethod("String_Node_Str",Class.class).invoke(null,type);
    return filterExceptions(result);
  }
 catch (  Exception e) {
    return null;
  }
catch (  LinkageError e) {
    return null;
  }
}
Program: 154827
Project: 154827
Buggy source:
private static <T>Iterable<T> sunJava5Loader(final Class<T> type){
  final Method providers;
  try {
    providers=Class.forName("String_Node_Str").getMethod("String_Node_Str",Class.class);
  }
 catch (  Exception e) {
    return null;
  }
  return filterExceptions(new Iterable<T>(){
    public Iterator<T> iterator(){
      try {
        @SuppressWarnings("String_Node_Str") Iterator<T> result=(Iterator<T>)providers.invoke(null,type);
        return result;
      }
 catch (      Exception e) {
        throw new RuntimeException("String_Node_Str",e);
      }
    }
  }
);
}

Fixed version (ground truth):
private static <T>Iterable<T> sunJava5Loader(final Class<T> type){
  final Method providers;
  try {
    providers=Class.forName("String_Node_Str").getMethod("String_Node_Str",Class.class);
  }
 catch (  Exception e) {
    return null;
  }
catch (  LinkageError e) {
    return null;
  }
  return filterExceptions(new Iterable<T>(){
    public Iterator<T> iterator(){
      try {
        @SuppressWarnings("String_Node_Str") Iterator<T> result=(Iterator<T>)providers.invoke(null,type);
        return result;
      }
 catch (      Exception e) {
        throw new RuntimeException("String_Node_Str",e);
      }
    }
  }
);
}
Program: 154828
Project: 154828
Buggy source:
@Override protected T fetchNextOrNull(){
  try {
    String line;
    while (null != (line=input.readLine())) {
      try {
        return type.cast(Class.forName(line).newInstance());
      }
 catch (      Exception e) {
      }
    }
    return null;
  }
 catch (  IOException e) {
    return null;
  }
}

Fixed version (ground truth):
@Override protected T fetchNextOrNull(){
  try {
    String line;
    while (null != (line=input.readLine())) {
      try {
        return type.cast(Class.forName(line).newInstance());
      }
 catch (      Exception e) {
        return null;
      }
catch (      LinkageError e) {
        return null;
      }
    }
    return null;
  }
 catch (  IOException e) {
    return null;
  }
}
Program: 154829
Project: 154829
Buggy source:
private static <T>Iterable<T> ourOwnLoader(final Class<T> type){
  List<URL> urls=new LinkedList<URL>();
  try {
    Enumeration<URL> resources=Thread.currentThread().getContextClassLoader().getResources("String_Node_Str" + type.getName());
    while (resources.hasMoreElements()) {
      urls.add(resources.nextElement());
    }
  }
 catch (  IOException e) {
    return null;
  }
  return new NestingIterable<T,BufferedReader>(FilteringIterable.notNull(new IterableWrapper<BufferedReader,URL>(urls){
    @Override protected BufferedReader underlyingObjectToObject(    URL url){
      try {
        return new BufferedReader(new InputStreamReader(url.openStream()));
      }
 catch (      IOException e) {
        return null;
      }
    }
  }
)){
    @Override protected Iterator<T> createNestedIterator(    final BufferedReader input){
      return new PrefetchingIterator<T>(){
        @Override protected T fetchNextOrNull(){
          try {
            String line;
            while (null != (line=input.readLine())) {
              try {
                return type.cast(Class.forName(line).newInstance());
              }
 catch (              Exception e) {
              }
            }
            return null;
          }
 catch (          IOException e) {
            return null;
          }
        }
      }
;
    }
  }
;
}

Fixed version (ground truth):
private static <T>Iterable<T> ourOwnLoader(final Class<T> type){
  List<URL> urls=new LinkedList<URL>();
  try {
    Enumeration<URL> resources=Thread.currentThread().getContextClassLoader().getResources("String_Node_Str" + type.getName());
    while (resources.hasMoreElements()) {
      urls.add(resources.nextElement());
    }
  }
 catch (  IOException e) {
    return null;
  }
  return new NestingIterable<T,BufferedReader>(FilteringIterable.notNull(new IterableWrapper<BufferedReader,URL>(urls){
    @Override protected BufferedReader underlyingObjectToObject(    URL url){
      try {
        return new BufferedReader(new InputStreamReader(url.openStream()));
      }
 catch (      IOException e) {
        return null;
      }
    }
  }
)){
    @Override protected Iterator<T> createNestedIterator(    final BufferedReader input){
      return new PrefetchingIterator<T>(){
        @Override protected T fetchNextOrNull(){
          try {
            String line;
            while (null != (line=input.readLine())) {
              try {
                return type.cast(Class.forName(line).newInstance());
              }
 catch (              Exception e) {
                return null;
              }
catch (              LinkageError e) {
                return null;
              }
            }
            return null;
          }
 catch (          IOException e) {
            return null;
          }
        }
      }
;
    }
  }
;
}