Bug 51974 - [PATCH] TIKA spawned Picture.suggestPictureType() - NullPointerException
Summary: [PATCH] TIKA spawned Picture.suggestPictureType() - NullPointerException
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.8-dev
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on: 51902
  Show dependency tree
Reported: 2011-10-06 05:17 UTC by Jeremy
Modified: 2011-10-15 14:15 UTC (History)
1 user (show)

Resolves null pointer issue in new picture logic (1.15 KB, application/octet-stream)
2011-10-06 05:17 UTC, Jeremy

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy 2011-10-06 05:17:22 UTC
Created attachment 27705 [details]
Resolves null pointer issue in new picture logic

+++ This bug may have been introduced by fixes submitted last weekend that resolved Bug #51902 +++

**Effects Daily Build**

Essentially the new Picture related fixes can now encounter NULL pointer Exceptions in two places when doing extraction with TIKA that were not an issue for documents prior to the fixes.

The resolution is rather simple, just adding a couple null checks in two places, in getRawContent() and suggestPictureType() 

The patch file for the daily build is attached.

Stack Trace (Daily build 10/05/2011  both POI and TIKA)
Caused by: java.lang.NullPointerException
	at org.apache.poi.hwpf.usermodel.Picture.suggestPictureType(Picture.java:519)
	at org.apache.poi.hwpf.usermodel.Picture.suggestFileExtension(Picture.java:500)
	at org.apache.poi.hwpf.usermodel.Picture.suggestFullFileName(Picture.java:512)
	at org.apache.tika.parser.microsoft.WordExtractor$PicturesSource.<init>(WordExtractor.java:520)
	at org.apache.tika.parser.microsoft.WordExtractor$PicturesSource.<init>(WordExtractor.java:504)
	at org.apache.tika.parser.microsoft.WordExtractor.parse(WordExtractor.java:85)
	at org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:200)
	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
	... 46 more
Comment 1 Nick Burch 2011-10-15 14:15:22 UTC
Thanks, fixed in r1183645.