From 37c49c305852f4a58e010c63331ba302462754d9 Mon Sep 17 00:00:00 2001 From: rbuj Date: Tue, 19 Aug 2014 21:34:58 +0200 Subject: jurt: Throwable.getCause() instead of Throwable.getTargetException() As of the JDK 1.4, Throwable.getCause() is the preferred method for getting thrown target exception. Change-Id: I14f3f9ae52869d1149f92b32562e7fb3293109b5 Reviewed-on: https://gerrit.libreoffice.org/11027 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- jurt/com/sun/star/comp/loader/FactoryHelper.java | 4 ++-- jurt/com/sun/star/comp/loader/JavaLoader.java | 2 +- jurt/com/sun/star/lib/uno/environments/remote/Job.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'jurt') diff --git a/jurt/com/sun/star/comp/loader/FactoryHelper.java b/jurt/com/sun/star/comp/loader/FactoryHelper.java index 2a712011346a..92b480174769 100644 --- a/jurt/com/sun/star/comp/loader/FactoryHelper.java +++ b/jurt/com/sun/star/comp/loader/FactoryHelper.java @@ -198,7 +198,7 @@ public class FactoryHelper { try { return _constructor.newInstance( args ); } catch (InvocationTargetException invocationTargetException) { - Throwable targetException = invocationTargetException.getTargetException(); + Throwable targetException = invocationTargetException.getCause(); if (targetException instanceof java.lang.RuntimeException) throw (java.lang.RuntimeException)targetException; @@ -274,7 +274,7 @@ public class FactoryHelper { } return instance; } catch (InvocationTargetException invocationTargetException) { - Throwable targetException = invocationTargetException.getTargetException(); + Throwable targetException = invocationTargetException.getCause(); if (targetException instanceof java.lang.RuntimeException) throw (java.lang.RuntimeException)targetException; diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java b/jurt/com/sun/star/comp/loader/JavaLoader.java index d7f757a701f9..c82f8e941232 100644 --- a/jurt/com/sun/star/comp/loader/JavaLoader.java +++ b/jurt/com/sun/star/comp/loader/JavaLoader.java @@ -353,7 +353,7 @@ public class JavaLoader implements XImplementationLoader, + implementationName + " because " + e.toString() ); } catch ( InvocationTargetException e ) { throw new CannotActivateFactoryException("Can not activate the factory for " - + implementationName + " because " + e.getTargetException().toString() ); + + implementationName + " because " + e.getCause().toString() ); } return returnObject; diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Job.java b/jurt/com/sun/star/lib/uno/environments/remote/Job.java index 47fc03342ef2..1d8b3661467d 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/Job.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/Job.java @@ -90,7 +90,7 @@ public class Job { ? dispatch_queryInterface((Type) args[0]) : md.getMethod().invoke(_object, args); } catch (InvocationTargetException e) { - exception = e.getTargetException(); + exception = e.getCause(); if (exception == null) { exception = e; } -- cgit v1.2.3