From a17bc6af54f468bd0fa69ac0d13bba10c4e18b4b Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 11 Feb 2008 19:14:04 +0000 Subject: 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 --- src/java/org/apache/poi/POIDocument.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/java/org/apache/poi/POIDocument.java') 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()); + } } /** -- cgit v1.2.3