Program: 19992
Project: 19992
Buggy source:
/** 
 * Loads the language model from the given location. 
 * @param location the location of the language model
 */
private void loadBinary(String location) throws IOException {
  boolean bigEndian=true;
  DataInputStream stream=new DataInputStream(new BufferedInputStream(new FileInputStream(location)));
  int headerLength=stream.readInt();
  bytesRead+=4;
  if (headerLength != (DARPA_LM_HEADER.length() + 1)) {
    headerLength=Utilities.swapInteger(headerLength);
    if (headerLength == (DARPA_LM_HEADER.length() + 1)) {
      bigEndian=false;
    }
 else {
      throw new Error("String_Node_Str" + headerLength + "String_Node_Str");
    }
  }
  String header=readString(stream,headerLength - 1);
  stream.readByte();
  if (!header.equals(DARPA_LM_HEADER)) {
    throw new Error("String_Node_Str" + header);
  }
  int fileNameLength=readInt(stream,bigEndian);
  for (int i=0; i < fileNameLength; i++) {
    stream.readByte();
  }
  numberUnigrams=0;
  int logBigramSegmentSize=LOG2_BIGRAM_SEGMENT_SIZE_DEFAULT;
  int version=readInt(stream,bigEndian);
  System.out.println("String_Node_Str" + version);
  if (version <= 0) {
    readInt(stream,bigEndian);
    int formatLength;
    for (; ; ) {
      if ((formatLength=readInt(stream,bigEndian)) == 0) {
        break;
      }
      for (int i=0; i < formatLength; i++) {
        stream.readByte();
        bytesRead++;
      }
    }
    if (version <= -2) {
      logBigramSegmentSize=readInt(stream,bigEndian);
      if (logBigramSegmentSize < 1 || logBigramSegmentSize > 15) {
        throw new Error("String_Node_Str");
      }
    }
    numberUnigrams=readInt(stream,bigEndian);
  }
 else {
    numberUnigrams=version;
  }
  int bigramSegmentSize=1 << logBigramSegmentSize;
  if (numberUnigrams <= 0) {
    throw new Error("String_Node_Str" + numberUnigrams + "String_Node_Str");
  }
  System.out.println("String_Node_Str" + numberUnigrams);
  numberBigrams=readInt(stream,bigEndian);
  if (numberBigrams < 0) {
    throw new Error("String_Node_Str" + numberBigrams);
  }
  System.out.println("String_Node_Str" + numberBigrams);
  numberTrigrams=readInt(stream,bigEndian);
  if (numberTrigrams < 0) {
    throw new Error("String_Node_Str" + numberTrigrams);
  }
  System.out.println("String_Node_Str" + numberTrigrams);
  unigrams=readUnigrams(stream,numberUnigrams + 1,bigEndian);
  if (numberBigrams > 0) {
    bigramOffset=bytesRead;
    int bytesToSkip=(numberBigrams + 1) * 8;
    stream.skipBytes(bytesToSkip);
    bytesRead+=bytesToSkip;
  }
  if (numberTrigrams > 0) {
    trigramOffset=bytesRead;
    int bytesToSkip=numberTrigrams * 4;
    stream.skipBytes(bytesToSkip);
    bytesRead+=bytesToSkip;
  }
  if (numberBigrams > 0) {
    this.bigramProbTable=readProbabilitiesTable(stream,bigEndian);
  }
  if (numberTrigrams > 0) {
    trigramBackoffTable=readProbabilitiesTable(stream,bigEndian);
    trigramProbTable=readProbabilitiesTable(stream,bigEndian);
    int trigramSegTableSize=((numberBigrams + 1) / bigramSegmentSize) + 1;
    trigramSegmentTable=readTrigramSegmentTable(stream,bigEndian,trigramSegTableSize);
  }
  int wordsStringLength=readInt(stream,bigEndian);
  if (wordsStringLength <= 0) {
    throw new Error("String_Node_Str" + wordsStringLength);
  }
  String wordsString=readString(stream,wordsStringLength);
  int numberWords=0;
  for (int i=0; i < wordsStringLength; i++) {
    if (wordsString.charAt(i) == '\0') {
      numberWords++;
    }
  }
  if (numberWords != numberUnigrams) {
    throw new Error("String_Node_Str" + numberWords);
  }
  this.words=wordsString.split("String_Node_Str");
  buildUnigramIDMap();
  applyUnigramWeight();
  stream.close();
  FileInputStream is=new FileInputStream(location);
  fileChannel=is.getChannel();
}

Fixed version (ground truth):
/** 
 * Loads the language model from the given location. 
 * @param location the location of the language model
 */
private void loadBinary(String location) throws IOException {
  FileInputStream fis=new FileInputStream(location);
  DataInputStream stream=new DataInputStream(new BufferedInputStream(fis));
  int headerLength=readInt(stream,bigEndian);
  if (headerLength != (DARPA_LM_HEADER.length() + 1)) {
    headerLength=Utilities.swapInteger(headerLength);
    if (headerLength == (DARPA_LM_HEADER.length() + 1)) {
      bigEndian=false;
    }
 else {
      throw new Error("String_Node_Str" + headerLength + "String_Node_Str");
    }
  }
  String header=readString(stream,headerLength - 1);
  readByte(stream);
  if (!header.equals(DARPA_LM_HEADER)) {
    throw new Error("String_Node_Str" + header);
  }
  int fileNameLength=readInt(stream,bigEndian);
  for (int i=0; i < fileNameLength; i++) {
    readByte(stream);
  }
  numberUnigrams=0;
  int logBigramSegmentSize=LOG2_BIGRAM_SEGMENT_SIZE_DEFAULT;
  int version=readInt(stream,bigEndian);
  System.out.println("String_Node_Str" + version);
  if (version <= 0) {
    readInt(stream,bigEndian);
    int formatLength;
    for (; ; ) {
      if ((formatLength=readInt(stream,bigEndian)) == 0) {
        break;
      }
      for (int i=0; i < formatLength; i++) {
        readByte(stream);
      }
    }
    if (version <= -2) {
      logBigramSegmentSize=readInt(stream,bigEndian);
      if (logBigramSegmentSize < 1 || logBigramSegmentSize > 15) {
        throw new Error("String_Node_Str");
      }
    }
    numberUnigrams=readInt(stream,bigEndian);
  }
 else {
    numberUnigrams=version;
  }
  int bigramSegmentSize=1 << logBigramSegmentSize;
  if (numberUnigrams <= 0) {
    throw new Error("String_Node_Str" + numberUnigrams + "String_Node_Str");
  }
  System.out.println("String_Node_Str" + numberUnigrams);
  numberBigrams=readInt(stream,bigEndian);
  if (numberBigrams < 0) {
    throw new Error("String_Node_Str" + numberBigrams);
  }
  System.out.println("String_Node_Str" + numberBigrams);
  numberTrigrams=readInt(stream,bigEndian);
  if (numberTrigrams < 0) {
    throw new Error("String_Node_Str" + numberTrigrams);
  }
  System.out.println("String_Node_Str" + numberTrigrams);
  unigrams=readUnigrams(stream,numberUnigrams + 1,bigEndian);
  if (numberBigrams > 0) {
    bigramOffset=bytesRead;
    System.out.println("String_Node_Str" + bigramOffset);
    int bytesToSkip=(numberBigrams + 1) * BYTES_PER_BIGRAM;
    stream.skipBytes(bytesToSkip);
    bytesRead+=bytesToSkip;
  }
  if (numberTrigrams > 0) {
    trigramOffset=bytesRead;
    int bytesToSkip=numberTrigrams * BYTES_PER_TRIGRAM;
    stream.skipBytes(bytesToSkip);
    bytesRead+=bytesToSkip;
  }
  if (numberBigrams > 0) {
    this.bigramProbTable=readProbabilitiesTable(stream,bigEndian);
  }
  if (numberTrigrams > 0) {
    trigramBackoffTable=readProbabilitiesTable(stream,bigEndian);
    trigramProbTable=readProbabilitiesTable(stream,bigEndian);
    int trigramSegTableSize=((numberBigrams + 1) / bigramSegmentSize) + 1;
    trigramSegmentTable=readTrigramSegmentTable(stream,bigEndian,trigramSegTableSize);
  }
  int wordsStringLength=readInt(stream,bigEndian);
  if (wordsStringLength <= 0) {
    throw new Error("String_Node_Str" + wordsStringLength);
  }
  String wordsString=readString(stream,wordsStringLength);
  int numberWords=0;
  for (int i=0; i < wordsStringLength; i++) {
    if (wordsString.charAt(i) == '\0') {
      numberWords++;
    }
  }
  if (numberWords != numberUnigrams) {
    throw new Error("String_Node_Str" + numberWords);
  }
  this.words=wordsString.split("String_Node_Str");
  buildUnigramIDMap();
  fis.close();
  stream.close();
  is=new FileInputStream(location);
  fileChannel=is.getChannel();
}