changeset 1926:5153060e463b

2009-06-16 Omair Majid <omajid@redhat.com> * netx/net/sourceforge/jnlp/services/ServiceUtil.java: (invoke): Throw the original exception that caused the problem.
author Omair Majid <omajid@redhat.com>
date Tue, 16 Jun 2009 10:23:45 -0400
parents a5edccad3c7c
children 8754d9d3bc2c
files ChangeLog netx/net/sourceforge/jnlp/services/ServiceUtil.java
diffstat 2 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 10 12:00:53 2009 -0400
+++ b/ChangeLog	Tue Jun 16 10:23:45 2009 -0400
@@ -1,3 +1,8 @@
+2009-06-16  Omair Majid  <omajid@redhat.com>
+
+	* netx/net/sourceforge/jnlp/services/ServiceUtil.java:
+	(invoke): Throw the original exception that caused the problem.
+
 2009-06-10  Omair Majid  <omajid@redhat.com>
 
 	* netx/net/sourceforge/jnlp/JNLPFile.java
--- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java	Wed Jun 10 12:00:53 2009 -0400
+++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java	Tue Jun 16 10:23:45 2009 -0400
@@ -159,12 +159,25 @@
                 }
             };
 
-            Object result = AccessController.doPrivileged(invoker);
+            try {
+                Object result = AccessController.doPrivileged(invoker);
+
+                if (JNLPRuntime.isDebug())
+                    System.err.println("        result: "+result);
 
-            if (JNLPRuntime.isDebug())
-                System.err.println("        result: "+result);
+                return result;
+            } catch (PrivilegedActionException e) {
+                // Any exceptions thrown by the actual methods are wrapped by a 
+                // InvocationTargetException, which is further wrapped by the 
+                // PrivilegedActionException. Lets unwrap them to make the 
+                // proxy transparent to the callers
+                if (e.getCause() instanceof InvocationTargetException) {
+                    throw e.getCause().getCause();
+                } else {
+                    throw e.getCause();
+                }
+            }
 
-            return result;
         }
     };