Author: fanningpj
Date: Tue Jul  2 00:02:47 2024
New Revision: 1918808

URL: http://svn.apache.org/viewvc?rev=1918808&view=rev
Log:
try to fix tests

Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java?rev=1918808&r1=1918807&r2=1918808&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java 
(original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java 
Tue Jul  2 00:02:47 2024
@@ -48,6 +48,7 @@ public final class PackageHelper {
      * @param stream The InputStream to read from - which is closed when it is 
read
      * @return OPCPackage
      * @throws IOException If reading data from the stream fails
+     * @throws POIXMLException If the stream is not a valid OPC package
      */
     public static OPCPackage open(InputStream stream) throws IOException {
         return open(stream, true);
@@ -58,6 +59,7 @@ public final class PackageHelper {
      * @param closeStream whether to close the stream
      * @return OPCPackage
      * @throws IOException If reading data from the stream fails
+     * @throws POIXMLException If the stream is not a valid OPC package
      * @since POI 5.2.0
      */
     public static OPCPackage open(InputStream stream, boolean closeStream) 
throws IOException {
@@ -65,10 +67,10 @@ public final class PackageHelper {
             return OPCPackage.open(stream, closeStream);
         } catch (InvalidFormatException e) {
             final Throwable cause = e.getCause();
-            if (cause instanceof IOException) {
-                throw (IOException) cause;
+            if (cause instanceof InvalidZipException) {
+                throw (InvalidZipException) cause;
             }
-            throw new IOException(e);
+            throw new POIXMLException(e);
         } finally {
             if (closeStream) {
                 stream.close();

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java?rev=1918808&r1=1918807&r2=1918808&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java 
(original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/OPCPackage.java 
Tue Jul  2 00:02:47 2024
@@ -326,7 +326,8 @@ public abstract class OPCPackage impleme
             pack = new ZipPackage(in, PackageAccess.READ_WRITE);
         } catch (InvalidZipException e) {
             throw new InvalidFormatException(e.getMessage(), e);
-        }        try {
+        }
+        try {
             if (pack.partList == null) {
                 pack.getParts();
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org
For additional commands, e-mail: commits-h...@poi.apache.org

Reply via email to