Bug 51974

Summary: [PATCH] TIKA spawned Picture.suggestPictureType() - NullPointerException
Product: POI Reporter: Jeremy <rpi_alum>
Component: HWPFAssignee: POI Developers List <dev>
Severity: blocker CC: pablo.queixalos
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Bug Depends on: 51902    
Bug Blocks:    
Attachments: Resolves null pointer issue in new picture logic

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.