Bug 46472 - NPE in HPSFPropertiesExtractor.getDocumentSummaryInformationText gives NPE
Summary: NPE in HPSFPropertiesExtractor.getDocumentSummaryInformationText gives NPE
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HPSF (show other bugs)
Version: 3.5-dev
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-04 16:55 UTC by Antony Bowesman
Modified: 2009-01-06 11:55 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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