Program: 11844
Project: 11844
Buggy source:
/** 
 * Pass in a chunk to load its data from file
 */
public TridentChunk loadChunkData(TridentChunk chunk) throws NBTException, IOException, DataFormatException {
  short compression;
  byte[] compressedData;
synchronized (this.readWriteLock) {
    RandomAccessFile access=new RandomAccessFile(this.path.toFile(),"String_Node_Str");
    access.seek((long)this.sectors.timeStampLoc(chunk));
    int lastUpdate=access.readInt();
    if (chunk.lastFileAccess() > lastUpdate) {
      chunk.setLastFileAccess((int)(System.currentTimeMillis() / 1000L));
      access.close();
      return chunk;
    }
 else {
      chunk.setLastFileAccess((int)(System.currentTimeMillis() / 1000L));
    }
    long dataLoc=(long)this.sectors.dataLoc(chunk);
    access.seek(dataLoc);
    int length=access.readInt();
    compression=(short)access.readByte();
    compressedData=new byte[length - 1];
    access.readFully(compressedData);
    access.close();
  }
  byte[] chunkData;
switch (compression) {
case 0:
case 1:
    GZIPInputStream in=new GZIPInputStream(new ByteArrayInputStream(compressedData));
  chunkData=new byte[in.available()];
in.read(chunkData);
in.close();
break;
case 2:
Inflater inflater=new Inflater();
ByteArrayOutputStream output=new ByteArrayOutputStream();
InflaterOutputStream outputStream=new InflaterOutputStream(output,inflater);
inflater.setInput(compressedData);
while (!(inflater.finished())) {
outputStream.write(buffer);
}
output.close();
chunkData=output.toByteArray();
inflater.end();
break;
default :
TridentLogger.error(new IllegalStateException("String_Node_Str"));
return null;
}
CompoundTag nbtData=new NBTDecoder(new DataInputStream(new ByteArrayInputStream(chunkData))).decode();
chunk.load(nbtData);
return chunk;
}

Fixed version (ground truth):
/** 
 * Pass in a chunk to load its data from file
 */
public TridentChunk loadChunkData(TridentChunk chunk) throws NBTException, IOException, DataFormatException {
  short compression;
  byte[] compressedData;
synchronized (this.readWriteLock) {
    RandomAccessFile access=new RandomAccessFile(this.path.toFile(),"String_Node_Str");
    access.seek((long)this.sectors.timeStampLoc(chunk));
    int lastUpdate=access.readInt();
    if (chunk.lastFileAccess() > lastUpdate) {
      chunk.setLastFileAccess((int)(System.currentTimeMillis() / 1000L));
      access.close();
      return chunk;
    }
 else {
      chunk.setLastFileAccess((int)(System.currentTimeMillis() / 1000L));
    }
    long dataLoc=(long)this.sectors.dataLoc(chunk);
    access.seek(dataLoc);
    int length=access.readInt();
    compression=(short)access.readByte();
    if (length <= 0) {
      return null;
    }
    compressedData=new byte[length - 1];
    access.readFully(compressedData);
    access.close();
  }
  byte[] chunkData;
switch (compression) {
case 0:
case 1:
    GZIPInputStream in=new GZIPInputStream(new ByteArrayInputStream(compressedData));
  chunkData=new byte[in.available()];
in.read(chunkData);
in.close();
break;
case 2:
Inflater inflater=new Inflater();
ByteArrayOutputStream output=new ByteArrayOutputStream();
InflaterOutputStream outputStream=new InflaterOutputStream(output,inflater);
inflater.setInput(compressedData);
while (!(inflater.finished())) {
outputStream.write(buffer);
}
output.close();
chunkData=output.toByteArray();
inflater.end();
break;
default :
TridentLogger.error(new IllegalStateException("String_Node_Str"));
return null;
}
CompoundTag nbtData=new NBTDecoder(new DataInputStream(new ByteArrayInputStream(chunkData))).decode();
chunk.load(nbtData);
return chunk;
}