From 54f191b613833e874bf7e65f57d9d9d4ef4bace8 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sun, 27 May 2018 21:59:18 +0000 Subject: [PATCH] #62355 - unsplit packages - 1 - moved classes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1832358 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/POIReadOnlyDocument.java | 0 .../{ => extractor}/POIOLE2TextExtractor.java | 3 +- .../poi/{ => extractor}/POITextExtractor.java | 2 +- .../apache/poi/hssf/usermodel/HSSFChart.java | 0 .../apache/poi/ss/extractor/EmbeddedData.java | 0 .../poi/ss/extractor/EmbeddedExtractor.java | 7 +- .../poi/ss/usermodel/WorkbookFactory.java | 228 +++++++++++------- .../poi/{ => ooxml}/POIXMLDocument.java | 2 +- .../poi/{ => ooxml}/POIXMLDocumentPart.java | 2 +- .../poi/{ => ooxml}/POIXMLException.java | 2 +- .../apache/poi/{ => ooxml}/POIXMLFactory.java | 2 +- .../poi/{ => ooxml}/POIXMLProperties.java | 4 +- .../poi/{ => ooxml}/POIXMLRelation.java | 2 +- .../poi/{ => ooxml}/POIXMLTypeLoader.java | 6 +- .../poi/{ => ooxml}/dev/OOXMLLister.java | 2 +- .../poi/{ => ooxml}/dev/OOXMLPrettyPrint.java | 2 +- .../extractor/CommandLineTextExtractor.java | 4 +- .../extractor/ExtractorFactory.java | 11 +- .../POIXMLPropertiesTextExtractor.java | 4 +- .../extractor}/POIXMLTextExtractor.java | 10 +- .../poi/{ => ooxml}/util/DocumentHelper.java | 4 +- .../{ => ooxml}/util/IdentifierManager.java | 2 +- .../poi/{ => ooxml}/util/PackageHelper.java | 5 +- .../poi/{ => ooxml}/util/SAXHelper.java | 4 +- .../{ => ooxml}/TestExtractorFactory.java | 9 +- .../poi/{ => ooxml}/TestPOIXMLDocument.java | 7 +- .../poi/{ => ooxml}/TestPOIXMLProperties.java | 8 +- .../org/apache/poi/ooxml}/util/OOXMLLite.java | 5 +- .../poi/{ => ooxml}/util/TestSAXHelper.java | 13 +- .../OLE2ScratchpadExtractorFactory.java | 8 +- .../poi/hssf/converter/ExcelToFoUtils.java | 25 -- .../org/apache/poi/dev/RecordGenerator.java | 0 32 files changed, 211 insertions(+), 172 deletions(-) rename src/{scratchpad/src => java}/org/apache/poi/POIReadOnlyDocument.java (100%) rename src/java/org/apache/poi/{ => extractor}/POIOLE2TextExtractor.java (98%) rename src/java/org/apache/poi/{ => extractor}/POITextExtractor.java (98%) rename src/{scratchpad/src => java}/org/apache/poi/hssf/usermodel/HSSFChart.java (100%) rename src/{ooxml => }/java/org/apache/poi/ss/extractor/EmbeddedData.java (100%) rename src/{ooxml => }/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java (97%) rename src/{ooxml => }/java/org/apache/poi/ss/usermodel/WorkbookFactory.java (56%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/POIXMLDocument.java (99%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/POIXMLDocumentPart.java (99%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/POIXMLException.java (98%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/POIXMLFactory.java (99%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/POIXMLProperties.java (99%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/POIXMLRelation.java (99%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/POIXMLTypeLoader.java (98%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/dev/OOXMLLister.java (99%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/dev/OOXMLPrettyPrint.java (99%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/extractor/CommandLineTextExtractor.java (96%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/extractor/ExtractorFactory.java (98%) rename src/ooxml/java/org/apache/poi/{ => ooxml/extractor}/POIXMLPropertiesTextExtractor.java (98%) rename src/ooxml/java/org/apache/poi/{ => ooxml/extractor}/POIXMLTextExtractor.java (92%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/util/DocumentHelper.java (98%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/util/IdentifierManager.java (99%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/util/PackageHelper.java (97%) rename src/ooxml/java/org/apache/poi/{ => ooxml}/util/SAXHelper.java (98%) rename src/ooxml/testcases/org/apache/poi/extractor/{ => ooxml}/TestExtractorFactory.java (98%) rename src/ooxml/testcases/org/apache/poi/{ => ooxml}/TestPOIXMLDocument.java (98%) rename src/ooxml/testcases/org/apache/poi/{ => ooxml}/TestPOIXMLProperties.java (97%) rename src/ooxml/{java/org/apache/poi => testcases/org/apache/poi/ooxml}/util/OOXMLLite.java (98%) rename src/ooxml/testcases/org/apache/poi/{ => ooxml}/util/TestSAXHelper.java (89%) rename src/scratchpad/src/org/apache/poi/extractor/{ => ole2}/OLE2ScratchpadExtractorFactory.java (97%) delete mode 100644 src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoUtils.java rename src/{java => testcases}/org/apache/poi/dev/RecordGenerator.java (100%) diff --git a/src/scratchpad/src/org/apache/poi/POIReadOnlyDocument.java b/src/java/org/apache/poi/POIReadOnlyDocument.java similarity index 100% rename from src/scratchpad/src/org/apache/poi/POIReadOnlyDocument.java rename to src/java/org/apache/poi/POIReadOnlyDocument.java diff --git a/src/java/org/apache/poi/POIOLE2TextExtractor.java b/src/java/org/apache/poi/extractor/POIOLE2TextExtractor.java similarity index 98% rename from src/java/org/apache/poi/POIOLE2TextExtractor.java rename to src/java/org/apache/poi/extractor/POIOLE2TextExtractor.java index 0fccf71c4a..465de40375 100644 --- a/src/java/org/apache/poi/POIOLE2TextExtractor.java +++ b/src/java/org/apache/poi/extractor/POIOLE2TextExtractor.java @@ -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; diff --git a/src/java/org/apache/poi/POITextExtractor.java b/src/java/org/apache/poi/extractor/POITextExtractor.java similarity index 98% rename from src/java/org/apache/poi/POITextExtractor.java rename to src/java/org/apache/poi/extractor/POITextExtractor.java index 55d0832f16..e32adcb12c 100644 --- a/src/java/org/apache/poi/POITextExtractor.java +++ b/src/java/org/apache/poi/extractor/POITextExtractor.java @@ -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; diff --git a/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java b/src/java/org/apache/poi/hssf/usermodel/HSSFChart.java similarity index 100% rename from src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java rename to src/java/org/apache/poi/hssf/usermodel/HSSFChart.java diff --git a/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedData.java b/src/java/org/apache/poi/ss/extractor/EmbeddedData.java similarity index 100% rename from src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedData.java rename to src/java/org/apache/poi/ss/extractor/EmbeddedData.java diff --git a/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java b/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java similarity index 97% rename from src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java rename to src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java index 8ea6df28a6..965a4d1a9e 100644 --- a/src/ooxml/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java +++ b/src/java/org/apache/poi/ss/extractor/EmbeddedExtractor.java @@ -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 implements Iterable { 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); diff --git a/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java b/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java similarity index 56% rename from src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java rename to src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java index 1a4c2cb1d5..d62fdfc85f 100644 --- a/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java +++ b/src/java/org/apache/poi/ss/usermodel/WorkbookFactory.java @@ -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 - *

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 - *

Note that in order to properly release resources the - * Workbook should be closed after use. + * Creates a HSSFWorkbook from the given NPOIFSFileSystem

+ * + * 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. * *

Note that in order to properly release resources the * Workbook should be closed after use.

@@ -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. * *

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}.

* *

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.

- * - * Note that using an {@link InputStream} has a higher memory footprint - * than using a {@link File}.

+ * the given InputStream, which may be password protected. * - * Note that in order to properly release resources the + *

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}.

+ * + *

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.

* * @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(); + 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); + } - if (ioe instanceof IOException) { - throw (IOException)ioe; - } else if (ioe instanceof RuntimeException) { - throw (RuntimeException)ioe; - } else { - throw new IOException(ioe); + 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); } } + } diff --git a/src/ooxml/java/org/apache/poi/POIXMLDocument.java b/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocument.java similarity index 99% rename from src/ooxml/java/org/apache/poi/POIXMLDocument.java rename to src/ooxml/java/org/apache/poi/ooxml/POIXMLDocument.java index a7eaaf2c87..8925776b9e 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLDocument.java +++ b/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocument.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java b/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java similarity index 99% rename from src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java rename to src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java index e977e6ea39..5a368c576a 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java +++ b/src/ooxml/java/org/apache/poi/ooxml/POIXMLDocumentPart.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/POIXMLException.java b/src/ooxml/java/org/apache/poi/ooxml/POIXMLException.java similarity index 98% rename from src/ooxml/java/org/apache/poi/POIXMLException.java rename to src/ooxml/java/org/apache/poi/ooxml/POIXMLException.java index 82832ecff8..d002fa0e84 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLException.java +++ b/src/ooxml/java/org/apache/poi/ooxml/POIXMLException.java @@ -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. diff --git a/src/ooxml/java/org/apache/poi/POIXMLFactory.java b/src/ooxml/java/org/apache/poi/ooxml/POIXMLFactory.java similarity index 99% rename from src/ooxml/java/org/apache/poi/POIXMLFactory.java rename to src/ooxml/java/org/apache/poi/ooxml/POIXMLFactory.java index 651f40cbc1..ca6cdb30c0 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLFactory.java +++ b/src/ooxml/java/org/apache/poi/ooxml/POIXMLFactory.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/POIXMLProperties.java b/src/ooxml/java/org/apache/poi/ooxml/POIXMLProperties.java similarity index 99% rename from src/ooxml/java/org/apache/poi/POIXMLProperties.java rename to src/ooxml/java/org/apache/poi/ooxml/POIXMLProperties.java index b956b7ee55..04ca65fb21 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLProperties.java +++ b/src/ooxml/java/org/apache/poi/ooxml/POIXMLProperties.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/POIXMLRelation.java b/src/ooxml/java/org/apache/poi/ooxml/POIXMLRelation.java similarity index 99% rename from src/ooxml/java/org/apache/poi/POIXMLRelation.java rename to src/ooxml/java/org/apache/poi/ooxml/POIXMLRelation.java index 55d162c5f3..c661ce8e20 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLRelation.java +++ b/src/ooxml/java/org/apache/poi/ooxml/POIXMLRelation.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java b/src/ooxml/java/org/apache/poi/ooxml/POIXMLTypeLoader.java similarity index 98% rename from src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java rename to src/ooxml/java/org/apache/poi/ooxml/POIXMLTypeLoader.java index 8578a8333f..123c0b5786 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLTypeLoader.java +++ b/src/ooxml/java/org/apache/poi/ooxml/POIXMLTypeLoader.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java b/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLLister.java similarity index 99% rename from src/ooxml/java/org/apache/poi/dev/OOXMLLister.java rename to src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLLister.java index cbbca45cf9..177f9f9335 100644 --- a/src/ooxml/java/org/apache/poi/dev/OOXMLLister.java +++ b/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLLister.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/dev/OOXMLPrettyPrint.java b/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java similarity index 99% rename from src/ooxml/java/org/apache/poi/dev/OOXMLPrettyPrint.java rename to src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java index e8ae9eb103..47ec47055e 100644 --- a/src/ooxml/java/org/apache/poi/dev/OOXMLPrettyPrint.java +++ b/src/ooxml/java/org/apache/poi/ooxml/dev/OOXMLPrettyPrint.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java b/src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java similarity index 96% rename from src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java rename to src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java index 264daa028f..999abd46ee 100644 --- a/src/ooxml/java/org/apache/poi/extractor/CommandLineTextExtractor.java +++ b/src/ooxml/java/org/apache/poi/ooxml/extractor/CommandLineTextExtractor.java @@ -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 diff --git a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java b/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java similarity index 98% rename from src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java rename to src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java index 9a7765af0d..6603f58582 100644 --- a/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java +++ b/src/ooxml/java/org/apache/poi/ooxml/extractor/ExtractorFactory.java @@ -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.XDGFVisioExtractor; 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(); } diff --git a/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java b/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java similarity index 98% rename from src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java rename to src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java index f0fe9c30f7..47c37e84b4 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLPropertiesTextExtractor.java +++ b/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLPropertiesTextExtractor.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java b/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLTextExtractor.java similarity index 92% rename from src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java rename to src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLTextExtractor.java index 003fe353f1..ada32a1cc0 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLTextExtractor.java +++ b/src/ooxml/java/org/apache/poi/ooxml/extractor/POIXMLTextExtractor.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/util/DocumentHelper.java b/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java similarity index 98% rename from src/ooxml/java/org/apache/poi/util/DocumentHelper.java rename to src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java index 569c5ff719..d79237d8ac 100644 --- a/src/ooxml/java/org/apache/poi/util/DocumentHelper.java +++ b/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java @@ -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.DocumentBuilderFactory; 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; diff --git a/src/ooxml/java/org/apache/poi/util/IdentifierManager.java b/src/ooxml/java/org/apache/poi/ooxml/util/IdentifierManager.java similarity index 99% rename from src/ooxml/java/org/apache/poi/util/IdentifierManager.java rename to src/ooxml/java/org/apache/poi/ooxml/util/IdentifierManager.java index a863dabe60..f367473cc3 100644 --- a/src/ooxml/java/org/apache/poi/util/IdentifierManager.java +++ b/src/ooxml/java/org/apache/poi/ooxml/util/IdentifierManager.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/util/PackageHelper.java b/src/ooxml/java/org/apache/poi/ooxml/util/PackageHelper.java similarity index 97% rename from src/ooxml/java/org/apache/poi/util/PackageHelper.java rename to src/ooxml/java/org/apache/poi/ooxml/util/PackageHelper.java index e950323116..1385848428 100644 --- a/src/ooxml/java/org/apache/poi/util/PackageHelper.java +++ b/src/ooxml/java/org/apache/poi/ooxml/util/PackageHelper.java @@ -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; diff --git a/src/ooxml/java/org/apache/poi/util/SAXHelper.java b/src/ooxml/java/org/apache/poi/ooxml/util/SAXHelper.java similarity index 98% rename from src/ooxml/java/org/apache/poi/util/SAXHelper.java rename to src/ooxml/java/org/apache/poi/ooxml/util/SAXHelper.java index b5968d9ff9..630e5540ab 100644 --- a/src/ooxml/java/org/apache/poi/util/SAXHelper.java +++ b/src/ooxml/java/org/apache/poi/ooxml/util/SAXHelper.java @@ -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; diff --git a/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java b/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java similarity index 98% rename from src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java rename to src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java index 0a885377a6..be58e3d699 100644 --- a/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java +++ b/src/ooxml/testcases/org/apache/poi/extractor/ooxml/TestExtractorFactory.java @@ -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.EventBasedExcelExtractor; 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; diff --git a/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java b/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLDocument.java similarity index 98% rename from src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java rename to src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLDocument.java index 21c003c297..d27da22bf0 100644 --- a/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java +++ b/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLDocument.java @@ -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.PackagePart; 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; diff --git a/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java b/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java similarity index 97% rename from src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java rename to src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java index 8ecb65131b..a2d5f2b163 100644 --- a/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java +++ b/src/ooxml/testcases/org/apache/poi/ooxml/TestPOIXMLProperties.java @@ -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()); diff --git a/src/ooxml/java/org/apache/poi/util/OOXMLLite.java b/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java similarity index 98% rename from src/ooxml/java/org/apache/poi/util/OOXMLLite.java rename to src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java index 06c57c464b..e17b684d6f 100644 --- a/src/ooxml/java/org/apache/poi/util/OOXMLLite.java +++ b/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java @@ -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; diff --git a/src/ooxml/testcases/org/apache/poi/util/TestSAXHelper.java b/src/ooxml/testcases/org/apache/poi/ooxml/util/TestSAXHelper.java similarity index 89% rename from src/ooxml/testcases/org/apache/poi/util/TestSAXHelper.java rename to src/ooxml/testcases/org/apache/poi/ooxml/util/TestSAXHelper.java index 04f3a7a267..825cdf40f5 100644 --- a/src/ooxml/testcases/org/apache/poi/util/TestSAXHelper.java +++ b/src/ooxml/testcases/org/apache/poi/ooxml/util/TestSAXHelper.java @@ -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 { diff --git a/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java b/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java similarity index 97% rename from src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java rename to src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java index f77d0834f9..1e3ebdc74e 100644 --- a/src/scratchpad/src/org/apache/poi/extractor/OLE2ScratchpadExtractorFactory.java +++ b/src/scratchpad/src/org/apache/poi/extractor/ole2/OLE2ScratchpadExtractorFactory.java @@ -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; diff --git a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoUtils.java b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoUtils.java deleted file mode 100644 index 2682550b2a..0000000000 --- a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ -package org.apache.poi.hssf.converter; - -import org.apache.poi.util.Beta; - -@Beta -public class ExcelToFoUtils extends AbstractExcelUtils -{ - -} diff --git a/src/java/org/apache/poi/dev/RecordGenerator.java b/src/testcases/org/apache/poi/dev/RecordGenerator.java similarity index 100% rename from src/java/org/apache/poi/dev/RecordGenerator.java rename to src/testcases/org/apache/poi/dev/RecordGenerator.java -- 2.39.5