aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/POIDocument.java
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2008-02-11 19:14:04 +0000
committerNick Burch <nick@apache.org>2008-02-11 19:14:04 +0000
commita17bc6af54f468bd0fa69ac0d13bba10c4e18b4b (patch)
treebd7b554ece2102860164cff0f8eb6d9bc0012a76 /src/java/org/apache/poi/POIDocument.java
parent03c0344f9b5cacce0053124470a526e66c97ff8e (diff)
downloadpoi-a17bc6af54f468bd0fa69ac0d13bba10c4e18b4b.tar.gz
poi-a17bc6af54f468bd0fa69ac0d13bba10c4e18b4b.zip
If we have a document with a hpsf stream that exists, but is of the wrong type, then log a warning but continue
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@620582 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/POIDocument.java')
-rw-r--r--src/java/org/apache/poi/POIDocument.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/POIDocument.java b/src/java/org/apache/poi/POIDocument.java
index ece7a3f13d..8d91c06e79 100644
--- a/src/java/org/apache/poi/POIDocument.java
+++ b/src/java/org/apache/poi/POIDocument.java
@@ -67,14 +67,28 @@ public abstract class POIDocument {
/**
* Find, and create objects for, the standard
- * Documment Information Properties (HPSF)
+ * Documment Information Properties (HPSF).
+ * If a given property set is missing or corrupt,
+ * it will remain null;
*/
protected void readProperties() {
+ PropertySet ps;
+
// DocumentSummaryInformation
- dsInf = (DocumentSummaryInformation)getPropertySet(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+ ps = getPropertySet(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
+ if(ps != null && ps instanceof DocumentSummaryInformation) {
+ dsInf = (DocumentSummaryInformation)ps;
+ } else if(ps != null) {
+ logger.log(POILogger.WARN, "DocumentSummaryInformation property set came back with wrong class - ", ps.getClass());
+ }
// SummaryInformation
- sInf = (SummaryInformation)getPropertySet(SummaryInformation.DEFAULT_STREAM_NAME);
+ ps = getPropertySet(SummaryInformation.DEFAULT_STREAM_NAME);
+ if(ps instanceof SummaryInformation) {
+ sInf = (SummaryInformation)ps;
+ } else if(ps != null) {
+ logger.log(POILogger.WARN, "SummaryInformation property set came back with wrong class - ", ps.getClass());
+ }
}
/**