From: Nick Burch Date: Tue, 6 Jan 2009 18:59:42 +0000 (+0000) Subject: Fix bug #46472 - Avoid NPE in HPSFPropertiesExtractor when no properties exist X-Git-Tag: REL_3_5_BETA5~41 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f1b20beca1975cd53c5337ad94b7cc516c158129;p=poi.git Fix bug #46472 - Avoid NPE in HPSFPropertiesExtractor when no properties exist git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@732058 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 0536507411..63002aae8d 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + 46472 - Avoid NPE in HPSFPropertiesExtractor when no properties exist 46479 - fixed bugs related to cached formula values and HSSFFormulaEvaluator.evaluateInCell() 45031 - added implementation for CHOOSE() function 46361 - resolve licensing issues around the HDGF resource file, chunks_parse_cmds.tbl diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 6e72711b7a..8878fce6f8 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 46472 - Avoid NPE in HPSFPropertiesExtractor when no properties exist 46479 - fixed bugs related to cached formula values and HSSFFormulaEvaluator.evaluateInCell() 45031 - added implementation for CHOOSE() function 46361 - resolve licensing issues around the HDGF resource file, chunks_parse_cmds.tbl diff --git a/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java b/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java index ecad5c05be..ca1cfb46dd 100644 --- a/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java +++ b/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java @@ -56,11 +56,13 @@ public class HPSFPropertiesExtractor extends POITextExtractor { // Now custom ones CustomProperties cps = dsi.getCustomProperties(); - Iterator keys = cps.keySet().iterator(); - while(keys.hasNext()) { - String key = (String)keys.next(); - String val = getPropertyValueText( cps.get(key) ); - text.append(key + " = " + val + "\n"); + if(cps != null) { + Iterator keys = cps.keySet().iterator(); + while(keys.hasNext()) { + String key = (String)keys.next(); + String val = getPropertyValueText( cps.get(key) ); + text.append(key + " = " + val + "\n"); + } } // All done