From 83636d2c09802aeeb1b30078022d228d04da21eb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 15 Aug 2014 16:17:25 +0200 Subject: 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 --- javaunohelper/com/sun/star/comp/helper/Bootstrap.java | 2 +- .../uno/adapter/InputStreamToXInputStreamAdapter.java | 14 ++++++++------ .../uno/adapter/OutputStreamToXOutputStreamAdapter.java | 8 +++++--- .../uno/adapter/XInputStreamToInputStreamAdapter.java | 16 +++++++++------- .../uno/adapter/XOutputStreamToOutputStreamAdapter.java | 12 +++++++----- javaunohelper/com/sun/star/lib/uno/helper/Factory.java | 7 +++---- javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java | 2 +- 7 files changed, 34 insertions(+), 27 deletions(-) (limited to 'javaunohelper/com/sun') 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 InputStreamToInputXStreamAdapter 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 OutputStreamToXOutputStreamAdapter 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( -- cgit ib_contract3756 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/wasm-qt
AgeCommit message (Expand)Author
2021-05-05WASM: add Emscripten demo applicationJan-Marek Glogowski