Kaydet (Commit) 37c49c30 authored tarafından rbuj's avatar rbuj Kaydeden (comit) Noel Grandin

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/11027Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst b9813add
...@@ -198,7 +198,7 @@ public class FactoryHelper { ...@@ -198,7 +198,7 @@ public class FactoryHelper {
try { try {
return _constructor.newInstance( args ); return _constructor.newInstance( args );
} catch (InvocationTargetException invocationTargetException) { } catch (InvocationTargetException invocationTargetException) {
Throwable targetException = invocationTargetException.getTargetException(); Throwable targetException = invocationTargetException.getCause();
if (targetException instanceof java.lang.RuntimeException) if (targetException instanceof java.lang.RuntimeException)
throw (java.lang.RuntimeException)targetException; throw (java.lang.RuntimeException)targetException;
...@@ -274,7 +274,7 @@ public class FactoryHelper { ...@@ -274,7 +274,7 @@ public class FactoryHelper {
} }
return instance; return instance;
} catch (InvocationTargetException invocationTargetException) { } catch (InvocationTargetException invocationTargetException) {
Throwable targetException = invocationTargetException.getTargetException(); Throwable targetException = invocationTargetException.getCause();
if (targetException instanceof java.lang.RuntimeException) if (targetException instanceof java.lang.RuntimeException)
throw (java.lang.RuntimeException)targetException; throw (java.lang.RuntimeException)targetException;
......
...@@ -353,7 +353,7 @@ public class JavaLoader implements XImplementationLoader, ...@@ -353,7 +353,7 @@ public class JavaLoader implements XImplementationLoader,
+ implementationName + " because " + e.toString() ); + implementationName + " because " + e.toString() );
} catch ( InvocationTargetException e ) { } catch ( InvocationTargetException e ) {
throw new CannotActivateFactoryException("Can not activate the factory for " throw new CannotActivateFactoryException("Can not activate the factory for "
+ implementationName + " because " + e.getTargetException().toString() ); + implementationName + " because " + e.getCause().toString() );
} }
return returnObject; return returnObject;
......
...@@ -90,7 +90,7 @@ public class Job { ...@@ -90,7 +90,7 @@ public class Job {
? dispatch_queryInterface((Type) args[0]) ? dispatch_queryInterface((Type) args[0])
: md.getMethod().invoke(_object, args); : md.getMethod().invoke(_object, args);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
exception = e.getTargetException(); exception = e.getCause();
if (exception == null) { if (exception == null) {
exception = e; exception = e;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment