Program: 17270
Project: 17270
Buggy source:
private InputAttemptIdentifier[] copyMapOutput(MapHost host,DataInputStream input){
  MapOutput mapOutput=null;
  InputAttemptIdentifier srcAttemptId=null;
  long decompressedLength=-1;
  long compressedLength=-1;
  try {
    long startTime=System.currentTimeMillis();
    int forReduce=-1;
    try {
      ShuffleHeader header=new ShuffleHeader();
      header.readFields(input);
      if (!header.mapId.startsWith(InputAttemptIdentifier.PATH_PREFIX)) {
        throw new IllegalArgumentException("String_Node_Str" + header.mapId + "String_Node_Str"+ header.forReduce);
      }
      srcAttemptId=scheduler.getIdentifierForFetchedOutput(header.mapId,header.forReduce);
      compressedLength=header.compressedLength;
      decompressedLength=header.uncompressedLength;
      forReduce=header.forReduce;
    }
 catch (    IllegalArgumentException e) {
      badIdErrs.increment(1);
      LOG.warn("String_Node_Str",e);
      return new InputAttemptIdentifier[]{srcAttemptId=getNextRemainingAttempt()};
    }
    if (!verifySanity(compressedLength,decompressedLength,forReduce,remaining,srcAttemptId)) {
      if (srcAttemptId == null) {
        LOG.warn("String_Node_Str" + getNextRemainingAttempt() + "String_Node_Str");
        srcAttemptId=getNextRemainingAttempt();
      }
      assert(srcAttemptId != null);
      return new InputAttemptIdentifier[]{srcAttemptId};
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + srcAttemptId + "String_Node_Str"+ compressedLength+ "String_Node_Str"+ decompressedLength);
    }
    mapOutput=merger.reserve(srcAttemptId,decompressedLength,id);
    if (mapOutput.getType() == Type.WAIT) {
      LOG.info("String_Node_Str" + id + "String_Node_Str");
      return EMPTY_ATTEMPT_ID_ARRAY;
    }
    LOG.info("String_Node_Str" + id + "String_Node_Str"+ mapOutput.getAttemptIdentifier()+ "String_Node_Str"+ decompressedLength+ "String_Node_Str"+ compressedLength+ "String_Node_Str"+ mapOutput.getType());
    if (mapOutput.getType() == Type.MEMORY) {
      shuffleToMemory(host,mapOutput,input,(int)decompressedLength,(int)compressedLength);
    }
 else {
      shuffleToDisk(host,mapOutput,input,compressedLength);
    }
    long endTime=System.currentTimeMillis();
    scheduler.copySucceeded(srcAttemptId,host,compressedLength,decompressedLength,endTime - startTime,mapOutput);
    remaining.remove(srcAttemptId);
    metrics.successFetch();
    return null;
  }
 catch (  IOException ioe) {
    ioErrs.increment(1);
    if (srcAttemptId == null || mapOutput == null) {
      LOG.info("String_Node_Str" + id + "String_Node_Str"+ srcAttemptId+ "String_Node_Str"+ decompressedLength+ "String_Node_Str"+ compressedLength,ioe);
      if (srcAttemptId == null) {
        return remaining.toArray(new InputAttemptIdentifier[remaining.size()]);
      }
 else {
        return new InputAttemptIdentifier[]{srcAttemptId};
      }
    }
    LOG.warn("String_Node_Str" + srcAttemptId + "String_Node_Str"+ host.getHostName(),ioe);
    mapOutput.abort();
    metrics.failedFetch();
    return new InputAttemptIdentifier[]{srcAttemptId};
  }
}

Fixed version (ground truth):
private InputAttemptIdentifier[] copyMapOutput(MapHost host,DataInputStream input){
  MapOutput mapOutput=null;
  InputAttemptIdentifier srcAttemptId=null;
  long decompressedLength=-1;
  long compressedLength=-1;
  try {
    long startTime=System.currentTimeMillis();
    int forReduce=-1;
    try {
      ShuffleHeader header=new ShuffleHeader();
      header.readFields(input);
      if (!header.mapId.startsWith(InputAttemptIdentifier.PATH_PREFIX)) {
        throw new IllegalArgumentException("String_Node_Str" + header.mapId + "String_Node_Str"+ header.forReduce);
      }
      srcAttemptId=scheduler.getIdentifierForFetchedOutput(header.mapId,header.forReduce);
      compressedLength=header.compressedLength;
      decompressedLength=header.uncompressedLength;
      forReduce=header.forReduce;
    }
 catch (    IllegalArgumentException e) {
      badIdErrs.increment(1);
      LOG.warn("String_Node_Str",e);
      return new InputAttemptIdentifier[]{getNextRemainingAttempt()};
    }
    if (!verifySanity(compressedLength,decompressedLength,forReduce,remaining,srcAttemptId)) {
      if (srcAttemptId == null) {
        LOG.warn("String_Node_Str" + getNextRemainingAttempt() + "String_Node_Str");
        srcAttemptId=getNextRemainingAttempt();
      }
      assert(srcAttemptId != null);
      return new InputAttemptIdentifier[]{srcAttemptId};
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + srcAttemptId + "String_Node_Str"+ compressedLength+ "String_Node_Str"+ decompressedLength);
    }
    mapOutput=merger.reserve(srcAttemptId,decompressedLength,id);
    if (mapOutput.getType() == Type.WAIT) {
      LOG.info("String_Node_Str" + id + "String_Node_Str");
      return EMPTY_ATTEMPT_ID_ARRAY;
    }
    LOG.info("String_Node_Str" + id + "String_Node_Str"+ mapOutput.getAttemptIdentifier()+ "String_Node_Str"+ decompressedLength+ "String_Node_Str"+ compressedLength+ "String_Node_Str"+ mapOutput.getType());
    if (mapOutput.getType() == Type.MEMORY) {
      shuffleToMemory(host,mapOutput,input,(int)decompressedLength,(int)compressedLength);
    }
 else {
      shuffleToDisk(host,mapOutput,input,compressedLength);
    }
    long endTime=System.currentTimeMillis();
    scheduler.copySucceeded(srcAttemptId,host,compressedLength,decompressedLength,endTime - startTime,mapOutput);
    remaining.remove(srcAttemptId);
    metrics.successFetch();
    return null;
  }
 catch (  IOException ioe) {
    ioErrs.increment(1);
    if (srcAttemptId == null || mapOutput == null) {
      LOG.info("String_Node_Str" + id + "String_Node_Str"+ srcAttemptId+ "String_Node_Str"+ decompressedLength+ "String_Node_Str"+ compressedLength,ioe);
      if (srcAttemptId == null) {
        return remaining.toArray(new InputAttemptIdentifier[remaining.size()]);
      }
 else {
        return new InputAttemptIdentifier[]{srcAttemptId};
      }
    }
    LOG.warn("String_Node_Str" + srcAttemptId + "String_Node_Str"+ host.getHostName(),ioe);
    mapOutput.abort();
    metrics.failedFetch();
    return new InputAttemptIdentifier[]{srcAttemptId};
  }
}