From dafabdc7b9e37c8489be90f0641eafbb3305ace5 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 17 May 2015 21:26:31 +0000 Subject: [PATCH] Move location where document is held and adjust constructors and class-hierarchy accordingly git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1679903 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/POIOLE2TextExtractor.java | 14 +++++++++++++- src/java/org/apache/poi/POITextExtractor.java | 18 ------------------ .../extractor/HPSFPropertiesExtractor.java | 5 +++-- .../extractor/EventBasedExcelExtractor.java | 3 ++- .../org/apache/poi/POIXMLTextExtractor.java | 2 -- 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/java/org/apache/poi/POIOLE2TextExtractor.java b/src/java/org/apache/poi/POIOLE2TextExtractor.java index 7679136c8..5dd1d755e 100644 --- a/src/java/org/apache/poi/POIOLE2TextExtractor.java +++ b/src/java/org/apache/poi/POIOLE2TextExtractor.java @@ -33,15 +33,27 @@ import org.apache.poi.poifs.filesystem.DirectoryEntry; * @see org.apache.poi.hwpf.extractor.WordExtractor */ public abstract class POIOLE2TextExtractor extends POITextExtractor { + /** The POIDocument that's open */ + protected POIDocument document; + /** * Creates a new text extractor for the given document * * @param document The POIDocument to use in this extractor. */ public POIOLE2TextExtractor(POIDocument document) { - super(document); + this.document = document; } + /** + * Creates a new text extractor, using the same + * document as another text extractor. Normally + * only used by properties extractors. + */ + protected POIOLE2TextExtractor(POIOLE2TextExtractor otherExtractor) { + this.document = otherExtractor.document; + } + /** * Returns the document information metadata for the document * diff --git a/src/java/org/apache/poi/POITextExtractor.java b/src/java/org/apache/poi/POITextExtractor.java index e18078b46..6514ad5d1 100644 --- a/src/java/org/apache/poi/POITextExtractor.java +++ b/src/java/org/apache/poi/POITextExtractor.java @@ -31,24 +31,6 @@ import java.io.IOException; * @see org.apache.poi.hwpf.extractor.WordExtractor */ public abstract class POITextExtractor implements Closeable { - /** The POIDocument that's open */ - protected POIDocument document; - - /** - * Creates a new text extractor for the given document - */ - public POITextExtractor(POIDocument document) { - this.document = document; - } - /** - * Creates a new text extractor, using the same - * document as another text extractor. Normally - * only used by properties extractors. - */ - protected POITextExtractor(POITextExtractor otherExtractor) { - this.document = otherExtractor.document; - } - /** * Retrieves all the text from the document. * How cells, paragraphs etc are separated in the text diff --git a/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java b/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java index 1a0db0389..b7967f333 100644 --- a/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java +++ b/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.util.Iterator; import org.apache.poi.POIDocument; +import org.apache.poi.POIOLE2TextExtractor; import org.apache.poi.POITextExtractor; import org.apache.poi.hpsf.CustomProperties; import org.apache.poi.hpsf.DocumentSummaryInformation; @@ -39,10 +40,10 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; * build in and custom, returning them in * textual form. */ -public class HPSFPropertiesExtractor extends POITextExtractor { +public class HPSFPropertiesExtractor extends POIOLE2TextExtractor { private Closeable toClose; - public HPSFPropertiesExtractor(POITextExtractor mainExtractor) { + public HPSFPropertiesExtractor(POIOLE2TextExtractor mainExtractor) { super(mainExtractor); } public HPSFPropertiesExtractor(POIDocument doc) { diff --git a/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java b/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java index 889de20b4..debeee92c 100644 --- a/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java +++ b/src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.apache.poi.POIDocument; import org.apache.poi.POIOLE2TextExtractor; import org.apache.poi.hpsf.DocumentSummaryInformation; import org.apache.poi.hpsf.SummaryInformation; @@ -75,7 +76,7 @@ public class EventBasedExcelExtractor extends POIOLE2TextExtractor implements or public EventBasedExcelExtractor( DirectoryNode dir ) { - super( null ); + super( (POIDocument)null ); _dir = dir; } diff --git a/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java b/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java index 3a600f48a..705bf42a6 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java +++ b/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java @@ -32,8 +32,6 @@ public abstract class POIXMLTextExtractor extends POITextExtractor { * Creates a new text extractor for the given document */ public POIXMLTextExtractor(POIXMLDocument document) { - super((POIDocument)null); - _document = document; }