Program: 11836
Project: 11836
Buggy source:
/** 
 * Pass in a chunk to load its data from file
 */
public TridentChunk loadChunkData(TridentWorld owner,ChunkLocation location) throws NBTException, IOException, DataFormatException {
  TridentChunk chunk=new TridentChunk(owner,location);
  short compression;
  byte[] compressedData;
synchronized (this.readWriteLock) {
    RandomAccessFile access=new RandomAccessFile(this.path.toFile(),"String_Node_Str");
    access.seek((long)this.sectors.getTimeStampLocation(chunk));
    int lastUpdate=access.readInt();
    if (chunk.getLastFileAccess() > lastUpdate) {
      chunk.setLastFileAccess((int)(System.currentTimeMillis() / 1000L));
      access.close();
      return chunk;
    }
 else {
      chunk.setLastFileAccess((int)(System.currentTimeMillis() / 1000L));
    }
    access.seek((long)this.sectors.getDataLocation(chunk));
    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.getTimeStampLocation(chunk));
    int lastUpdate=access.readInt();
    if (chunk.getLastFileAccess() > lastUpdate) {
      chunk.setLastFileAccess((int)(System.currentTimeMillis() / 1000L));
      access.close();
      return chunk;
    }
 else {
      chunk.setLastFileAccess((int)(System.currentTimeMillis() / 1000L));
    }
    long dataLoc=(long)this.sectors.getDataLocation(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;
}