diff options
author | Nick Burch <nick@apache.org> | 2008-03-03 15:10:46 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2008-03-03 15:10:46 +0000 |
commit | 92211d73aa319ab99788ac2502d21cbbc1445c4c (patch) | |
tree | adfffc8f881e42df7e75a235653d295ea33fd4cd /src/java/org/apache/poi/POIDocument.java | |
parent | f191df6849a16dd49aeca8b5b794d2a17d4aa5dd (diff) | |
download | poi-92211d73aa319ab99788ac2502d21cbbc1445c4c.tar.gz poi-92211d73aa319ab99788ac2502d21cbbc1445c4c.zip |
Fix from Yegor from bug #44491 - don't have the new style handy POIDocument property stuff break old style hpsf+hssf use
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@633118 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/POIDocument.java')
-rw-r--r-- | src/java/org/apache/poi/POIDocument.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/java/org/apache/poi/POIDocument.java b/src/java/org/apache/poi/POIDocument.java index 8d91c06e79..075fa45381 100644 --- a/src/java/org/apache/poi/POIDocument.java +++ b/src/java/org/apache/poi/POIDocument.java @@ -54,16 +54,24 @@ public abstract class POIDocument { /** For our own logging use */ protected POILogger logger = POILogFactory.getLogger(this.getClass()); - - /** + /* Have the property streams been read yet? (Only done on-demand) */ + protected boolean initialized = false; + + /** * Fetch the Document Summary Information of the document */ - public DocumentSummaryInformation getDocumentSummaryInformation() { return dsInf; } + public DocumentSummaryInformation getDocumentSummaryInformation() { + if(!initialized) readProperties(); + return dsInf; + } /** * Fetch the Summary Information of the document */ - public SummaryInformation getSummaryInformation() { return sInf; } + public SummaryInformation getSummaryInformation() { + if(!initialized) readProperties(); + return sInf; + } /** * Find, and create objects for, the standard @@ -89,6 +97,9 @@ public abstract class POIDocument { } else if(ps != null) { logger.log(POILogger.WARN, "SummaryInformation property set came back with wrong class - ", ps.getClass()); } + + // Mark the fact that we've now loaded up the properties + initialized = true; } /** @@ -133,7 +144,7 @@ public abstract class POIDocument { * @param writtenEntries a list of POIFS entries to add the property names too */ protected void writeProperties(POIFSFileSystem outFS, List writtenEntries) throws IOException { - if(sInf != null) { + if(sInf != null) { writePropertySet(SummaryInformation.DEFAULT_STREAM_NAME,sInf,outFS); if(writtenEntries != null) { writtenEntries.add(SummaryInformation.DEFAULT_STREAM_NAME); |