[
https://issues.apache.org/jira/browse/TIKA-3569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Allison resolved TIKA-3569.
-------------------------------
Resolution: Fixed
Thank you for reporting this!
> NPE with ImageParser 2.1.0
> --------------------------
>
> Key: TIKA-3569
> URL: https://issues.apache.org/jira/browse/TIKA-3569
> Project: Tika
> Issue Type: Bug
> Components: parser
> Affects Versions: 2.1.0
> Reporter: David Brosius
> Priority: Minor
> Fix For: 2.1.1
>
>
> Using ImageParser, i pass a png, to parse.. and i debug in and see in
> AbstractImageParser,
> ```
> String mediaTypeString = metadata.get(Metadata.CONTENT_TYPE);
> //note: mediaType can be null
> MediaType mediaType = normalizeMediaType(MediaType.parse(mediaTypeString));
> MediaType ocrMediaType = convertToOCRMediaType(mediaType);
> Parser ocrParser = EmbeddedDocumentUtil.getStatelessParser(context);
> ```
> and indeed mediaType is null, as the comment forwarns.
> but convertToOCRMediaType does
> ```
> static MediaType convertToOCRMediaType(MediaType mediaType) {
> return new MediaType(*mediaType*.getType(), OCR_MEDIATYPE_PREFIX +
> mediaType.getSubtype());
> }
> ```
> which NPEs.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)