Program: 140902
Project: 140902
Buggy source:
/** 
 * Read a grid from a stream in ESRI ASCII format.
 * @param input The stream to read from. The stream is closed at the end.
 * @param progressIndicator A WorkerProgress to inform about the progress.
 * @return The read grid.
 * @throws java.io.IOException
 */
public Grid read(InputStream input,ProgressIndicator progressIndicator) throws IOException {
  if (progressIndicator != null) {
    progressIndicator.startProgress();
  }
  BufferedReader br=null;
  try {
    InputStreamReader in=new InputStreamReader(input);
    br=new BufferedReader(in);
    GridHeaderImporter header=new GridHeaderImporter();
    String firstGridLine=header.readHeader(br,true);
    if (header.isValid() == false) {
      throw new IOException("String_Node_Str");
    }
    Grid grid=new Grid(header.getCols(),header.getRows(),header.getCellSize());
    grid.setWest(header.getWest());
    grid.setSouth(header.getSouth());
    BlockingQueue<String> q=new LinkedBlockingQueue<>(64);
    q.put(firstGridLine);
    Producer producer=new Producer(q,br);
    Thread producerThread=new Thread(producer);
    producerThread.start();
    Consumer consumer=new Consumer(q,grid,header.getNoDataValue(),progressIndicator);
    Thread consumerThread=new Thread(consumer);
    consumerThread.start();
    try {
      producerThread.join();
    }
 catch (    InterruptedException ex) {
      consumerThread.interrupt();
    }
    consumerThread.join();
    return grid;
  }
 catch (  InterruptedException ex) {
    return null;
  }
 finally {
    try {
      if (br != null) {
        br.close();
      }
    }
 catch (    IOException exc) {
    }
    if (producerConsumerException != null) {
      throw new IOException(producerConsumerException);
    }
  }
}

Fixed version (ground truth):
/** 
 * Read a grid from a stream in ESRI ASCII format.
 * @param input The stream to read from. The stream is closed at the end.
 * @param progressIndicator A WorkerProgress to inform about the progress.
 * @return The read grid.
 * @throws java.io.IOException
 */
public Grid read(InputStream input,ProgressIndicator progressIndicator) throws IOException {
  if (progressIndicator != null) {
    progressIndicator.startProgress();
  }
  BufferedReader br=null;
  try {
    InputStreamReader in=new InputStreamReader(input);
    br=new BufferedReader(in);
    GridHeaderImporter header=new GridHeaderImporter();
    String firstGridLine=header.readHeader(br);
    if (header.isValid() == false) {
      throw new IOException("String_Node_Str");
    }
    Grid grid=new Grid(header.getCols(),header.getRows(),header.getCellSize());
    grid.setWest(header.getWest());
    grid.setSouth(header.getSouth());
    BlockingQueue<String> q=new LinkedBlockingQueue<>(64);
    q.put(firstGridLine);
    Producer producer=new Producer(q,br);
    Thread producerThread=new Thread(producer);
    producerThread.start();
    Consumer consumer=new Consumer(q,grid,header.getNoDataValue(),progressIndicator);
    Thread consumerThread=new Thread(consumer);
    consumerThread.start();
    try {
      producerThread.join();
    }
 catch (    InterruptedException ex) {
      consumerThread.interrupt();
    }
    consumerThread.join();
    return grid;
  }
 catch (  InterruptedException ex) {
    return null;
  }
 finally {
    try {
      if (br != null) {
        br.close();
      }
    }
 catch (    IOException exc) {
    }
    if (producerConsumerException != null) {
      throw new IOException(producerConsumerException);
    }
  }
}