aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2008-03-03 15:10:46 +0000
committerNick Burch <nick@apache.org>2008-03-03 15:10:46 +0000
commit92211d73aa319ab99788ac2502d21cbbc1445c4c (patch)
treeadfffc8f881e42df7e75a235653d295ea33fd4cd /src/java/org/apache/poi
parentf191df6849a16dd49aeca8b5b794d2a17d4aa5dd (diff)
downloadpoi-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')
-rw-r--r--src/java/org/apache/poi/POIDocument.java21
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java3
2 files changed, 16 insertions, 8 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);
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
index 0cbafa32f1..e112da2212 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
@@ -165,10 +165,7 @@ public class HSSFWorkbook extends POIDocument
throws IOException
{
this.preserveNodes = preserveNodes;
-
- // Read in the HPSF properties
this.filesystem = fs;
- readProperties();
// If we're not preserving nodes, don't track the
// POIFS any more