Author: fanningpj
Date: Sat Dec 18 17:13:03 2021
New Revision: 1896138

URL: http://svn.apache.org/viewvc?rev=1896138&view=rev
Log:
code tidy up

Modified:
    poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java
    poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
    poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java

Modified: 
poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java?rev=1896138&r1=1896137&r2=1896138&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java 
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java 
Sat Dec 18 17:13:03 2021
@@ -243,8 +243,9 @@ public final class ExtractorFactory {
             throw new IOException("Can't create extractor - unsupported file 
type: "+fm);
         }
 
-        POIFSFileSystem poifs = new POIFSFileSystem(file, true);
+        POIFSFileSystem poifs = null;
         try {
+            poifs = new POIFSFileSystem(file, true);
             DirectoryNode root = poifs.getRoot();
             boolean isOOXML = root.hasEntry(DEFAULT_POIFS_ENTRY) || 
root.hasEntry(OOXML_PACKAGE);
             return wp(isOOXML ? FileMagic.OOXML : fm, w -> w.create(root, 
password));

Modified: 
poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=1896138&r1=1896137&r2=1896138&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java 
(original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java 
Sat Dec 18 17:13:03 2021
@@ -269,6 +269,8 @@ public final class HSSFWorkbook extends
      * preserve nodes set to true.
      *
      * @throws IOException if the stream cannot be read
+     * @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     * input format
      * @see #HSSFWorkbook(POIFSFileSystem, boolean)
      * @see POIFSFileSystem
      */
@@ -286,6 +288,8 @@ public final class HSSFWorkbook extends
      *                      need to. If set, will store all of the 
POIFSFileSystem
      *                      in memory
      * @throws IOException if the stream cannot be read
+     * @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     * input format
      * @see POIFSFileSystem
      */
     public HSSFWorkbook(POIFSFileSystem fs, boolean preserveNodes)
@@ -333,6 +337,8 @@ public final class HSSFWorkbook extends
      *                      need to. If set, will store all of the 
POIFSFileSystem
      *                      in memory
      * @throws IOException if the stream cannot be read
+     * @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     * input format
      * @see POIFSFileSystem
      */
     public HSSFWorkbook(DirectoryNode directory, POIFSFileSystem fs, boolean 
preserveNodes)
@@ -351,6 +357,8 @@ public final class HSSFWorkbook extends
      *                      need to. If set, will store all of the 
POIFSFileSystem
      *                      in memory
      * @throws IOException if the stream cannot be read
+     * @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     * input format
      * @see POIFSFileSystem
      */
     public HSSFWorkbook(DirectoryNode directory, boolean preserveNodes)
@@ -406,6 +414,8 @@ public final class HSSFWorkbook extends
      * preserve nodes set to true.
      *
      * @throws IOException if the stream cannot be read
+     * @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     * input format
      * @see #HSSFWorkbook(InputStream, boolean)
      * @see #HSSFWorkbook(POIFSFileSystem)
      * @see POIFSFileSystem
@@ -423,6 +433,8 @@ public final class HSSFWorkbook extends
      *                      macros.  This takes more memory, so only say yes 
if you
      *                      need to.
      * @throws IOException if the stream cannot be read
+     * @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     * input format
      * @see POIFSFileSystem
      * @see #HSSFWorkbook(POIFSFileSystem)
      */

Modified: 
poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java?rev=1896138&r1=1896137&r2=1896138&view=diff
==============================================================================
--- 
poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java 
(original)
+++ 
poi/trunk/poi/src/main/java/org/apache/poi/ss/usermodel/WorkbookFactory.java 
Sat Dec 18 17:13:03 2021
@@ -67,6 +67,8 @@ public final class WorkbookFactory {
      * @return The created workbook
      *
      * @throws IOException if an error occurs while creating the objects
+     * @throws RuntimeException a number of other runtime exceptions can be 
thrown, especially if there are problems with the
+     * input format
      */
     public static Workbook create(boolean xssf) throws IOException {
         return wp(xssf ? FileMagic.OOXML : FileMagic.OLE2, 
WorkbookProvider::create);
@@ -83,6 +85,8 @@ public final class WorkbookFactory {
      * @return The created workbook
      *
      * @throws IOException if an error occurs while reading the data
+     * @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     * input format
      */
     public static Workbook create(POIFSFileSystem fs) throws IOException {
         return create(fs, null);
@@ -101,6 +105,8 @@ public final class WorkbookFactory {
      *  @return The created Workbook
      *
      *  @throws IOException if an error occurs while reading the data
+     *  @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     *  input format
      */
     private static Workbook create(final POIFSFileSystem fs, String password) 
throws IOException {
         return create(fs.getRoot(), password);
@@ -118,6 +124,8 @@ public final class WorkbookFactory {
      * @return The created Workbook
      *
      * @throws IOException if an error occurs while reading the data
+     * @throws RuntimeException a number of other exceptions can be thrown, 
especially if there are problems with the
+     * input format
      */
     public static Workbook create(final DirectoryNode root) throws IOException 
{
         return create(root, null);
@@ -137,6 +145,8 @@ public final class WorkbookFactory {
      * @return The created Workbook
      *
      * @throws IOException if an error occurs while reading the data
+     * @throws RuntimeException a number of runtime exceptions can be thrown, 
especially if there are problems with the
+     * input format
      */
     public static Workbook create(final DirectoryNode root, String password) 
throws IOException {
         // Encrypted OOXML files go inside OLE2 containers, is this one?
@@ -168,6 +178,8 @@ public final class WorkbookFactory {
      *  @throws IOException if an error occurs while reading the data
      *  @throws EncryptedDocumentException If the Workbook given is password 
protected
         *  @throws EmptyFileException If the given data is empty
+     *  @throws RuntimeException a number of other runtime exceptions can be 
thrown, especially if there are problems with the
+     *  input format
      */
     public static Workbook create(InputStream inp) throws IOException, 
EncryptedDocumentException {
         return create(inp, null);
@@ -195,6 +207,8 @@ public final class WorkbookFactory {
      *  @throws IOException if an error occurs while reading the data
      *  @throws EncryptedDocumentException If the wrong password is given for 
a protected file
         *  @throws EmptyFileException If the given data is empty
+     *  @throws RuntimeException a number of other runtime exceptions can be 
thrown, especially if there are problems with the
+     *  input format
      */
     public static Workbook create(InputStream inp, String password) throws 
IOException, EncryptedDocumentException {
         InputStream is = FileMagic.prepareToCheckMagic(inp);
@@ -234,6 +248,8 @@ public final class WorkbookFactory {
      *  @throws IOException if an error occurs while reading the data
      *  @throws EncryptedDocumentException If the Workbook given is password 
protected
         *  @throws EmptyFileException If the given data is empty
+     *  @throws RuntimeException a number of other runtime exceptions can be 
thrown, especially if there are problems with the
+     *  input format
      */
     public static Workbook create(File file) throws IOException, 
EncryptedDocumentException {
         return create(file, null);
@@ -254,6 +270,8 @@ public final class WorkbookFactory {
      *  @throws IOException if an error occurs while reading the data
      *  @throws EncryptedDocumentException If the wrong password is given for 
a protected file
         *  @throws EmptyFileException If the given data is empty
+     *  @throws RuntimeException a number of other runtime exceptions can be 
thrown, especially if there are problems with the
+     *  input format
      */
     public static Workbook create(File file, String password) throws 
IOException, EncryptedDocumentException {
         return create(file, password, false);
@@ -276,6 +294,8 @@ public final class WorkbookFactory {
      *  @throws IOException if an error occurs while reading the data
      *  @throws EncryptedDocumentException If the wrong password is given for 
a protected file
         *  @throws EmptyFileException If the given data is empty
+     *  @throws RuntimeException a number of other runtime exceptions can be 
thrown, especially if there are problems with the
+     *  input format
      */
     public static Workbook create(File file, String password, boolean 
readOnly) throws IOException, EncryptedDocumentException {
         if (!file.exists()) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to