[
https://issues.apache.org/jira/browse/TIKA-2483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286477#comment-16286477
]
Nick Burch commented on TIKA-2483:
----------------------------------
Since it's possible to get a Tika Config object turned into the XML version, a
non-ideal option might be to implement serialize and deserialize of TikaConfig
via xml
Short term, since this is causing some regression issues, should we provide a
helper method to "get a MediaTypeRegistry if possible" ? That could do the
caching, could take the ParseContext to look up a TikaConfig or
MediaTypeRegistry, and could catch + log + etc in the ForkParser case. That
should restore the current behaviour for most cases, clean the code up, and
give us an easy point to test/fix/etc later. It might also possibly help clean
up a few other places in the parser code doing similar stuff
> Using PackageParser in ForkParser causes NPE
> --------------------------------------------
>
> Key: TIKA-2483
> URL: https://issues.apache.org/jira/browse/TIKA-2483
> Project: Tika
> Issue Type: Bug
> Components: parser
> Affects Versions: 1.16
> Reporter: TzeKai Lee
> Fix For: 1.17
>
> Attachments: testForkedPackageParsing.patch
>
>
> {quote}
> Caused by: java.lang.NullPointerException
> at
> org.apache.tika.mime.MimeTypesFactory.create(MimeTypesFactory.java:158)
> at
> org.apache.tika.mime.MimeTypes.getDefaultMimeTypes(MimeTypes.java:577)
> at
> org.apache.tika.config.TikaConfig.getDefaultMimeTypes(TikaConfig.java:78)
> at org.apache.tika.config.TikaConfig.<init>(TikaConfig.java:242)
> at
> org.apache.tika.config.TikaConfig.getDefaultConfig(TikaConfig.java:379)
> at
> org.apache.tika.parser.pkg.PackageParser.parse(PackageParser.java:165)
> at
> org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
> {quote}
> The mediaTypeRegistry handling code in parse() of PackageParser seems cause
> the problem due to ForkParser cannot properly construct default TikaConfig.
> Also since TikaConfig is not serializable, there is no way to assign
> mediaTypeRegistry/bufferedMediaTypeRegistry before calling parse()
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)