tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume LOUVEL <lou...@akelio.fr>
Subject ParseUtils.getStringContent
Date Wed, 28 May 2008 13:05:28 GMT
Hello,

I test Tika projet, and I like it, it is very useful.
I use the ParseUtils.getStringContent() like this :

ParseUtils.getStringContent(myfile, TikaConfig.getDefaultConfig();

I have a NullPointerException if the mime type is application/octet-stream.
Is it normal ? I download the source and I test, I found this arrived in 
the

public static String getStringContent(InputStream stream, TikaConfig 
config, String mimeType) throws TikaException, IOException {
        try {
            Parser parser = config.getParser(mimeType);
            ContentHandler handler = new BodyContentHandler();
            parser.parse(stream, handler, new Metadata());
            return handler.toString();
        }
        catch (SAXException e) {
            throw new TikaException("Unexpected SAX error", e);
        }
    }

If the mimetype is application/octet-stream, the line
Parser parser = config.getParser(mimeType);
return a null object

and the line
parser.parse(stream, handler, new Metadata());
throw a NullPointerException

Is it normal ?

Thank's for this good project.

Guillaume LOUVEL

Mime
View raw message