[Libreoffice-commits] core.git: bridges/test desktop/test javaunohelper/com odk/examples sfx2/qa sw/qa unoxml/qa
Noel Grandin
noel at peralex.com
Wed Dec 10 03:39:03 PST 2014
bridges/test/java_uno/nativethreadpool/Relay.java | 4 -
desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java | 2
desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java | 2
desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java | 2
javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java | 6 +-
javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java | 6 +-
odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java | 2
sfx2/qa/complex/sfx2/DocumentMetadataAccess.java | 20 ---------
sw/qa/complex/writer/LoadSaveTest.java | 21 ----------
unoxml/qa/complex/unoxml/RDFRepositoryTest.java | 21 ----------
10 files changed, 12 insertions(+), 74 deletions(-)
New commits:
commit fd60dd5226b6cefb1eb621f8e479ba59bf11b0b7
Author: Noel Grandin <noel at peralex.com>
Date: Wed Dec 10 13:35:17 2014 +0200
java: improve use of WrappedTargetException to set cause properly
since we introduced the new constructors that pass the cause all the
way up to java.lang.Throwable.
Also simplify some exeception printing sites, because Throwable
will correctly print out child exceptions for us.
Change-Id: Ibbecce3c6f971fbc80d6de2052ab4f33a4503c0a
diff --git a/bridges/test/java_uno/nativethreadpool/Relay.java b/bridges/test/java_uno/nativethreadpool/Relay.java
index fb1063b..7b523f3 100644
--- a/bridges/test/java_uno/nativethreadpool/Relay.java
+++ b/bridges/test/java_uno/nativethreadpool/Relay.java
@@ -43,7 +43,7 @@ public final class Relay implements XRelay, XSource {
} catch (RuntimeException e) {
throw e;
} catch (com.sun.star.uno.Exception e) {
- throw new WrappedTargetRuntimeException(e.getMessage(), this, e);
+ throw new WrappedTargetRuntimeException(e, e.getMessage(), this, e);
} catch (Exception e) {
throw new com.sun.star.uno.RuntimeException(e, "", this);
}
@@ -55,7 +55,7 @@ public final class Relay implements XRelay, XSource {
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
} catch (com.sun.star.uno.Exception e) {
- throw new WrappedTargetRuntimeException(e.getMessage(), this, e);
+ throw new WrappedTargetRuntimeException(e, e.getMessage(), this, e);
}
new Thread() {
@Override
diff --git a/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java b/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java
index f50cdea..e224c94 100644
--- a/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java
+++ b/desktop/test/deployment/active/com/sun/star/comp/test/deployment/Dispatch.java
@@ -77,7 +77,7 @@ public final class Dispatch extends WeakBase implements XServiceInfo, XDispatch
} catch (com.sun.star.uno.RuntimeException e) {
throw e;
} catch (com.sun.star.uno.Exception e) {
- throw new WrappedTargetRuntimeException(
+ throw new WrappedTargetRuntimeException(e,
"wrapped: " + e.getMessage(), this, e);
}
}
diff --git a/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java b/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java
index f7499ce..7cd3688 100644
--- a/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java
+++ b/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java
@@ -135,7 +135,7 @@ public class OptionsEventHandler {
try {
return handleExternalEvent(aWindow, aEventObject);
} catch (com.sun.star.uno.Exception e) {
- throw new WrappedTargetException(sMethod, this, e);
+ throw new WrappedTargetException(e, sMethod, this, e);
}
}
diff --git a/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java b/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java
index 701fb31..74882bc 100644
--- a/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java
+++ b/desktop/test/deployment/passive/com/sun/star/comp/test/deployment/Dispatch.java
@@ -77,7 +77,7 @@ public final class Dispatch extends WeakBase implements XServiceInfo, XDispatch
} catch (com.sun.star.uno.RuntimeException e) {
throw e;
} catch (com.sun.star.uno.Exception e) {
- throw new WrappedTargetRuntimeException(
+ throw new WrappedTargetRuntimeException(e,
"wrapped: " + e.getMessage(), this, e);
}
}
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
index 47407b1..ed82d92 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
@@ -688,11 +688,11 @@ XMultiPropertySet
}
catch (java.lang.NoSuchFieldException e)
{
- throw new WrappedTargetException("Field does not exist", this, e);
+ throw new WrappedTargetException(e, "Field does not exist", this, e);
}
catch (java.lang.IllegalAccessException e)
{
- throw new WrappedTargetException("", this ,e);
+ throw new WrappedTargetException(e, "", this ,e);
}
return ret;
}
@@ -808,7 +808,7 @@ XMultiPropertySet
}
catch(java.lang.Exception e)
{
- throw new WrappedTargetException("PropertySet.setPropertyValueNoBroadcast", this, e);
+ throw new WrappedTargetException(e, "PropertySet.setPropertyValueNoBroadcast", this, e);
}
}
/** Retrieves the value of a property. This implementation presumes that the values are stored in member variables
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
index 7e2af48..26d9464 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
@@ -479,7 +479,7 @@ public final class PropertySetMixin {
} catch (UnknownPropertyException e) {
continue;
} catch (WrappedTargetException e) {
- throw new WrappedTargetRuntimeException(e,
+ throw new WrappedTargetRuntimeException(e.getCause(),
e.getMessage(), object, e.TargetException);
}
s[n++] = new PropertyValue(handleMap[i], i, value, state[0]);
@@ -742,7 +742,7 @@ public final class PropertySetMixin {
{
throw new PropertyVetoException(e, name, object);
} else {
- throw new WrappedTargetException(
+ throw new WrappedTargetException(e.getCause(),
e.getMessage(), object, e.TargetException);
}
}
@@ -774,7 +774,7 @@ public final class PropertySetMixin {
{
throw new UnknownPropertyException(e, name, object);
} else {
- throw new WrappedTargetException(
+ throw new WrappedTargetException(e.getCause(),
e.getMessage(), object, e.TargetException);
}
}
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
index 2b25f21..5238028 100644
--- a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
@@ -130,7 +130,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor
createDialog();
}
catch ( Exception e ) {
- throw new com.sun.star.lang.WrappedTargetRuntimeException( e.getMessage(), this, e );
+ throw new com.sun.star.lang.WrappedTargetRuntimeException( e, e.getMessage(), this, e );
}
}
}
diff --git a/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java b/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java
index 3843cb9..f2944f0 100644
--- a/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java
+++ b/sfx2/qa/complex/sfx2/DocumentMetadataAccess.java
@@ -46,7 +46,6 @@ import com.sun.star.lang.XComponent;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
-import com.sun.star.lang.WrappedTargetRuntimeException;
import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.StringPair;
@@ -863,28 +862,9 @@ public class DocumentMetadataAccess
// utilities -------------------------------------------------------------
- public void report2(Exception e)
- {
- if (e instanceof WrappedTargetException)
- {
- System.out.println("Cause:");
- Exception cause = (Exception)
- (((WrappedTargetException)e).TargetException);
- System.out.println(cause.toString());
- report2(cause);
- } else if (e instanceof WrappedTargetRuntimeException) {
- System.out.println("Cause:");
- Exception cause = (Exception)
- (((WrappedTargetRuntimeException)e).TargetException);
- System.out.println(cause.toString());
- report2(cause);
- }
- }
-
public void report(Exception e) {
System.out.println("Exception occurred:");
e.printStackTrace(System.err);
- report2(e);
fail();
}
diff --git a/sw/qa/complex/writer/LoadSaveTest.java b/sw/qa/complex/writer/LoadSaveTest.java
index e6027b6..f617a93 100644
--- a/sw/qa/complex/writer/LoadSaveTest.java
+++ b/sw/qa/complex/writer/LoadSaveTest.java
@@ -20,8 +20,6 @@ package complex.writer;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
-import com.sun.star.lang.WrappedTargetException;
-import com.sun.star.lang.WrappedTargetRuntimeException;
import com.sun.star.lang.EventObject;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XComponent;
@@ -165,29 +163,10 @@ public class LoadSaveTest
public void disposing(EventObject Event) { }
}
- void report2(Exception e)
- {
- if (e instanceof WrappedTargetException)
- {
- System.out.println("Cause:");
- Exception cause = (Exception)
- (((WrappedTargetException)e).TargetException);
- System.out.println(cause.toString());
- report2(cause);
- } else if (e instanceof WrappedTargetRuntimeException) {
- System.out.println("Cause:");
- Exception cause = (Exception)
- (((WrappedTargetRuntimeException)e).TargetException);
- System.out.println(cause.toString());
- report2(cause);
- }
- }
-
void report(Exception e) {
System.out.println("Exception occurred:");
System.out.println(e.toString());
e.printStackTrace(System.err);
- report2(e);
// failed();
}
diff --git a/unoxml/qa/complex/unoxml/RDFRepositoryTest.java b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java
index 3b560bd..e47d5d3 100644
--- a/unoxml/qa/complex/unoxml/RDFRepositoryTest.java
+++ b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java
@@ -25,8 +25,6 @@ import com.sun.star.uno.XComponentContext;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.IllegalArgumentException;
-import com.sun.star.lang.WrappedTargetException;
-import com.sun.star.lang.WrappedTargetRuntimeException;
import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.Pair;
import com.sun.star.beans.StringPair;
@@ -549,28 +547,9 @@ public class RDFRepositoryTest
// utilities -------------------------------------------------------------
- public void report2(Exception e)
- {
- if (e instanceof WrappedTargetException)
- {
- System.out.println("Cause:");
- Exception cause = (Exception)
- (((WrappedTargetException)e).TargetException);
- System.out.println(cause.toString());
- report2(cause);
- } else if (e instanceof WrappedTargetRuntimeException) {
- System.out.println("Cause:");
- Exception cause = (Exception)
- (((WrappedTargetRuntimeException)e).TargetException);
- System.out.println(cause.toString());
- report2(cause);
- }
- }
-
public void report(Exception e) {
System.out.println("Exception occurred:");
e.printStackTrace();
- report2(e);
fail();
}
More information about the Libreoffice-commits
mailing list