You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2017/05/24 08:16:01 UTC

svn commit: r1796008 - /xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java

Author: ssteiner
Date: Wed May 24 08:16:01 2017
New Revision: 1796008

URL: http://svn.apache.org/viewvc?rev=1796008&view=rev
Log:
XGC-98: UndeclaredThrowableException while loading images

Modified:
    xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java

Modified: xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java?rev=1796008&r1=1796007&r2=1796008&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java (original)
+++ xmlgraphics/commons/trunk/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java Wed May 24 08:16:01 2017
@@ -24,6 +24,7 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
@@ -119,15 +120,19 @@ public abstract class AbstractImageSessi
 
         /** {@inheritDoc} */
         public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-            if ("close".equals(method.getName())) {
-                try {
+            try {
+                if ("close".equals(method.getName())) {
+                    try {
+                        return method.invoke(iin, args);
+                    } finally {
+                        IOUtils.closeQuietly(this.in);
+                        this.in = null;
+                    }
+                } else {
                     return method.invoke(iin, args);
-                } finally {
-                    IOUtils.closeQuietly(this.in);
-                    this.in = null;
                 }
-            } else {
-                return method.invoke(iin, args);
+            } catch (InvocationTargetException e) {
+                throw e.getCause();
             }
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org