nus-yam/ex-repair huggingface dataset:
Program: 57815
Project: 57815
Buggy source:
/** 
 * Close the DomainSocketWatcher and wait for its thread to terminate. If there is more than one close, all but the first will be ignored.
 */
@Override public void close() throws IOException {
  lock.lock();
  try {
    if (closed)     return;
    LOG.info(this + "String_Node_Str");
    closed=true;
  }
  finally {
    lock.unlock();
  }
  notificationSockets[0].close();
  Uninterruptibles.joinUninterruptibly(watcherThread);
}

Fixed version (ground truth):
/** 
 * Close the DomainSocketWatcher and wait for its thread to terminate. If there is more than one close, all but the first will be ignored.
 */
@Override public void close() throws IOException {
  lock.lock();
  try {
    if (closed)     return;
    if (LOG.isDebugEnabled()) {
      LOG.debug(this + "String_Node_Str");
    }
    closed=true;
  }
  finally {
    lock.unlock();
  }
  notificationSockets[0].close();
  Uninterruptibles.joinUninterruptibly(watcherThread);
}
Program: 57816
Project: 57816
Buggy source:
public void move(Queue newQueue){
  QueueMetrics oldMetrics=queue.getMetrics();
  QueueMetrics newMetrics=newQueue.getMetrics();
  String user=getUser();
  for (  RMContainer liveContainer : liveContainers.values()) {
    Resource resource=liveContainer.getContainer().getResource();
    oldMetrics.releaseResources(user,1,resource);
    newMetrics.allocateResources(user,1,resource,false);
  }
  for (  Map<NodeId,RMContainer> map : reservedContainers.values()) {
    for (    RMContainer reservedContainer : map.values()) {
      Resource resource=reservedContainer.getReservedResource();
      oldMetrics.unreserveResource(user,resource);
      newMetrics.reserveResource(user,resource);
    }
  }
  appSchedulingInfo.move(newQueue);
  this.queue=newQueue;
}

Fixed version (ground truth):
public synchronized void move(Queue newQueue){
  QueueMetrics oldMetrics=queue.getMetrics();
  QueueMetrics newMetrics=newQueue.getMetrics();
  String user=getUser();
  for (  RMContainer liveContainer : liveContainers.values()) {
    Resource resource=liveContainer.getContainer().getResource();
    oldMetrics.releaseResources(user,1,resource);
    newMetrics.allocateResources(user,1,resource,false);
  }
  for (  Map<NodeId,RMContainer> map : reservedContainers.values()) {
    for (    RMContainer reservedContainer : map.values()) {
      Resource resource=reservedContainer.getReservedResource();
      oldMetrics.unreserveResource(user,resource);
      newMetrics.reserveResource(user,resource);
    }
  }
  appSchedulingInfo.move(newQueue);
  this.queue=newQueue;
}
Program: 57817
Project: 57817
Buggy source:
@Override protected void processPath(PathData item) throws IOException {
  if (cf.getOpt("String_Node_Str")) {
    item.fs.removeAcl(item.path);
  }
 else   if (cf.getOpt("String_Node_Str")) {
    item.fs.removeDefaultAcl(item.path);
  }
 else   if (cf.getOpt("String_Node_Str")) {
    item.fs.modifyAclEntries(item.path,aclEntries);
  }
 else   if (cf.getOpt("String_Node_Str")) {
    item.fs.removeAclEntries(item.path,aclEntries);
  }
 else   if (cf.getOpt("String_Node_Str")) {
    item.fs.setAcl(path,aclEntries);
  }
}

Fixed version (ground truth):
@Override protected void processPath(PathData item) throws IOException {
  if (cf.getOpt("String_Node_Str")) {
    item.fs.removeAcl(item.path);
  }
 else   if (cf.getOpt("String_Node_Str")) {
    item.fs.removeDefaultAcl(item.path);
  }
 else   if (cf.getOpt("String_Node_Str")) {
    item.fs.modifyAclEntries(item.path,aclEntries);
  }
 else   if (cf.getOpt("String_Node_Str")) {
    item.fs.removeAclEntries(item.path,aclEntries);
  }
 else   if (cf.getOpt("String_Node_Str")) {
    item.fs.setAcl(item.path,aclEntries);
  }
}
Program: 57818
Project: 57818
Buggy source:
@Override protected void processOptions(LinkedList<String> args) throws IOException {
  cf.parse(args);
  setRecursive(cf.getOpt("String_Node_Str"));
  boolean bothRemoveOptions=cf.getOpt("String_Node_Str") && cf.getOpt("String_Node_Str");
  boolean bothModifyOptions=cf.getOpt("String_Node_Str") && cf.getOpt("String_Node_Str");
  boolean oneRemoveOption=cf.getOpt("String_Node_Str") || cf.getOpt("String_Node_Str");
  boolean oneModifyOption=cf.getOpt("String_Node_Str") || cf.getOpt("String_Node_Str");
  boolean setOption=cf.getOpt("String_Node_Str");
  if ((bothRemoveOptions || bothModifyOptions) || (oneRemoveOption && oneModifyOption) || (setOption && (oneRemoveOption || oneModifyOption))) {
    throw new HadoopIllegalArgumentException("String_Node_Str");
  }
  if (oneModifyOption || setOption) {
    if (args.size() < 2) {
      throw new HadoopIllegalArgumentException("String_Node_Str");
    }
    aclEntries=parseAclSpec(args.removeFirst());
  }
  if (args.isEmpty()) {
    throw new HadoopIllegalArgumentException("String_Node_Str");
  }
  if (args.size() > 1) {
    throw new HadoopIllegalArgumentException("String_Node_Str");
  }
  path=new Path(args.removeFirst());
}

Fixed version (ground truth):
@Override protected void processOptions(LinkedList<String> args) throws IOException {
  cf.parse(args);
  setRecursive(cf.getOpt("String_Node_Str"));
  boolean bothRemoveOptions=cf.getOpt("String_Node_Str") && cf.getOpt("String_Node_Str");
  boolean bothModifyOptions=cf.getOpt("String_Node_Str") && cf.getOpt("String_Node_Str");
  boolean oneRemoveOption=cf.getOpt("String_Node_Str") || cf.getOpt("String_Node_Str");
  boolean oneModifyOption=cf.getOpt("String_Node_Str") || cf.getOpt("String_Node_Str");
  boolean setOption=cf.getOpt("String_Node_Str");
  if ((bothRemoveOptions || bothModifyOptions) || (oneRemoveOption && oneModifyOption) || (setOption && (oneRemoveOption || oneModifyOption))) {
    throw new HadoopIllegalArgumentException("String_Node_Str");
  }
  if (oneModifyOption || setOption) {
    if (args.size() < 2) {
      throw new HadoopIllegalArgumentException("String_Node_Str");
    }
    aclEntries=AclEntry.parseAclSpec(args.removeFirst(),!cf.getOpt("String_Node_Str"));
  }
  if (args.isEmpty()) {
    throw new HadoopIllegalArgumentException("String_Node_Str");
  }
  if (args.size() > 1) {
    throw new HadoopIllegalArgumentException("String_Node_Str");
  }
}
Program: 57819
Project: 57819
Buggy source:
@Test public void testSetfaclValidations() throws Exception {
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
}

Fixed version (ground truth):
@Test public void testSetfaclValidations() throws Exception {
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
  assertFalse("String_Node_Str",0 == runCommand(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
}
Program: 57820
Project: 57820
Buggy source:
@Override public void run(){
  while (!stopped && !Thread.currentThread().isInterrupted()) {
    drained=eventQueue.isEmpty();
    Event event;
    try {
      event=eventQueue.take();
    }
 catch (    InterruptedException ie) {
      if (!stopped) {
        LOG.warn("String_Node_Str",ie);
      }
      return;
    }
    if (event != null) {
      dispatch(event);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!stopped && !Thread.currentThread().isInterrupted()) {
    drained=eventQueue.isEmpty();
    if (blockNewEvents) {
synchronized (waitForDrained) {
        if (drained) {
          waitForDrained.notify();
        }
      }
    }
    Event event;
    try {
      event=eventQueue.take();
    }
 catch (    InterruptedException ie) {
      if (!stopped) {
        LOG.warn("String_Node_Str",ie);
      }
      return;
    }
    if (event != null) {
      dispatch(event);
    }
  }
}
Program: 57821
Project: 57821
Buggy source:
Runnable createThread(){
  return new Runnable(){
    @Override public void run(){
      while (!stopped && !Thread.currentThread().isInterrupted()) {
        drained=eventQueue.isEmpty();
        Event event;
        try {
          event=eventQueue.take();
        }
 catch (        InterruptedException ie) {
          if (!stopped) {
            LOG.warn("String_Node_Str",ie);
          }
          return;
        }
        if (event != null) {
          dispatch(event);
        }
      }
    }
  }
;
}

Fixed version (ground truth):
Runnable createThread(){
  return new Runnable(){
    @Override public void run(){
      while (!stopped && !Thread.currentThread().isInterrupted()) {
        drained=eventQueue.isEmpty();
        if (blockNewEvents) {
synchronized (waitForDrained) {
            if (drained) {
              waitForDrained.notify();
            }
          }
        }
        Event event;
        try {
          event=eventQueue.take();
        }
 catch (        InterruptedException ie) {
          if (!stopped) {
            LOG.warn("String_Node_Str",ie);
          }
          return;
        }
        if (event != null) {
          dispatch(event);
        }
      }
    }
  }
;
}
Program: 57822
Project: 57822
Buggy source:
@Override protected void serviceStop() throws Exception {
  if (drainEventsOnStop) {
    blockNewEvents=true;
    LOG.info("String_Node_Str");
    while (!drained) {
      Thread.yield();
    }
  }
  stopped=true;
  if (eventHandlingThread != null) {
    eventHandlingThread.interrupt();
    try {
      eventHandlingThread.join();
    }
 catch (    InterruptedException ie) {
      LOG.warn("String_Node_Str",ie);
    }
  }
  super.serviceStop();
}

Fixed version (ground truth):
@Override protected void serviceStop() throws Exception {
  if (drainEventsOnStop) {
    blockNewEvents=true;
    LOG.info("String_Node_Str");
synchronized (waitForDrained) {
      while (!drained && eventHandlingThread.isAlive()) {
        waitForDrained.wait(1000);
        LOG.info("String_Node_Str");
      }
    }
  }
  stopped=true;
  if (eventHandlingThread != null) {
    eventHandlingThread.interrupt();
    try {
      eventHandlingThread.join();
    }
 catch (    InterruptedException ie) {
      LOG.warn("String_Node_Str",ie);
    }
  }
  super.serviceStop();
}
Program: 57823
Project: 57823
Buggy source:
@Override public XDR send(XDR xdr,int xid){
  super.send(xdr,xid);
  xdr.writeBoolean(true);
  postOpDirAttr.serialize(xdr);
  if (getStatus() == Nfs3Status.NFS3_OK) {
    xdr.writeLongAsHyper(cookieVerf);
    Entry3[] f=dirList.entries;
    for (int i=0; i < f.length; i++) {
      xdr.writeBoolean(true);
      xdr.writeLongAsHyper(f[i].getFileId());
      xdr.writeString(f[i].getName());
      xdr.writeLongAsHyper(f[i].getCookie());
    }
    xdr.writeBoolean(false);
    xdr.writeBoolean(dirList.eof);
  }
  return xdr;
}

Fixed version (ground truth):
@Override public XDR send(XDR xdr,int xid){
  super.send(xdr,xid);
  xdr.writeBoolean(true);
  postOpDirAttr.serialize(xdr);
  if (getStatus() == Nfs3Status.NFS3_OK) {
    xdr.writeLongAsHyper(cookieVerf);
    for (    Entry3 e : dirList.entries) {
      xdr.writeBoolean(true);
      xdr.writeLongAsHyper(e.getFileId());
      xdr.writeString(e.getName());
      xdr.writeLongAsHyper(e.getCookie());
    }
    xdr.writeBoolean(false);
    xdr.writeBoolean(dirList.eof);
  }
  return xdr;
}
Program: 57824
Project: 57824
Buggy source:
public DirList3(Entry3[] entries,boolean eof){
  this.entries=ObjectArrays.newArray(entries,entries.length);
  System.arraycopy(this.entries,0,entries,0,entries.length);
  this.eof=eof;
}

Fixed version (ground truth):
public DirList3(Entry3[] entries,boolean eof){
  this.entries=Collections.unmodifiableList(Arrays.asList(entries));
  this.eof=eof;
}
Program: 57825
Project: 57825
Buggy source:
EntryPlus3[] getEntries(){
  return entries;
}

Fixed version (ground truth):
List<EntryPlus3> getEntries(){
  return entries;
}
Program: 57826
Project: 57826
Buggy source:
public DirListPlus3(EntryPlus3[] entries,boolean eof){
  this.entries=ObjectArrays.newArray(entries,entries.length);
  System.arraycopy(this.entries,0,entries,0,entries.length);
  this.eof=eof;
}

Fixed version (ground truth):
public DirListPlus3(EntryPlus3[] entries,boolean eof){
  this.entries=Collections.unmodifiableList(Arrays.asList(entries));
  this.eof=eof;
}
Program: 57827
Project: 57827
Buggy source:
@Override public XDR send(XDR out,int xid){
  super.send(out,xid);
  out.writeBoolean(true);
  if (postOpDirAttr == null) {
    postOpDirAttr=new Nfs3FileAttributes();
  }
  postOpDirAttr.serialize(out);
  if (getStatus() == Nfs3Status.NFS3_OK) {
    out.writeLongAsHyper(cookieVerf);
    EntryPlus3[] f=dirListPlus.getEntries();
    for (int i=0; i < f.length; i++) {
      out.writeBoolean(true);
      f[i].seralize(out);
    }
    out.writeBoolean(false);
    out.writeBoolean(dirListPlus.getEof());
  }
  return out;
}

Fixed version (ground truth):
@Override public XDR send(XDR out,int xid){
  super.send(out,xid);
  out.writeBoolean(true);
  if (postOpDirAttr == null) {
    postOpDirAttr=new Nfs3FileAttributes();
  }
  postOpDirAttr.serialize(out);
  if (getStatus() == Nfs3Status.NFS3_OK) {
    out.writeLongAsHyper(cookieVerf);
    for (    EntryPlus3 f : dirListPlus.getEntries()) {
      out.writeBoolean(true);
      f.seralize(out);
    }
    out.writeBoolean(false);
    out.writeBoolean(dirListPlus.getEof());
  }
  return out;
}
Program: 57828
Project: 57828
Buggy source:
/** 
 * Instantiates a   {@link ContainerRequest} with the given constraints.
 * @param capability The  {@link Resource} to be requested for each container.
 * @param nodes Any hosts to request that the containers are placed on.
 * @param racks Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
 * @param priority The priority at which to request the containers. Higher priorities have lower numerical values.
 * @param containerCount The number of containers to request.
 * @param relaxLocality If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.
 */
public ContainerRequest(Resource capability,String[] nodes,String[] racks,Priority priority,int containerCount,boolean relaxLocality){
  Preconditions.checkArgument(capability != null,"String_Node_Str" + "String_Node_Str");
  Preconditions.checkArgument(priority != null,"String_Node_Str");
  Preconditions.checkArgument(containerCount > 0,"String_Node_Str");
  Preconditions.checkArgument((!relaxLocality && (racks == null || racks.length == 0) && (nodes == null || nodes.length == 0)),"String_Node_Str" + "String_Node_Str");
  this.capability=capability;
  this.nodes=(nodes != null ? ImmutableList.copyOf(nodes) : null);
  this.racks=(racks != null ? ImmutableList.copyOf(racks) : null);
  this.priority=priority;
  this.containerCount=containerCount;
  this.relaxLocality=relaxLocality;
}

Fixed version (ground truth):
/** 
 * Instantiates a   {@link ContainerRequest} with the given constraints.
 * @param capability The  {@link Resource} to be requested for each container.
 * @param nodes Any hosts to request that the containers are placed on.
 * @param racks Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
 * @param priority The priority at which to request the containers. Higher priorities have lower numerical values.
 * @param containerCount The number of containers to request.
 * @param relaxLocality If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.
 */
public ContainerRequest(Resource capability,String[] nodes,String[] racks,Priority priority,int containerCount,boolean relaxLocality){
  Preconditions.checkArgument(capability != null,"String_Node_Str" + "String_Node_Str");
  Preconditions.checkArgument(priority != null,"String_Node_Str");
  Preconditions.checkArgument(containerCount > 0,"String_Node_Str");
  Preconditions.checkArgument(!(!relaxLocality && (racks == null || racks.length == 0) && (nodes == null || nodes.length == 0)),"String_Node_Str" + "String_Node_Str");
  this.capability=capability;
  this.nodes=(nodes != null ? ImmutableList.copyOf(nodes) : null);
  this.racks=(racks != null ? ImmutableList.copyOf(racks) : null);
  this.priority=priority;
  this.containerCount=containerCount;
  this.relaxLocality=relaxLocality;
}
Program: 57829
Project: 57829
Buggy source:
public MockHistoryContext(int appid,int numJobs,int numTasks,int numAttempts,boolean hasFailedTasks){
  super(appid);
  JobsPair jobs;
  try {
    jobs=MockHistoryJobs.newHistoryJobs(getApplicationID(),numJobs,numTasks,numAttempts,hasFailedTasks);
  }
 catch (  IOException e) {
    throw new YarnException(e);
  }
  partialJobs=jobs.partial;
  fullJobs=jobs.full;
}

Fixed version (ground truth):
public MockHistoryContext(int appid,int numJobs,int numTasks,int numAttempts,boolean hasFailedTasks){
  super(appid);
  JobsPair jobs;
  try {
    jobs=MockHistoryJobs.newHistoryJobs(getApplicationID(),numJobs,numTasks,numAttempts,hasFailedTasks);
  }
 catch (  IOException e) {
    throw new YarnRuntimeException(e);
  }
  partialJobs=jobs.partial;
  fullJobs=jobs.full;
}
Program: 57830
Project: 57830
Buggy source:
@Test public void testRollMasterKey() throws Exception {
  TestDelegationTokenSecretManager dtSecretManager=new TestDelegationTokenSecretManager(800,800,1 * 1000,3600000);
  try {
    dtSecretManager.startThreads();
    Token<TestDelegationTokenIdentifier> token=generateDelegationToken(dtSecretManager,"String_Node_Str","String_Node_Str");
    byte[] oldPasswd=token.getPassword();
    int prevNumKeys=dtSecretManager.getAllKeys().length;
    dtSecretManager.rollMasterKey();
    Assert.assertTrue(dtSecretManager.isStoreNewMasterKeyCalled);
    int currNumKeys=dtSecretManager.getAllKeys().length;
    Assert.assertEquals((currNumKeys - prevNumKeys) >= 1,true);
    ByteArrayInputStream bi=new ByteArrayInputStream(token.getIdentifier());
    TestDelegationTokenIdentifier identifier=dtSecretManager.createIdentifier();
    identifier.readFields(new DataInputStream(bi));
    byte[] newPasswd=dtSecretManager.retrievePassword(identifier);
    Assert.assertEquals(oldPasswd,newPasswd);
    Thread.sleep(2200);
    Assert.assertTrue(dtSecretManager.isRemoveStoredMasterKeyCalled);
  }
  finally {
    dtSecretManager.stopThreads();
  }
}

Fixed version (ground truth):
@Test(timeout=10000) public void testRollMasterKey() throws Exception {
  TestDelegationTokenSecretManager dtSecretManager=new TestDelegationTokenSecretManager(800,800,1 * 1000,3600000);
  try {
    dtSecretManager.startThreads();
    Token<TestDelegationTokenIdentifier> token=generateDelegationToken(dtSecretManager,"String_Node_Str","String_Node_Str");
    byte[] oldPasswd=token.getPassword();
    int prevNumKeys=dtSecretManager.getAllKeys().length;
    dtSecretManager.rollMasterKey();
    Assert.assertTrue(dtSecretManager.isStoreNewMasterKeyCalled);
    int currNumKeys=dtSecretManager.getAllKeys().length;
    Assert.assertEquals((currNumKeys - prevNumKeys) >= 1,true);
    ByteArrayInputStream bi=new ByteArrayInputStream(token.getIdentifier());
    TestDelegationTokenIdentifier identifier=dtSecretManager.createIdentifier();
    identifier.readFields(new DataInputStream(bi));
    byte[] newPasswd=dtSecretManager.retrievePassword(identifier);
    Assert.assertEquals(oldPasswd,newPasswd);
    while (!dtSecretManager.isRemoveStoredMasterKeyCalled) {
      Thread.sleep(200);
    }
  }
  finally {
    dtSecretManager.stopThreads();
  }
}
Program: 57831
Project: 57831
Buggy source:
/** 
 * For use only by tests and initialization
 */
@InterfaceAudience.Private static void setTokenServiceUseIp(boolean flag){
  useIpForTokenService=flag;
  hostResolver=!useIpForTokenService ? new QualifiedHostResolver() : new StandardHostResolver();
}

Fixed version (ground truth):
/** 
 * For use only by tests and initialization
 */
@InterfaceAudience.Private public static void setTokenServiceUseIp(boolean flag){
  useIpForTokenService=flag;
  hostResolver=!useIpForTokenService ? new QualifiedHostResolver() : new StandardHostResolver();
}
Program: 57832
Project: 57832
Buggy source:
@Test public void testFilterFileSystem() throws Exception {
  for (  Method m : FileSystem.class.getDeclaredMethods()) {
    if (Modifier.isStatic(m.getModifiers()))     continue;
    if (Modifier.isPrivate(m.getModifiers()))     continue;
    try {
      DontCheck.class.getMethod(m.getName(),m.getParameterTypes());
      LOG.info("String_Node_Str" + m);
    }
 catch (    NoSuchMethodException exc) {
      LOG.info("String_Node_Str" + m);
      try {
        FilterFileSystem.class.getDeclaredMethod(m.getName(),m.getParameterTypes());
      }
 catch (      NoSuchMethodException exc2) {
        LOG.error("String_Node_Str" + m);
        throw exc2;
      }
    }
  }
}

Fixed version (ground truth):
@Test public void testFilterFileSystem() throws Exception {
  for (  Method m : FileSystem.class.getDeclaredMethods()) {
    if (Modifier.isStatic(m.getModifiers()))     continue;
    if (Modifier.isPrivate(m.getModifiers()))     continue;
    if (Modifier.isFinal(m.getModifiers()))     continue;
    try {
      DontCheck.class.getMethod(m.getName(),m.getParameterTypes());
      LOG.info("String_Node_Str" + m);
    }
 catch (    NoSuchMethodException exc) {
      LOG.info("String_Node_Str" + m);
      try {
        FilterFileSystem.class.getDeclaredMethod(m.getName(),m.getParameterTypes());
      }
 catch (      NoSuchMethodException exc2) {
        LOG.error("String_Node_Str" + m);
        throw exc2;
      }
    }
  }
}
Program: 57835
Project: 57835
Buggy source:
public static DatanodeInfo bestNode(DatanodeInfo[] nodes,boolean doRandom,Configuration conf) throws IOException {
  TreeSet<DatanodeInfo> deadNodes=new TreeSet<DatanodeInfo>();
  DatanodeInfo chosenNode=null;
  int failures=0;
  Socket s=null;
  int index=-1;
  if (nodes == null || nodes.length == 0) {
    throw new IOException("String_Node_Str");
  }
  while (s == null) {
    if (chosenNode == null) {
      do {
        if (doRandom) {
          index=DFSUtil.getRandom().nextInt(nodes.length);
        }
 else {
          index++;
        }
        chosenNode=nodes[index];
      }
 while (deadNodes.contains(chosenNode));
    }
    chosenNode=nodes[index];
    InetSocketAddress targetAddr=NetUtils.createSocketAddr(chosenNode.getInfoAddr());
    try {
      s=NetUtils.getDefaultSocketFactory(conf).createSocket();
      s.connect(targetAddr,HdfsServerConstants.READ_TIMEOUT);
      s.setSoTimeout(HdfsServerConstants.READ_TIMEOUT);
    }
 catch (    IOException e) {
      deadNodes.add(chosenNode);
      s.close();
      s=null;
      failures++;
    }
    if (failures == nodes.length)     throw new IOException("String_Node_Str");
  }
  s.close();
  return chosenNode;
}

Fixed version (ground truth):
public static DatanodeInfo bestNode(DatanodeInfo[] nodes,boolean doRandom,Configuration conf) throws IOException {
  TreeSet<DatanodeInfo> deadNodes=new TreeSet<DatanodeInfo>();
  DatanodeInfo chosenNode=null;
  int failures=0;
  Socket s=null;
  int index=-1;
  if (nodes == null || nodes.length == 0) {
    throw new IOException("String_Node_Str");
  }
  while (s == null) {
    if (chosenNode == null) {
      do {
        if (doRandom) {
          index=DFSUtil.getRandom().nextInt(nodes.length);
        }
 else {
          index++;
        }
        chosenNode=nodes[index];
      }
 while (deadNodes.contains(chosenNode));
    }
    chosenNode=nodes[index];
    InetSocketAddress targetAddr=NetUtils.createSocketAddr(chosenNode.getInfoAddr());
    try {
      s=NetUtils.getDefaultSocketFactory(conf).createSocket();
      s.connect(targetAddr,HdfsServerConstants.READ_TIMEOUT);
      s.setSoTimeout(HdfsServerConstants.READ_TIMEOUT);
    }
 catch (    IOException e) {
      deadNodes.add(chosenNode);
      IOUtils.closeSocket(s);
      s=null;
      failures++;
    }
    if (failures == nodes.length)     throw new IOException("String_Node_Str");
  }
  s.close();
  return chosenNode;
}
Program: 57837
Project: 57837
Buggy source:
/** 
 * Create an object with a data input stream and a checksum input stream. 
 */
public ReplicaInputStreams(InputStream dataIn,InputStream checksumIn){
  this.dataIn=dataIn;
  this.checksumIn=checksumIn;
}

Fixed version (ground truth):
/** 
 * Create an object with a data input stream and a checksum input stream. 
 */
public ReplicaInputStreams(FileDescriptor dataFd,FileDescriptor checksumFd){
  this.dataIn=new FileInputStream(dataFd);
  this.checksumIn=new FileInputStream(checksumFd);
}
Program: 57838
Project: 57838
Buggy source:
/** 
 * Returns handles to the block file and its metadata file
 */
@Override public synchronized ReplicaInputStreams getTmpInputStreams(ExtendedBlock b,long blkOffset,long ckoff) throws IOException {
  ReplicaInfo info=getReplicaInfo(b);
  File blockFile=info.getBlockFile();
  RandomAccessFile blockInFile=new RandomAccessFile(blockFile,"String_Node_Str");
  if (blkOffset > 0) {
    blockInFile.seek(blkOffset);
  }
  File metaFile=info.getMetaFile();
  RandomAccessFile metaInFile=new RandomAccessFile(metaFile,"String_Node_Str");
  if (ckoff > 0) {
    metaInFile.seek(ckoff);
  }
  return new ReplicaInputStreams(new FileInputStream(blockInFile.getFD()),new FileInputStream(metaInFile.getFD()));
}

Fixed version (ground truth):
/** 
 * Returns handles to the block file and its metadata file
 */
@Override public synchronized ReplicaInputStreams getTmpInputStreams(ExtendedBlock b,long blkOffset,long ckoff) throws IOException {
  ReplicaInfo info=getReplicaInfo(b);
  File blockFile=info.getBlockFile();
  RandomAccessFile blockInFile=new RandomAccessFile(blockFile,"String_Node_Str");
  if (blkOffset > 0) {
    blockInFile.seek(blkOffset);
  }
  File metaFile=info.getMetaFile();
  RandomAccessFile metaInFile=new RandomAccessFile(metaFile,"String_Node_Str");
  if (ckoff > 0) {
    metaInFile.seek(ckoff);
  }
  return new ReplicaInputStreams(blockInFile.getFD(),metaInFile.getFD());
}
Program: 57839
Project: 57839
Buggy source:
boolean setSafeMode(SafeModeAction action) throws IOException {
  if (action != SafeModeAction.SAFEMODE_GET) {
    checkSuperuserPrivilege();
switch (action) {
case SAFEMODE_LEAVE:
      leaveSafeMode();
    break;
case SAFEMODE_ENTER:
  enterSafeMode(false);
break;
}
}
return isInSafeMode();
}

Fixed version (ground truth):
boolean setSafeMode(SafeModeAction action) throws IOException {
  if (action != SafeModeAction.SAFEMODE_GET) {
    checkSuperuserPrivilege();
switch (action) {
case SAFEMODE_LEAVE:
      leaveSafeMode();
    break;
case SAFEMODE_ENTER:
  enterSafeMode(false);
break;
default :
LOG.error("String_Node_Str");
}
}
return isInSafeMode();
}
Program: 57840
Project: 57840
Buggy source:
@Override public boolean equals(Object o){
  if (!(o instanceof ReceivedDeletedBlockInfo)) {
    return false;
  }
  ReceivedDeletedBlockInfo other=(ReceivedDeletedBlockInfo)o;
  return this.block.equals(other.getBlock()) && this.status == other.status && (this.delHints == other.delHints || this.delHints != null && this.delHints.equals(other.delHints));
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (!(o instanceof ReceivedDeletedBlockInfo)) {
    return false;
  }
  ReceivedDeletedBlockInfo other=(ReceivedDeletedBlockInfo)o;
  return this.block.equals(other.getBlock()) && this.status == other.status && this.delHints != null && this.delHints.equals(other.delHints);
}
Program: 57841
Project: 57841
Buggy source:
@Override public Long apply(RemoteEditLog log){
  return log.getStartTxId();
}

Fixed version (ground truth):
@Override public Long apply(RemoteEditLog log){
  if (null == log) {
    return HdfsConstants.INVALID_TXID;
  }
  return log.getStartTxId();
}
Program: 57842
Project: 57842
Buggy source:
/** 
 * get single value by key
 */
public String getValue(String key) throws Exception {
  Object val=null;
  for (  ObjectName oname : hadoopObjectNames) {
    try {
      val=mbsc.getAttribute(oname,key);
    }
 catch (    AttributeNotFoundException anfe) {
      continue;
    }
catch (    ReflectionException re) {
      if (re.getCause() instanceof NoSuchMethodException) {
        continue;
      }
    }
    err("String_Node_Str" + key + "String_Node_Str"+ val.getClass()+ "String_Node_Str"+ val);
    break;
  }
  return (val == null) ? "String_Node_Str" : val.toString();
}

Fixed version (ground truth):
/** 
 * get single value by key
 */
public String getValue(String key) throws Exception {
  Object val=null;
  for (  ObjectName oname : hadoopObjectNames) {
    try {
      val=mbsc.getAttribute(oname,key);
    }
 catch (    AttributeNotFoundException anfe) {
      continue;
    }
catch (    ReflectionException re) {
      if (re.getCause() instanceof NoSuchMethodException) {
        continue;
      }
    }
    err("String_Node_Str" + key + "String_Node_Str"+ (val == null ? "String_Node_Str" : val.getClass())+ "String_Node_Str"+ val);
    break;
  }
  return (val == null) ? "String_Node_Str" : val.toString();
}
Program: 57843
Project: 57843
Buggy source:
private long doCopy(FileStatus sourceFileStatus,Path target,Mapper.Context context,EnumSet<FileAttribute> fileAttributes) throws IOException {
  Path tmpTargetPath=getTmpFile(target,context);
  final Configuration configuration=context.getConfiguration();
  FileSystem targetFS=target.getFileSystem(configuration);
  try {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + sourceFileStatus.getPath() + "String_Node_Str"+ target);
      LOG.debug("String_Node_Str" + tmpTargetPath);
    }
    FileSystem sourceFS=sourceFileStatus.getPath().getFileSystem(configuration);
    long bytesRead=copyToTmpFile(tmpTargetPath,targetFS,sourceFileStatus,context,fileAttributes);
    compareFileLengths(sourceFileStatus,tmpTargetPath,configuration,bytesRead);
    if (bytesRead != 0)     compareCheckSums(sourceFS,sourceFileStatus.getPath(),targetFS,tmpTargetPath);
    promoteTmpToTarget(tmpTargetPath,target,targetFS);
    return bytesRead;
  }
  finally {
    if (targetFS.exists(tmpTargetPath))     targetFS.delete(tmpTargetPath,false);
  }
}

Fixed version (ground truth):
private long doCopy(FileStatus sourceFileStatus,Path target,Mapper.Context context,EnumSet<FileAttribute> fileAttributes) throws IOException {
  Path tmpTargetPath=getTmpFile(target,context);
  final Configuration configuration=context.getConfiguration();
  FileSystem targetFS=target.getFileSystem(configuration);
  try {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + sourceFileStatus.getPath() + "String_Node_Str"+ target);
      LOG.debug("String_Node_Str" + tmpTargetPath);
    }
    FileSystem sourceFS=sourceFileStatus.getPath().getFileSystem(configuration);
    long bytesRead=copyToTmpFile(tmpTargetPath,targetFS,sourceFileStatus,context,fileAttributes);
    compareFileLengths(sourceFileStatus,tmpTargetPath,configuration,bytesRead);
    if (bytesRead != 0) {
      compareCheckSums(sourceFS,sourceFileStatus.getPath(),targetFS,tmpTargetPath);
    }
    promoteTmpToTarget(tmpTargetPath,target,targetFS);
    return bytesRead;
  }
  finally {
    if (targetFS.exists(tmpTargetPath))     targetFS.delete(tmpTargetPath,false);
  }
}
Program: 57844
Project: 57844
Buggy source:
/** 
 * Get block location info about file getBlockLocations() returns a list of hostnames that store  data for a specific file region.  It returns a set of hostnames for every block within the indicated region. This function is very useful when writing code that considers data-placement when performing operations.  For example, the MapReduce system tries to schedule tasks on the same machines as the data-block the task processes. 
 */
public BlockLocation[] getBlockLocations(String src,long start,long length) throws IOException, UnresolvedLinkException {
  LocatedBlocks blocks=callGetBlockLocations(namenode,src,start,length);
  return DFSUtil.locatedBlocks2Locations(blocks);
}

Fixed version (ground truth):
/** 
 * Get block location info about file getBlockLocations() returns a list of hostnames that store  data for a specific file region.  It returns a set of hostnames for every block within the indicated region. This function is very useful when writing code that considers data-placement when performing operations.  For example, the MapReduce system tries to schedule tasks on the same machines as the data-block the task processes. 
 */
public BlockLocation[] getBlockLocations(String src,long start,long length) throws IOException, UnresolvedLinkException {
  LocatedBlocks blocks=getLocatedBlocks(src,start,length);
  return DFSUtil.locatedBlocks2Locations(blocks);
}
Program: 57845
Project: 57845
Buggy source:
/** 
 * Fetch a block from namenode and cache it 
 */
private synchronized void fetchBlockAt(long offset) throws IOException {
  int targetBlockIdx=locatedBlocks.findBlock(offset);
  if (targetBlockIdx < 0) {
    targetBlockIdx=LocatedBlocks.getInsertIndex(targetBlockIdx);
  }
  LocatedBlocks newBlocks;
  newBlocks=DFSClient.callGetBlockLocations(dfsClient.namenode,src,offset,prefetchSize);
  if (newBlocks == null) {
    throw new IOException("String_Node_Str" + offset);
  }
  locatedBlocks.insertRange(targetBlockIdx,newBlocks.getLocatedBlocks());
}

Fixed version (ground truth):
/** 
 * Fetch a block from namenode and cache it 
 */
private synchronized void fetchBlockAt(long offset) throws IOException {
  int targetBlockIdx=locatedBlocks.findBlock(offset);
  if (targetBlockIdx < 0) {
    targetBlockIdx=LocatedBlocks.getInsertIndex(targetBlockIdx);
  }
  LocatedBlocks newBlocks;
  newBlocks=dfsClient.getLocatedBlocks(src,offset,prefetchSize);
  if (newBlocks == null) {
    throw new IOException("String_Node_Str" + offset);
  }
  locatedBlocks.insertRange(targetBlockIdx,newBlocks.getLocatedBlocks());
}
Program: 57846
Project: 57846
Buggy source:
private long fetchLocatedBlocksAndGetLastBlockLength() throws IOException {
  LocatedBlocks newInfo=DFSClient.callGetBlockLocations(dfsClient.namenode,src,0,prefetchSize);
  if (DFSClient.LOG.isDebugEnabled()) {
    DFSClient.LOG.debug("String_Node_Str" + newInfo);
  }
  if (newInfo == null) {
    throw new IOException("String_Node_Str" + src);
  }
  if (locatedBlocks != null) {
    Iterator<LocatedBlock> oldIter=locatedBlocks.getLocatedBlocks().iterator();
    Iterator<LocatedBlock> newIter=newInfo.getLocatedBlocks().iterator();
    while (oldIter.hasNext() && newIter.hasNext()) {
      if (!oldIter.next().getBlock().equals(newIter.next().getBlock())) {
        throw new IOException("String_Node_Str" + src + "String_Node_Str");
      }
    }
  }
  locatedBlocks=newInfo;
  long lastBlockBeingWrittenLength=0;
  if (!locatedBlocks.isLastBlockComplete()) {
    final LocatedBlock last=locatedBlocks.getLastLocatedBlock();
    if (last != null) {
      if (last.getLocations().length == 0) {
        return -1;
      }
      final long len=readBlockLength(last);
      last.getBlock().setNumBytes(len);
      lastBlockBeingWrittenLength=len;
    }
  }
  currentNode=null;
  return lastBlockBeingWrittenLength;
}

Fixed version (ground truth):
private long fetchLocatedBlocksAndGetLastBlockLength() throws IOException {
  LocatedBlocks newInfo=dfsClient.getLocatedBlocks(src,0,prefetchSize);
  if (DFSClient.LOG.isDebugEnabled()) {
    DFSClient.LOG.debug("String_Node_Str" + newInfo);
  }
  if (newInfo == null) {
    throw new IOException("String_Node_Str" + src);
  }
  if (locatedBlocks != null) {
    Iterator<LocatedBlock> oldIter=locatedBlocks.getLocatedBlocks().iterator();
    Iterator<LocatedBlock> newIter=newInfo.getLocatedBlocks().iterator();
    while (oldIter.hasNext() && newIter.hasNext()) {
      if (!oldIter.next().getBlock().equals(newIter.next().getBlock())) {
        throw new IOException("String_Node_Str" + src + "String_Node_Str");
      }
    }
  }
  locatedBlocks=newInfo;
  long lastBlockBeingWrittenLength=0;
  if (!locatedBlocks.isLastBlockComplete()) {
    final LocatedBlock last=locatedBlocks.getLastLocatedBlock();
    if (last != null) {
      if (last.getLocations().length == 0) {
        return -1;
      }
      final long len=readBlockLength(last);
      last.getBlock().setNumBytes(len);
      lastBlockBeingWrittenLength=len;
    }
  }
  currentNode=null;
  return lastBlockBeingWrittenLength;
}
Program: 57847
Project: 57847
Buggy source:
/** 
 * Given the configuration for this node, return a Configuration object for the other node in an HA setup.
 * @param myConf the configuration of this node
 * @return the configuration of the other node in an HA setup
 */
public static Configuration getConfForOtherNode(Configuration myConf){
}

Fixed version (ground truth):
/** 
 * Given the configuration for this node, return a Configuration object for the other node in an HA setup.
 * @param myConf the configuration of this node
 * @return the configuration of the other node in an HA setup
 */
public static Configuration getConfForOtherNode(Configuration myConf){
  String nsId=DFSUtil.getNamenodeNameServiceId(myConf);
  String otherNn=getNameNodeIdOfOtherNode(myConf,nsId);
  Configuration confForOtherNode=new Configuration(myConf);
  NameNode.initializeGenericKeys(confForOtherNode,nsId,otherNn);
  return confForOtherNode;
}
Program: 57848
Project: 57848
Buggy source:
/** 
 * Initialize block keys 
 */
private synchronized void generateKeys(){
  if (!isMaster)   return;
  serialNo++;
  currentKey=new BlockKey(serialNo,System.currentTimeMillis() + 2 * keyUpdateInterval + tokenLifetime,generateSecret());
  serialNo++;
  nextKey=new BlockKey(serialNo,System.currentTimeMillis() + 3 * keyUpdateInterval + tokenLifetime,generateSecret());
  allKeys.put(currentKey.getKeyId(),currentKey);
  allKeys.put(nextKey.getKeyId(),nextKey);
}

Fixed version (ground truth):
/** 
 * Initialize block keys 
 */
private synchronized void generateKeys(){
  if (!isMaster)   return;
  setSerialNo(serialNo + 1);
  currentKey=new BlockKey(serialNo,System.currentTimeMillis() + 2 * keyUpdateInterval + tokenLifetime,generateSecret());
  setSerialNo(serialNo + 1);
  nextKey=new BlockKey(serialNo,System.currentTimeMillis() + 3 * keyUpdateInterval + tokenLifetime,generateSecret());
  allKeys.put(currentKey.getKeyId(),currentKey);
  allKeys.put(nextKey.getKeyId(),nextKey);
}
Program: 57849
Project: 57849
Buggy source:
/** 
 * Update block keys, only to be used in master mode
 */
synchronized boolean updateKeys() throws IOException {
  if (!isMaster)   return false;
  LOG.info("String_Node_Str");
  removeExpiredKeys();
  allKeys.put(currentKey.getKeyId(),new BlockKey(currentKey.getKeyId(),System.currentTimeMillis() + keyUpdateInterval + tokenLifetime,currentKey.getKey()));
  currentKey=new BlockKey(nextKey.getKeyId(),System.currentTimeMillis() + 2 * keyUpdateInterval + tokenLifetime,nextKey.getKey());
  allKeys.put(currentKey.getKeyId(),currentKey);
  serialNo++;
  nextKey=new BlockKey(serialNo,System.currentTimeMillis() + 3 * keyUpdateInterval + tokenLifetime,generateSecret());
  allKeys.put(nextKey.getKeyId(),nextKey);
  return true;
}

Fixed version (ground truth):
/** 
 * Update block keys, only to be used in master mode
 */
synchronized boolean updateKeys() throws IOException {
  if (!isMaster)   return false;
  LOG.info("String_Node_Str");
  removeExpiredKeys();
  allKeys.put(currentKey.getKeyId(),new BlockKey(currentKey.getKeyId(),System.currentTimeMillis() + keyUpdateInterval + tokenLifetime,currentKey.getKey()));
  currentKey=new BlockKey(nextKey.getKeyId(),System.currentTimeMillis() + 2 * keyUpdateInterval + tokenLifetime,nextKey.getKey());
  allKeys.put(currentKey.getKeyId(),currentKey);
  setSerialNo(serialNo + 1);
  nextKey=new BlockKey(serialNo,System.currentTimeMillis() + 3 * keyUpdateInterval + tokenLifetime,generateSecret());
  allKeys.put(nextKey.getKeyId(),nextKey);
  return true;
}
Program: 57850
Project: 57850
Buggy source:
/** 
 * Constructor
 * @param isMaster
 * @param keyUpdateInterval
 * @param tokenLifetime
 * @throws IOException
 */
public BlockTokenSecretManager(boolean isMaster,long keyUpdateInterval,long tokenLifetime) throws IOException {
  this.isMaster=isMaster;
  this.keyUpdateInterval=keyUpdateInterval;
  this.tokenLifetime=tokenLifetime;
  this.allKeys=new HashMap<Integer,BlockKey>();
  generateKeys();
}

Fixed version (ground truth):
private BlockTokenSecretManager(boolean isMaster,long keyUpdateInterval,long tokenLifetime){
  this.isMaster=isMaster;
  this.keyUpdateInterval=keyUpdateInterval;
  this.tokenLifetime=tokenLifetime;
  this.allKeys=new HashMap<Integer,BlockKey>();
}
Program: 57851
Project: 57851
Buggy source:
NameNodeConnector(URI nameNodeUri,Configuration conf) throws IOException {
  this.nameNodeUri=nameNodeUri;
  this.namenode=NameNodeProxies.createProxy(conf,nameNodeUri,NamenodeProtocol.class).getProxy();
  this.client=NameNodeProxies.createProxy(conf,nameNodeUri,ClientProtocol.class).getProxy();
  this.fs=FileSystem.get(nameNodeUri,conf);
  final NamespaceInfo namespaceinfo=namenode.versionRequest();
  this.blockpoolID=namespaceinfo.getBlockPoolID();
  final ExportedBlockKeys keys=namenode.getBlockKeys();
  this.isBlockTokenEnabled=keys.isBlockTokenEnabled();
  if (isBlockTokenEnabled) {
    long blockKeyUpdateInterval=keys.getKeyUpdateInterval();
    long blockTokenLifetime=keys.getTokenLifetime();
    LOG.info("String_Node_Str" + blockKeyUpdateInterval / (60 * 1000) + "String_Node_Str" + blockTokenLifetime / (60 * 1000) + "String_Node_Str");
    this.blockTokenSecretManager=new BlockTokenSecretManager(false,blockKeyUpdateInterval,blockTokenLifetime);
    this.blockTokenSecretManager.setKeys(keys);
    this.keyUpdaterInterval=blockKeyUpdateInterval / 4;
    LOG.info("String_Node_Str" + keyUpdaterInterval / (60 * 1000) + "String_Node_Str");
    this.keyupdaterthread=new Daemon(new BlockKeyUpdater());
    this.shouldRun=true;
    this.keyupdaterthread.start();
  }
  out=checkAndMarkRunningBalancer();
  if (out == null) {
    throw new IOException("String_Node_Str");
  }
}

Fixed version (ground truth):
NameNodeConnector(URI nameNodeUri,Configuration conf) throws IOException {
  this.nameNodeUri=nameNodeUri;
  this.namenode=NameNodeProxies.createProxy(conf,nameNodeUri,NamenodeProtocol.class).getProxy();
  this.client=NameNodeProxies.createProxy(conf,nameNodeUri,ClientProtocol.class).getProxy();
  this.fs=FileSystem.get(nameNodeUri,conf);
  final NamespaceInfo namespaceinfo=namenode.versionRequest();
  this.blockpoolID=namespaceinfo.getBlockPoolID();
  final ExportedBlockKeys keys=namenode.getBlockKeys();
  this.isBlockTokenEnabled=keys.isBlockTokenEnabled();
  if (isBlockTokenEnabled) {
    long blockKeyUpdateInterval=keys.getKeyUpdateInterval();
    long blockTokenLifetime=keys.getTokenLifetime();
    LOG.info("String_Node_Str" + blockKeyUpdateInterval / (60 * 1000) + "String_Node_Str" + blockTokenLifetime / (60 * 1000) + "String_Node_Str");
    this.blockTokenSecretManager=new BlockTokenSecretManager(blockKeyUpdateInterval,blockTokenLifetime);
    this.blockTokenSecretManager.addKeys(keys);
    this.keyUpdaterInterval=blockKeyUpdateInterval / 4;
    LOG.info("String_Node_Str" + keyUpdaterInterval / (60 * 1000) + "String_Node_Str");
    this.keyupdaterthread=new Daemon(new BlockKeyUpdater());
    this.shouldRun=true;
    this.keyupdaterthread.start();
  }
  out=checkAndMarkRunningBalancer();
  if (out == null) {
    throw new IOException("String_Node_Str");
  }
}
Program: 57852
Project: 57852
Buggy source:
public void run(){
  try {
    while (shouldRun) {
      try {
        blockTokenSecretManager.setKeys(namenode.getBlockKeys());
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
      Thread.sleep(keyUpdaterInterval);
    }
  }
 catch (  InterruptedException e) {
    LOG.debug("String_Node_Str",e);
  }
catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
    shouldRun=false;
  }
}

Fixed version (ground truth):
public void run(){
  try {
    while (shouldRun) {
      try {
        blockTokenSecretManager.addKeys(namenode.getBlockKeys());
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e);
      }
      Thread.sleep(keyUpdaterInterval);
    }
  }
 catch (  InterruptedException e) {
    LOG.debug("String_Node_Str",e);
  }
catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
    shouldRun=false;
  }
}
Program: 57853
Project: 57853
Buggy source:
private static BlockTokenSecretManager createBlockTokenSecretManager(final Configuration conf) throws IOException {
  final boolean isEnabled=conf.getBoolean(DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_ENABLE_KEY,DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_ENABLE_DEFAULT);
  LOG.info(DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_ENABLE_KEY + "String_Node_Str" + isEnabled);
  if (!isEnabled) {
    return null;
  }
  final long updateMin=conf.getLong(DFSConfigKeys.DFS_BLOCK_ACCESS_KEY_UPDATE_INTERVAL_KEY,DFSConfigKeys.DFS_BLOCK_ACCESS_KEY_UPDATE_INTERVAL_DEFAULT);
  final long lifetimeMin=conf.getLong(DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_KEY,DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_DEFAULT);
  LOG.info(DFSConfigKeys.DFS_BLOCK_ACCESS_KEY_UPDATE_INTERVAL_KEY + "String_Node_Str" + updateMin+ "String_Node_Str"+ DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_KEY+ "String_Node_Str"+ lifetimeMin+ "String_Node_Str");
  return new BlockTokenSecretManager(true,updateMin * 60 * 1000L,lifetimeMin * 60 * 1000L);
}

Fixed version (ground truth):
private static BlockTokenSecretManager createBlockTokenSecretManager(final Configuration conf) throws IOException {
  final boolean isEnabled=conf.getBoolean(DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_ENABLE_KEY,DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_ENABLE_DEFAULT);
  LOG.info(DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_ENABLE_KEY + "String_Node_Str" + isEnabled);
  if (!isEnabled) {
    return null;
  }
  final long updateMin=conf.getLong(DFSConfigKeys.DFS_BLOCK_ACCESS_KEY_UPDATE_INTERVAL_KEY,DFSConfigKeys.DFS_BLOCK_ACCESS_KEY_UPDATE_INTERVAL_DEFAULT);
  final long lifetimeMin=conf.getLong(DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_KEY,DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_DEFAULT);
  LOG.info(DFSConfigKeys.DFS_BLOCK_ACCESS_KEY_UPDATE_INTERVAL_KEY + "String_Node_Str" + updateMin+ "String_Node_Str"+ DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_LIFETIME_KEY+ "String_Node_Str"+ lifetimeMin+ "String_Node_Str");
  String nsId=DFSUtil.getNamenodeNameServiceId(conf);
  boolean isHaEnabled=HAUtil.isHAEnabled(conf,nsId);
  if (isHaEnabled) {
    String thisNnId=HAUtil.getNameNodeId(conf,nsId);
    String otherNnId=HAUtil.getNameNodeIdOfOtherNode(conf,nsId);
    return new BlockTokenSecretManager(updateMin * 60 * 1000L,lifetimeMin * 60 * 1000L,thisNnId.compareTo(otherNnId) < 0 ? 0 : 1);
  }
 else {
    return new BlockTokenSecretManager(updateMin * 60 * 1000L,lifetimeMin * 60 * 1000L,0);
  }
}
Program: 57854
Project: 57854
Buggy source:
/** 
 * get the BlockTokenSecretManager 
 */
BlockTokenSecretManager getBlockTokenSecretManager(){
  return blockTokenSecretManager;
}

Fixed version (ground truth):
/** 
 * get the BlockTokenSecretManager 
 */
@VisibleForTesting public BlockTokenSecretManager getBlockTokenSecretManager(){
  return blockTokenSecretManager;
}
Program: 57855
Project: 57855
Buggy source:
private void transitionOtherNNActive() throws AccessControlException, ServiceFailedException, IOException {
  LOG.info("String_Node_Str");
  createHAProtocolProxy().transitionToActive();
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
private void transitionOtherNNActive() throws AccessControlException, ServiceFailedException, IOException {
  LOG.info("String_Node_Str");
  createHAProtocolProxy().transitionToActive(new StateChangeRequestInfo(RequestSource.REQUEST_BY_USER));
  LOG.info("String_Node_Str");
}