You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "David Brosius (Jira)" <ji...@apache.org> on 2021/10/12 05:42:00 UTC
[jira] [Created] (TIKA-3569) NPE with ImageParser 2.1.0
David Brosius created TIKA-3569:
-----------------------------------
Summary: 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
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)