You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by Rob Esposito <ro...@txvia.com> on 2009/05/08 17:39:06 UTC

Receiving NullPointerException in TXTParser

Hello,

I'm getting a NullPointerException when I try to parse a zero length
file with the TXTParser using Tika 0.3.  This happens on Windows XP
but not Mac OS X 10.5.6.  I was wondering if anyone else has seen a
similar problem.

The code I'm using is:
  InputStream is = new FileInputStream(file);
  Parser parser = new AutoDetectParser();
  ContentHandler handler = new BodyContentHandler();
  parser.parse(is, handler, metadata);

And the exception is:
  Caused by: java.lang.NullPointerException
    at org.apache.tika.parser.txt.TXTParser.parse(TXTParser.java:46)
    at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:108)
    at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:78)

Thanks,
Rob