diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-16 14:44:23 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-17 08:26:22 +0200 |
commit | 93056481e85548e1228d3b88e53ee59ed983576e (patch) | |
tree | 9187af96ec8799f883bfefe0667553b2cc3c905a /scripting/java | |
parent | 03c7c26cbe7d75f103515e62dc39103f11d4637f (diff) |
java: when rethrowing exceptions, store the original
Change-Id: I8a2a264597d0b1ae06b08136fea36003682380b5
Diffstat (limited to 'scripting/java')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java b/scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java index a7b580272c9f..08d06dce3b1d 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java @@ -57,14 +57,16 @@ public class StrictResolver implements Resolver { try { m = resolveArguments(sd, c); - } catch (ClassNotFoundException e) { - throw new NoSuchMethodException( - "StrictResolver.getProxy: Can't find method: " + sd.getMethodName() - + ":" + e.getMessage()); - } catch (NoSuchMethodException e) { - throw new NoSuchMethodException( - "StrictResolver.getProxy: Can't find method: " + sd.getMethodName() - + ":" + e.getMessage()); + } catch (ClassNotFoundException ex1) { + NoSuchMethodException ex2 = new NoSuchMethodException( + "StrictResolver.getProxy: Can't find method: " + sd.getMethodName()); + ex2.initCause(ex1); + throw ex2; + } catch (NoSuchMethodException ex1) { + NoSuchMethodException ex2 = new NoSuchMethodException( + "StrictResolver.getProxy: Can't find method: " + sd.getMethodName()); + ex2.initCause(ex1); + throw ex2; } ScriptProxy sp = new ScriptProxy(m); @@ -76,12 +78,16 @@ public class StrictResolver implements Resolver { try { o = c.newInstance(); - } catch (InstantiationException ie) { - throw new NoSuchMethodException( - "getScriptProxy: Can't instantiate: " + c.getName()); - } catch (IllegalAccessException iae) { - throw new NoSuchMethodException( - "getScriptProxy: Can't access: " + c.getName()); + } catch (InstantiationException ex1) { + NoSuchMethodException ex2 = new NoSuchMethodException( + "getScriptProxy: Can't instantiate: " + c.getName()); + ex2.initCause(ex1); + throw ex2; + } catch (IllegalAccessException ex1) { + NoSuchMethodException ex2 = new NoSuchMethodException( + "getScriptProxy: Can't access: " + c.getName()); + ex2.initCause(ex1); + throw ex2; } sp.setTargetObject(o); |