summaryrefslogtreecommitdiff
path: root/javaunohelper/com/sun
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-15 16:17:25 +0200
committerNoel Grandin <noel@peralex.com>2014-09-25 13:47:25 +0200
commit83636d2c09802aeeb1b30078022d228d04da21eb (patch)
tree8a0c619e16c1f6b5388939d5da2956f7ef758c19 /javaunohelper/com/sun
parentcf49392511e98851174b353782df9eb6bac46f77 (diff)
java: when rethrowing exceptions, store the original cause
so that we get a nice complete stacktrace when it hits the final handler Change-Id: Iec4fcc15a2a25c55f591b5e069dce3d010197a90
Diffstat (limited to 'javaunohelper/com/sun')
-rw-r--r--javaunohelper/com/sun/star/comp/helper/Bootstrap.java2
-rw-r--r--javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java14
-rw-r--r--javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java8
-rw-r--r--javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java16
-rw-r--r--javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java12
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/Factory.java7
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java2
7 files changed, 34 insertions, 27 deletions
diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
index 80daf4b27d0d..2501b575f4c3 100644
--- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
+++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
@@ -312,7 +312,7 @@ public class Bootstrap {
// Wait 500 ms, then try to connect again, but do not wait
// longer than 5 min (= 600 * 500 ms) total:
if (i == 600) {
- throw new BootstrapException(ex.toString());
+ throw new BootstrapException(ex);
}
Thread.sleep( 500 );
}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
index b80252039e8a..1fa4286214c4 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
@@ -18,7 +18,9 @@
package com.sun.star.lib.uno.adapter;
import java.io.IOException;
+
import com.sun.star.io.XInputStream;
+
import java.io.InputStream;
/** The <code>InputStreamToInputXStreamAdapter</code> wraps the
@@ -54,7 +56,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
try {
bytesAvail = iIn.available();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
return(bytesAvail);
@@ -66,7 +68,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
try {
iIn.close();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
}
@@ -92,7 +94,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
} catch (IOException e) {
- throw new com.sun.star.io.IOException("reader error: "+e.toString());
+ throw new com.sun.star.io.IOException("reader error", e);
}
}
@@ -118,7 +120,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
} catch (IOException e) {
- throw new com.sun.star.io.IOException("reader error: "+e.toString());
+ throw new com.sun.star.io.IOException("reader error", e);
}
}
@@ -131,7 +133,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
try {
iIn.available();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
do {
@@ -146,7 +148,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
try {
iIn.skip(tmpIntVal);
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
} while (tmpLongVal > 0);
}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java
index 954888cb5025..087a4a53dd89 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java
@@ -19,7 +19,9 @@
package com.sun.star.lib.uno.adapter;
import java.io.IOException;
+
import com.sun.star.io.XOutputStream;
+
import java.io.OutputStream;
/** The <code>OutputStreamToXOutputStreamAdapter</code> wraps
@@ -50,7 +52,7 @@ public final class OutputStreamToXOutputStreamAdapter implements XOutputStream {
try {
iOut.close();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
}
@@ -60,7 +62,7 @@ public final class OutputStreamToXOutputStreamAdapter implements XOutputStream {
try {
iOut.flush();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
}
@@ -71,7 +73,7 @@ public final class OutputStreamToXOutputStreamAdapter implements XOutputStream {
try {
iOut.write(b);
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
index 2d9652e1ecba..8352a0b18675 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
@@ -18,7 +18,9 @@
package com.sun.star.lib.uno.adapter;
import java.io.IOException;
+
import com.sun.star.io.XInputStream;
+
import java.io.InputStream;
/**
@@ -53,7 +55,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
try {
bytesAvail = xin.available();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
return(bytesAvail);
@@ -64,7 +66,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
try {
xin.closeInput();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -85,7 +87,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
}
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -105,7 +107,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
System.arraycopy(tmp[0], 0, b, 0, b.length);
}
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
return (bytesRead);
@@ -139,7 +141,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
} catch (Exception e) {
- throw new IOException("reader error: "+e.toString());
+ throw new IOException(e);
}
}
@@ -153,7 +155,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
try {
avail = xin.available();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
do {
@@ -168,7 +170,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
try {
xin.skipBytes(tmpIntVal);
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
} while (tmpLongVal > 0);
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java
index 478dfc4956b7..760852130812 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java
@@ -19,7 +19,9 @@
package com.sun.star.lib.uno.adapter;
import java.io.IOException;
+
import com.sun.star.io.XOutputStream;
+
import java.io.OutputStream;
/**
@@ -51,7 +53,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.closeOutput();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -60,7 +62,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.flush();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -70,7 +72,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.writeBytes(b);
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -86,7 +88,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.writeBytes(tmp);
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -99,7 +101,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.writeBytes(oneByte);
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
}
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
index 19f6fc08b067..ca0bf84212c2 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
@@ -22,7 +22,6 @@ import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XInitialization;
import com.sun.star.registry.XRegistryKey;
-
import com.sun.star.uno.UnoRuntime;
@@ -198,15 +197,15 @@ public class Factory
else if (targetException instanceof com.sun.star.uno.Exception)
throw (com.sun.star.uno.Exception)targetException;
else
- throw new com.sun.star.uno.Exception( targetException.toString(), this );
+ throw new com.sun.star.uno.Exception(targetException, targetException.getMessage(), this);
}
catch (IllegalAccessException exc)
{
- throw new com.sun.star.uno.RuntimeException( exc.toString(), this );
+ throw new com.sun.star.uno.RuntimeException( exc, exc.getMessage(), this);
}
catch (InstantiationException exc)
{
- throw new com.sun.star.uno.RuntimeException( exc.toString(), this );
+ throw new com.sun.star.uno.RuntimeException( exc, exc.getMessage(), this);
}
}
// XSingleComponentFactory impl
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
index 576679217c5d..23ab8022e17c 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
@@ -220,7 +220,7 @@ public class UnoUrl {
try {
ch = Integer.parseInt(s.substring(i+1,i+3),16);
} catch (NumberFormatException e) {
- throw new com.sun.star.lang.IllegalArgumentException(e.toString());
+ throw new com.sun.star.lang.IllegalArgumentException(e);
}
if (ch < 0)
throw new com.sun.star.lang.IllegalArgumentException(