Bug 46472

Summary: NPE in HPSFPropertiesExtractor.getDocumentSummaryInformationText gives NPE
Product: POI Reporter: Antony Bowesman <adb>
Component: HPSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: critical    
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Antony Bowesman 2009-01-04 16:55:07 UTC
java.lang.NullPointerException
        at org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor.getDocumentSummaryInformationText(HPSFPropertiesExtractor.java:59)
        at org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor.getText(HPSFPropertiesExtractor.java:128)

It's caused by the following when trying to extract meta data properties from a Word document 

 POITextExtractor extractor = ExtractorFactory.createExtractor(new ByteArrayInputStream(raw));
 POITextExtractor mdExtractor = extractor.getMetadataTextExtractor();
 if (mdExtractor != null)
 {
     String md = mdExtractor.getText();
     System.out.println("MD=:" + md);
 }

and is caused because my Word document would not appear to have custom properties, therefore the getCustomProperties() method returns null in the following...

public String getDocumentSummaryInformationText() {
...
   // Now custom ones
   CustomProperties cps = dsi.getCustomProperties();
   Iterator keys = cps.keySet().iterator();
...
Comment 1 Nick Burch 2009-01-06 10:59:41 UTC
Fixed in svn
Comment 2 Josh Micich 2009-01-06 11:55:45 UTC
svn r732058