Author: kiwiwings
Date: Sun May 27 21:59:18 2018
New Revision: 1832358
URL: http://svn.apache.org/viewvc?rev=1832358&view=rev
Log:
#62355 - unsplit packages - 1 - moved classes
Added:
poi/trunk/src/java/org/apache/poi/POIReadOnlyDocument.java
- copied unchanged from r1832357, poi/trunk/src/scratchpad/src/org/apache/poi/POIReadOnlyDocument.java
poi/trunk/src/java/org/apache/poi/extractor/POIOLE2TextExtractor.java
- copied, changed from r1832357, poi/trunk/src/java/org/apache/poi/POIOLE2TextExtractor.java
poi/trunk/src/java/org/apache/poi/extractor/POITextExtractor.java
- copied, changed from r1832357, poi/trunk/src/java/org/apache/poi/POITextExtractor.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFChart.java
- copied unchanged from r1832357, poi/trunk/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java
poi/trunk/src/java/org/apache/poi/ss/extractor/EmbeddedData.java
- copied unchanged from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedData.java
poi/trunk/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
poi/trunk/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocument.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLException.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLException.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLFactory.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLProperties.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLProperties.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLRelation.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLTypeLoader.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLLister.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLPrettyPrint.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLTextExtractor.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/DocumentHelper.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/IdentifierManager.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/IdentifierManager.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/PackageHelper.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/PackageHelper.java
poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/SAXHelper.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/SAXHelper.java
poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/ooxml/
poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java
- copied, changed from r1832357, poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/
poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLDocument.java
- copied, changed from r1832357, poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java
poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java
- copied, changed from r1832357, poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java
poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/
poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java
- copied, changed from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/TestSAXHelper.java
- copied, changed from r1832357, poi/trunk/src/ooxml/testcases/org/apache/poi/util/TestSAXHelper.java
poi/trunk/src/scratchpad/src/org/apache/poi/extractor/ole2/
poi/trunk/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java
- copied, changed from r1832357, poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java
poi/trunk/src/testcases/org/apache/poi/dev/
poi/trunk/src/testcases/org/apache/poi/dev/RecordGenerator.java
- copied unchanged from r1832357, poi/trunk/src/java/org/apache/poi/dev/RecordGenerator.java
Removed:
poi/trunk/src/java/org/apache/poi/POIOLE2TextExtractor.java
poi/trunk/src/java/org/apache/poi/POITextExtractor.java
poi/trunk/src/java/org/apache/poi/dev/RecordGenerator.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLException.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLProperties.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java
poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java
poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java
poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLPrettyPrint.java
poi/trunk/src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java
poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
poi/trunk/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedData.java
poi/trunk/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java
poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
poi/trunk/src/ooxml/java/org/apache/poi/util/DocumentHelper.java
poi/trunk/src/ooxml/java/org/apache/poi/util/IdentifierManager.java
poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
poi/trunk/src/ooxml/java/org/apache/poi/util/PackageHelper.java
poi/trunk/src/ooxml/java/org/apache/poi/util/SAXHelper.java
poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java
poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java
poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
poi/trunk/src/ooxml/testcases/org/apache/poi/util/TestSAXHelper.java
poi/trunk/src/scratchpad/src/org/apache/poi/POIReadOnlyDocument.java
poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java
poi/trunk/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoUtils.java
poi/trunk/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java
Modified:
poi/site/src/documentation/content/xdocs/status.xml
Modified: poi/site/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1832358&r1=1832357&r2=1832358&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Sun May 27 21:59:18 2018
@@ -69,6 +69,7 @@
<summary-item>Renames org.apache.poi.xwpf.usermodel.TextSegement to org.apache.poi.xwpf.usermodel.TextSegment</summary-item>
</summary>
<actions>
+ <action dev="PD" type="fix" fixes-bug="62355" breaks-compatibility="true" module="POI Overall">Unsplit packages for Jigsaw / Java 9 compatibility</action>
<action dev="PD" type="fix" fixes-bug="62041" module="SL Common">TestFonts fails on Mac</action>
<action dev="PD" type="fix" fixes-bug="62051" module="XSLF">Two shapes have the same shapeId within the same slide</action>
<action dev="PD" type="fix" fixes-bug="61633" module="XSLF">Zero width shapes aren't rendered</action>
Copied: poi/trunk/src/java/org/apache/poi/extractor/POIOLE2TextExtractor.java (from r1832357, poi/trunk/src/java/org/apache/poi/POIOLE2TextExtractor.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/extractor/POIOLE2TextExtractor.java?p2=poi/trunk/src/java/org/apache/poi/extractor/POIOLE2TextExtractor.java&p1=poi/trunk/src/java/org/apache/poi/POIOLE2TextExtractor.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/POIOLE2TextExtractor.java (original)
+++ poi/trunk/src/java/org/apache/poi/extractor/POIOLE2TextExtractor.java Sun May 27 21:59:18 2018
@@ -14,8 +14,9 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.extractor;
+import org.apache.poi.POIDocument;
import org.apache.poi.hpsf.DocumentSummaryInformation;
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor;
Copied: poi/trunk/src/java/org/apache/poi/extractor/POITextExtractor.java (from r1832357, poi/trunk/src/java/org/apache/poi/POITextExtractor.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/extractor/POITextExtractor.java?p2=poi/trunk/src/java/org/apache/poi/extractor/POITextExtractor.java&p1=poi/trunk/src/java/org/apache/poi/POITextExtractor.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/POITextExtractor.java (original)
+++ poi/trunk/src/java/org/apache/poi/extractor/POITextExtractor.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.extractor;
import java.io.Closeable;
import java.io.IOException;
Copied: poi/trunk/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java?p2=poi/trunk/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java Sun May 27 21:59:18 2018
@@ -49,7 +49,6 @@ import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
-import org.apache.poi.xssf.usermodel.XSSFObjectData;
/**
* This extractor class tries to identify various embedded documents within Excel files
@@ -115,11 +114,7 @@ public class EmbeddedExtractor implement
if (od.hasDirectoryEntry()) {
data = extractOne((DirectoryNode)od.getDirectory());
} else {
- String contentType = CONTENT_TYPE_BYTES;
- if (od instanceof XSSFObjectData) {
- contentType = ((XSSFObjectData)od).getObjectPart().getContentType();
- }
- data = new EmbeddedData(od.getFileName(), od.getObjectData(), contentType);
+ data = new EmbeddedData(od.getFileName(), od.getObjectData(), od.getContentType());
}
} catch (Exception e) {
LOG.log(POILogger.WARN, "Entry not found / readable - ignoring OLE embedding", e);
Copied: poi/trunk/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java?p2=poi/trunk/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java Sun May 27 21:59:18 2018
@@ -21,51 +21,42 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
-import org.apache.poi.EmptyFileException;
import org.apache.poi.EncryptedDocumentException;
+import org.apache.poi.OldFileFormatException;
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
-import org.apache.poi.openxml4j.opc.OPCPackage;
-import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.poifs.crypt.Decryptor;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentFactoryHelper;
import org.apache.poi.poifs.filesystem.FileMagic;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.IOUtils;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.poi.util.Removal;
/**
* Factory for creating the appropriate kind of Workbook
- * (be it {@link HSSFWorkbook} or {@link XSSFWorkbook}),
+ * (be it {@link HSSFWorkbook} or XSSFWorkbook),
* by auto-detecting from the supplied input.
*/
public class WorkbookFactory {
/**
- * Creates a HSSFWorkbook from the given POIFSFileSystem
- * <p>Note that in order to properly release resources the
- * Workbook should be closed after use.
- */
- public static Workbook create(POIFSFileSystem fs) throws IOException {
- return new HSSFWorkbook(fs);
- }
-
- /**
- * Creates a HSSFWorkbook from the given NPOIFSFileSystem
- * <p>Note that in order to properly release resources the
- * Workbook should be closed after use.
+ * Creates a HSSFWorkbook from the given NPOIFSFileSystem<p>
+ *
+ * Note that in order to properly release resources the
+ * Workbook should be closed after use.
+ *
+ * @param fs The {@link NPOIFSFileSystem} to read the document from
+ *
+ * @return The created workbook
+ *
+ * @throws IOException if an error occurs while reading the data
*/
public static Workbook create(NPOIFSFileSystem fs) throws IOException {
- try {
- return create(fs, null);
- } catch (InvalidFormatException e) {
- // Special case of OOXML-in-POIFS which is broken
- throw new IOException(e);
- }
+ return create(fs, null);
}
/**
@@ -78,28 +69,59 @@ public class WorkbookFactory {
* @return The created Workbook
*
* @throws IOException if an error occurs while reading the data
- * @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
*/
- private static Workbook create(final NPOIFSFileSystem fs, String password) throws IOException, InvalidFormatException {
- DirectoryNode root = fs.getRoot();
+ private static Workbook create(final NPOIFSFileSystem fs, String password) throws IOException {
+ return create(fs.getRoot(), password);
+ }
+
+
+ /**
+ * Creates a Workbook from the given NPOIFSFileSystem.
+ *
+ * @param root The {@link DirectoryNode} to start reading the document from
+ *
+ * @return The created Workbook
+ *
+ * @throws IOException if an error occurs while reading the data
+ */
+ public static Workbook create(final DirectoryNode root) throws IOException {
+ return create(root, null);
+ }
+
+ /**
+ * Creates a Workbook from the given NPOIFSFileSystem, which may
+ * be password protected
+ *
+ * @param root The {@link DirectoryNode} to start reading the document from
+ * @param password The password that should be used or null if no password is necessary.
+ *
+ * @return The created Workbook
+ *
+ * @throws IOException if an error occurs while reading the data
+ */
+ public static Workbook create(final DirectoryNode root, String password) throws IOException {
// Encrypted OOXML files go inside OLE2 containers, is this one?
if (root.hasEntry(Decryptor.DEFAULT_POIFS_ENTRY)) {
- InputStream stream = DocumentFactoryHelper.getDecryptedStream(fs, password);
+ InputStream stream = null;
+ try {
+ stream = DocumentFactoryHelper.getDecryptedStream(root, password);
- OPCPackage pkg = OPCPackage.open(stream);
- return create(pkg);
+ return createXSSFWorkbook(stream);
+ } finally {
+ IOUtils.closeQuietly(stream);
+ }
}
- // If we get here, it isn't an encrypted XLSX file
- // So, treat it as a regular HSSF XLS one
+ // If we get here, it isn't an encrypted PPTX file
+ // So, treat it as a regular HSLF PPT one
boolean passwordSet = false;
if (password != null) {
Biff8EncryptionKey.setCurrentUserPassword(password);
passwordSet = true;
}
try {
- return new HSSFWorkbook(root, true);
+ return createHSSFWorkbook(root);
} finally {
if (passwordSet) {
Biff8EncryptionKey.setCurrentUserPassword(null);
@@ -108,7 +130,9 @@ public class WorkbookFactory {
}
/**
- * Creates a XSSFWorkbook from the given OOXML Package
+ * Creates a XSSFWorkbook from the given OOXML Package.
+ * As the WorkbookFactory is located in the POI module, which doesn't know about the OOXML formats,
+ * this can be only achieved by using an Object reference to the OPCPackage.
*
* <p>Note that in order to properly release resources the
* Workbook should be closed after use.</p>
@@ -118,9 +142,13 @@ public class WorkbookFactory {
* @return The created Workbook
*
* @throws IOException if an error occurs while reading the data
+ *
+ * @deprecated use XSSFWorkbookFactory.create
*/
- public static Workbook create(OPCPackage pkg) throws IOException {
- return new XSSFWorkbook(pkg);
+ @Deprecated
+ @Removal(version = "4.2.0")
+ public static Workbook create(Object pkg) throws IOException {
+ return createXSSFWorkbook(pkg);
}
/**
@@ -128,8 +156,8 @@ public class WorkbookFactory {
* the given InputStream.
*
* <p>Your input stream MUST either support mark/reset, or
- * be wrapped as a {@link BufferedInputStream}! Note that
- * using an {@link InputStream} has a higher memory footprint
+ * be wrapped as a {@link BufferedInputStream}!
+ * Note that using an {@link InputStream} has a higher memory footprint
* than using a {@link File}.</p>
*
* <p>Note that in order to properly release resources the
@@ -142,24 +170,25 @@ public class WorkbookFactory {
* @return The created Workbook
*
* @throws IOException if an error occurs while reading the data
- * @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
- * @throws EncryptedDocumentException If the workbook given is password protected
+ * @throws EncryptedDocumentException If the Workbook given is password protected
*/
- public static Workbook create(InputStream inp) throws IOException, InvalidFormatException, EncryptedDocumentException {
+ public static Workbook create(InputStream inp) throws IOException, EncryptedDocumentException {
return create(inp, null);
}
/**
* Creates the appropriate HSSFWorkbook / XSSFWorkbook from
- * the given InputStream, which may be password protected.<p>
- *
- * Note that using an {@link InputStream} has a higher memory footprint
- * than using a {@link File}.<p>
+ * the given InputStream, which may be password protected.
*
- * Note that in order to properly release resources the
+ * <p>Your input stream MUST either support mark/reset, or
+ * be wrapped as a {@link BufferedInputStream}!
+ * Note that using an {@link InputStream} has a higher memory footprint
+ * than using a {@link File}.</p>
+ *
+ * <p>Note that in order to properly release resources the
* Workbook should be closed after use. Note also that loading
* from an InputStream requires more memory than loading
- * from a File, so prefer {@link #create(File)} where possible.
+ * from a File, so prefer {@link #create(File)} where possible.</p>
*
* @param inp The {@link InputStream} to read data from.
* @param password The password that should be used or null if no password is necessary.
@@ -167,23 +196,20 @@ public class WorkbookFactory {
* @return The created Workbook
*
* @throws IOException if an error occurs while reading the data
- * @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
* @throws EncryptedDocumentException If the wrong password is given for a protected file
- * @throws EmptyFileException If an empty stream is given
*/
- public static Workbook create(InputStream inp, String password) throws IOException, InvalidFormatException, EncryptedDocumentException {
+ public static Workbook create(InputStream inp, String password) throws IOException, EncryptedDocumentException {
InputStream is = FileMagic.prepareToCheckMagic(inp);
-
FileMagic fm = FileMagic.valueOf(is);
-
+
switch (fm) {
- case OLE2:
- NPOIFSFileSystem fs = new NPOIFSFileSystem(is);
- return create(fs, password);
- case OOXML:
- return new XSSFWorkbook(OPCPackage.open(is));
- default:
- throw new InvalidFormatException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
+ case OLE2:
+ NPOIFSFileSystem fs = new NPOIFSFileSystem(is);
+ return create(fs, password);
+ case OOXML:
+ return createXSSFWorkbook(is);
+ default:
+ throw new IOException("Your InputStream was neither an OLE2 stream, nor an OOXML stream");
}
}
@@ -198,10 +224,9 @@ public class WorkbookFactory {
* @return The created Workbook
*
* @throws IOException if an error occurs while reading the data
- * @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
- * @throws EncryptedDocumentException If the workbook given is password protected
+ * @throws EncryptedDocumentException If the Workbook given is password protected
*/
- public static Workbook create(File file) throws IOException, InvalidFormatException, EncryptedDocumentException {
+ public static Workbook create(File file) throws IOException, EncryptedDocumentException {
return create(file, null);
}
@@ -218,12 +243,10 @@ public class WorkbookFactory {
* @return The created Workbook
*
* @throws IOException if an error occurs while reading the data
- * @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
* @throws EncryptedDocumentException If the wrong password is given for a protected file
- * @throws EmptyFileException If an empty stream is given
*/
- public static Workbook create(File file, String password) throws IOException, InvalidFormatException, EncryptedDocumentException {
- return create(file, password, false);
+ public static Workbook create(File file, String password) throws IOException, EncryptedDocumentException {
+ return create(file, password, false);
}
/**
@@ -236,40 +259,71 @@ public class WorkbookFactory {
* @param file The file to read data from.
* @param password The password that should be used or null if no password is necessary.
* @param readOnly If the Workbook should be opened in read-only mode to avoid writing back
- * changes when the document is closed.
+ * changes when the document is closed.
*
* @return The created Workbook
*
* @throws IOException if an error occurs while reading the data
- * @throws InvalidFormatException if the contents of the file cannot be parsed into a {@link Workbook}
* @throws EncryptedDocumentException If the wrong password is given for a protected file
- * @throws EmptyFileException If an empty stream is given
*/
- public static Workbook create(File file, String password, boolean readOnly) throws IOException, InvalidFormatException, EncryptedDocumentException {
- if (! file.exists()) {
+ public static Workbook create(File file, String password, boolean readOnly) throws IOException, EncryptedDocumentException {
+ if (!file.exists()) {
throw new FileNotFoundException(file.toString());
}
- try (NPOIFSFileSystem fs = new NPOIFSFileSystem(file, readOnly)) {
+ NPOIFSFileSystem fs = null;
+ try {
+ fs = new NPOIFSFileSystem(file, readOnly);
return create(fs, password);
} catch(OfficeXmlFileException e) {
- // opening as .xls failed => try opening as .xlsx
- OPCPackage pkg = OPCPackage.open(file, readOnly ? PackageAccess.READ : PackageAccess.READ_WRITE); // NOSONAR
- try {
- return new XSSFWorkbook(pkg);
- } catch (Exception ioe) {
- // ensure that file handles are closed - use revert() to not re-write the file
- pkg.revert();
- // do not pkg.close();
-
- if (ioe instanceof IOException) {
- throw (IOException)ioe;
- } else if (ioe instanceof RuntimeException) {
- throw (RuntimeException)ioe;
- } else {
- throw new IOException(ioe);
+ IOUtils.closeQuietly(fs);
+ return createXSSFWorkbook(file, readOnly);
+ } catch(RuntimeException e) {
+ IOUtils.closeQuietly(fs);
+ throw e;
+ }
+ }
+
+ private static Workbook createHSSFWorkbook(Object... args) throws IOException, EncryptedDocumentException {
+ return createWorkbook("org.apache.poi.hssf.usermodel.HSSFWorkbookFactory", args);
+ }
+
+ private static Workbook createXSSFWorkbook(Object... args) throws IOException, EncryptedDocumentException {
+ return createWorkbook("org.apache.poi.xssf.usermodel.XSSFWorkbookFactory", args);
+ }
+
+ private static Workbook createWorkbook(String factoryClass, Object args[]) throws IOException, EncryptedDocumentException {
+ try {
+ Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(factoryClass);
+ Class<?> argsClz[] = new Class<?>[args.length];
+ int i=0;
+ for (Object o : args) {
+ Class<?> c = o.getClass();
+ if (Boolean.class.isAssignableFrom(c)) {
+ c = boolean.class;
+ } else if (InputStream.class.isAssignableFrom(c)) {
+ c = InputStream.class;
}
+ argsClz[i++] = c;
}
+ Method m = clazz.getMethod("createWorkbook", argsClz);
+ return (Workbook)m.invoke(null, args);
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof IOException) {
+ throw (IOException)t;
+ } else if (t instanceof EncryptedDocumentException) {
+ throw (EncryptedDocumentException)t;
+ } else if (t instanceof OldFileFormatException) {
+ throw (OldFileFormatException)t;
+ } else if (t instanceof RuntimeException) {
+ throw (RuntimeException)t;
+ } else {
+ throw new IOException(t.getMessage(), t);
+ }
+ } catch (Exception e) {
+ throw new IOException(e);
}
}
+
}
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocument.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocument.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocument.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocument.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
import java.io.Closeable;
import java.io.File;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
import java.io.IOException;
import java.net.URI;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLException.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLException.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLException.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLException.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLException.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLException.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLException.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
/**
* Indicates a generic OOXML error.
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLFactory.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLFactory.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLFactory.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLFactory.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLFactory.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
import java.lang.reflect.InvocationTargetException;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLProperties.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLProperties.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLProperties.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLProperties.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLProperties.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLProperties.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLProperties.java Sun May 27 21:59:18 2018
@@ -14,9 +14,9 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
-import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
+import static org.apache.poi.ooxml.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
import java.io.IOException;
import java.io.InputStream;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLRelation.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLRelation.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLRelation.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLRelation.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLRelation.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
import java.io.IOException;
import java.io.InputStream;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLTypeLoader.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLTypeLoader.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLTypeLoader.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/POIXMLTypeLoader.java Sun May 27 21:59:18 2018
@@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
import java.io.File;
import java.io.FileInputStream;
@@ -23,7 +23,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
-import java.lang.ref.WeakReference;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
@@ -32,8 +31,7 @@ import java.util.Map;
import javax.xml.stream.XMLStreamReader;
import org.apache.poi.openxml4j.opc.PackageNamespaces;
-import org.apache.poi.util.DocumentHelper;
-import org.apache.poi.util.Removal;
+import org.apache.poi.ooxml.util.DocumentHelper;
import org.apache.xmlbeans.SchemaType;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlBeans;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLLister.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLLister.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLLister.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLLister.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi.dev;
+package org.apache.poi.ooxml.dev;
import java.io.*;
import java.util.ArrayList;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLPrettyPrint.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLPrettyPrint.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/dev/OOXMLPrettyPrint.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi.dev;
+package org.apache.poi.ooxml.dev;
import java.io.BufferedOutputStream;
import java.io.File;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java Sun May 27 21:59:18 2018
@@ -14,11 +14,11 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi.extractor;
+package org.apache.poi.ooxml.extractor;
import java.io.File;
-import org.apache.poi.POITextExtractor;
+import org.apache.poi.extractor.POITextExtractor;
/**
* A command line wrapper around {@link ExtractorFactory}, useful
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi.extractor;
+package org.apache.poi.ooxml.extractor;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -25,9 +25,9 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.apache.poi.EncryptedDocumentException;
-import org.apache.poi.POIOLE2TextExtractor;
-import org.apache.poi.POITextExtractor;
-import org.apache.poi.POIXMLTextExtractor;
+import org.apache.poi.extractor.POIOLE2TextExtractor;
+import org.apache.poi.extractor.POITextExtractor;
+import org.apache.poi.extractor.OLE2ExtractorFactory;
import org.apache.poi.hsmf.MAPIMessage;
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
import org.apache.poi.hsmf.extractor.OutlookTextExtactor;
@@ -61,7 +61,6 @@ import org.apache.poi.xdgf.extractor.XDG
import org.apache.poi.xslf.extractor.XSLFPowerPointExtractor;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFRelation;
-import org.apache.poi.xslf.usermodel.XSLFSlideShow;
import org.apache.poi.xssf.extractor.XSSFBEventBasedExcelExtractor;
import org.apache.poi.xssf.extractor.XSSFEventBasedExcelExtractor;
import org.apache.poi.xssf.extractor.XSSFExcelExtractor;
@@ -125,7 +124,7 @@ public class ExtractorFactory {
* Should this thread use event based extractors is available?
* Checks the all-threads one first, then thread specific.
*/
- protected static boolean getPreferEventExtractor() {
+ public static boolean getPreferEventExtractor() {
return OLE2ExtractorFactory.getPreferEventExtractor();
}
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java Sun May 27 21:59:18 2018
@@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml.extractor;
import java.math.BigDecimal;
import java.text.DateFormat;
@@ -24,6 +24,8 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
+import org.apache.poi.extractor.POITextExtractor;
+import org.apache.poi.ooxml.POIXMLDocument;
import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
import org.apache.poi.util.LocaleUtil;
import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLTextExtractor.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLTextExtractor.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLTextExtractor.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLTextExtractor.java Sun May 27 21:59:18 2018
@@ -15,13 +15,15 @@
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml.extractor;
import java.io.IOException;
-import org.apache.poi.POIXMLProperties.CoreProperties;
-import org.apache.poi.POIXMLProperties.CustomProperties;
-import org.apache.poi.POIXMLProperties.ExtendedProperties;
+import org.apache.poi.extractor.POITextExtractor;
+import org.apache.poi.ooxml.POIXMLDocument;
+import org.apache.poi.ooxml.POIXMLProperties.CoreProperties;
+import org.apache.poi.ooxml.POIXMLProperties.CustomProperties;
+import org.apache.poi.ooxml.POIXMLProperties.ExtendedProperties;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.util.ZipSecureFile;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/DocumentHelper.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/util/DocumentHelper.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/util/DocumentHelper.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java Sun May 27 21:59:18 2018
@@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
-package org.apache.poi.util;
+package org.apache.poi.ooxml.util;
import java.io.IOException;
import java.io.InputStream;
@@ -27,6 +27,8 @@ import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.events.Namespace;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.ErrorHandler;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/IdentifierManager.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/IdentifierManager.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/IdentifierManager.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/IdentifierManager.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/util/IdentifierManager.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/util/IdentifierManager.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/IdentifierManager.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi.util;
+package org.apache.poi.ooxml.util;
import java.util.LinkedList;
import java.util.ListIterator;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/PackageHelper.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/PackageHelper.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/PackageHelper.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/PackageHelper.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/util/PackageHelper.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/util/PackageHelper.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/PackageHelper.java Sun May 27 21:59:18 2018
@@ -15,13 +15,14 @@
limitations under the License.
==================================================================== */
-package org.apache.poi.util;
+package org.apache.poi.ooxml.util;
import org.apache.poi.openxml4j.opc.*;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
-import org.apache.poi.POIXMLException;
+import org.apache.poi.ooxml.POIXMLException;
+import org.apache.poi.util.IOUtils;
import java.io.*;
import java.net.URI;
Copied: poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/SAXHelper.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/SAXHelper.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/SAXHelper.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/SAXHelper.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/util/SAXHelper.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/util/SAXHelper.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/SAXHelper.java Sun May 27 21:59:18 2018
@@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
-package org.apache.poi.util;
+package org.apache.poi.ooxml.util;
import java.io.IOException;
import java.io.StringReader;
@@ -26,6 +26,8 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
Copied: poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java (from r1832357, poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java?p2=poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java&p1=poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi.extractor;
+package org.apache.poi.extractor.ooxml;
import static org.apache.poi.POITestCase.assertContains;
import static org.junit.Assert.assertEquals;
@@ -30,9 +30,9 @@ import java.io.IOException;
import java.util.Locale;
import org.apache.poi.POIDataSamples;
-import org.apache.poi.POIOLE2TextExtractor;
-import org.apache.poi.POITextExtractor;
-import org.apache.poi.POIXMLTextExtractor;
+import org.apache.poi.extractor.POIOLE2TextExtractor;
+import org.apache.poi.extractor.POITextExtractor;
+import org.apache.poi.ooxml.extractor.POIXMLTextExtractor;
import org.apache.poi.UnsupportedFileFormatException;
import org.apache.poi.hdgf.extractor.VisioTextExtractor;
import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
@@ -43,6 +43,7 @@ import org.apache.poi.hssf.extractor.Eve
import org.apache.poi.hssf.extractor.ExcelExtractor;
import org.apache.poi.hwpf.extractor.Word6Extractor;
import org.apache.poi.hwpf.extractor.WordExtractor;
+import org.apache.poi.ooxml.extractor.ExtractorFactory;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
Copied: poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLDocument.java (from r1832357, poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLDocument.java?p2=poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLDocument.java&p1=poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLDocument.java Sun May 27 21:59:18 2018
@@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -35,7 +35,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import org.apache.poi.POIXMLDocumentPart.RelationPart;
+import org.apache.poi.POIDataSamples;
+import org.apache.poi.ooxml.POIXMLDocumentPart.RelationPart;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
import org.apache.poi.openxml4j.opc.OPCPackage;
@@ -43,7 +44,7 @@ import org.apache.poi.openxml4j.opc.Pack
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.NullOutputStream;
-import org.apache.poi.util.PackageHelper;
+import org.apache.poi.ooxml.util.PackageHelper;
import org.apache.poi.util.TempFile;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xssf.usermodel.XSSFRelation;
Copied: poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java (from r1832357, poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java?p2=poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java&p1=poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java Sun May 27 21:59:18 2018
@@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
-package org.apache.poi;
+package org.apache.poi.ooxml;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -28,7 +28,7 @@ import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
-import org.apache.poi.POIXMLProperties.CoreProperties;
+import org.apache.poi.ooxml.POIXMLProperties.CoreProperties;
import org.apache.poi.openxml4j.util.Nullable;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LocaleUtil;
@@ -73,7 +73,7 @@ public final class TestPOIXMLProperties
POIXMLProperties props = workbook.getProperties();
assertNotNull(props);
- org.apache.poi.POIXMLProperties.ExtendedProperties properties =
+ POIXMLProperties.ExtendedProperties properties =
props.getExtendedProperties();
org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTProperties
@@ -94,7 +94,7 @@ public final class TestPOIXMLProperties
POIXMLProperties newProps = newWorkbook.getProperties();
assertNotNull(newProps);
- org.apache.poi.POIXMLProperties.ExtendedProperties newProperties =
+ POIXMLProperties.ExtendedProperties newProperties =
newProps.getExtendedProperties();
assertEquals(application, newProperties.getApplication());
Copied: poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java (from r1832357, poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java?p2=poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java Sun May 27 21:59:18 2018
@@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
-package org.apache.poi.util;
+package org.apache.poi.ooxml.util;
import java.io.File;
import java.io.IOException;
@@ -40,6 +40,9 @@ import java.util.regex.Pattern;
import junit.framework.TestCase;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.SuppressForbidden;
import org.junit.Test;
import org.junit.internal.TextListener;
import org.junit.runner.Description;
Copied: poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/TestSAXHelper.java (from r1832357, poi/trunk/src/ooxml/testcases/org/apache/poi/util/TestSAXHelper.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/TestSAXHelper.java?p2=poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/TestSAXHelper.java&p1=poi/trunk/src/ooxml/testcases/org/apache/poi/util/TestSAXHelper.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/util/TestSAXHelper.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/ooxml/util/TestSAXHelper.java Sun May 27 21:59:18 2018
@@ -14,7 +14,14 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi.util;
+package org.apache.poi.ooxml.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
import javax.xml.XMLConstants;
@@ -22,10 +29,6 @@ import org.junit.Test;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
-import java.io.ByteArrayInputStream;
-
-import static org.junit.Assert.*;
-
public class TestSAXHelper {
@Test
public void testXMLReader() throws Exception {
Copied: poi/trunk/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java (from r1832357, poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java?p2=poi/trunk/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java&p1=poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java&r1=1832357&r2=1832358&rev=1832358&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java Sun May 27 21:59:18 2018
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-package org.apache.poi.extractor;
+package org.apache.poi.extractor.ole2;
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
@@ -23,11 +23,11 @@ import java.io.InputStream;
import java.util.Iterator;
import java.util.List;
-import org.apache.poi.POIOLE2TextExtractor;
-import org.apache.poi.POITextExtractor;
+import org.apache.poi.extractor.POIOLE2TextExtractor;
+import org.apache.poi.extractor.POITextExtractor;
+import org.apache.poi.extractor.OLE2ExtractorFactory;
import org.apache.poi.hdgf.extractor.VisioTextExtractor;
import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
-import org.apache.poi.hslf.extractor.PowerPointExtractor;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hsmf.MAPIMessage;
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org
|