package com.inmobi.databus.partition;

import java.io.IOException;

import com.inmobi.databus.files.StreamFile;
import com.inmobi.databus.readers.StreamReader;

public abstract class AbstractPartitionStreamReader implements 
     PartitionStreamReader {

  protected StreamReader reader;
  protected boolean closed = false;
  
  protected StreamReader getReader() {
    return this.reader;
  }

  public StreamFile getCurrentFile() {
    return reader.getCurrentStreamFile();
  }

  @Override
  public long getCurrentLineNum() {
    return reader.getCurrentLineNum();
  }

  @Override
  public void openStream() throws IOException {
    reader.openStream();
  }

  @Override
  public void close() throws IOException {
    closed = true;
    reader.close();
  }

  @Override
  public void closeStream() throws IOException {
    reader.closeStream();    
  }

  public byte[] readLine() throws IOException, InterruptedException {
    return reader.readLine();
  }

}

@@ -730,16 +730,44 @@
 = true;%0A
+    if (reader != null) %7B%0A  
     read
@@ -774,24 +774,30 @@
 er.close();%0A
+    %7D%0A
   %7D%0A%0A  @Over

Fix NPE in CollectorReader.close()