diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-16 12:19:14 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-16 12:27:15 +0200 |
commit | 9341bf3dc38b2cc117ffbe12ff057511ed6e046d (patch) | |
tree | 3a54c1764eb0e3106695292a737944507d3b4fb6 /jurt/com/sun/star/lib | |
parent | b2f69f626409442d1f0ca5049b946946ce9b01d8 (diff) |
java: when rethrowing, store the original exception
Change-Id: I34ce000c48d2d79bfec854c8dd55d12f2bee29c7
Diffstat (limited to 'jurt/com/sun/star/lib')
4 files changed, 10 insertions, 14 deletions
diff --git a/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java b/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java index 2552c9b9689b..44016075b42b 100644 --- a/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java +++ b/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java @@ -84,12 +84,10 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { // create the pipe try { createJNI( aPipeName ); - } catch ( NullPointerException aNPE ) { - throw new IOException( aNPE.getMessage() ); - } catch ( com.sun.star.io.IOException aIOE ) { - throw new IOException( aIOE.getMessage() ); - } catch ( java.lang.Exception aE ) { - throw new IOException( aE.getMessage() ); + } catch ( java.lang.Exception ex1 ) { + IOException ex2 = new IOException(); + ex2.initCause(ex1); + throw ex2; } } diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java index 95c064ed58a9..d70138457ced 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java @@ -109,7 +109,7 @@ public final class pipeConnector implements XConnector { bConnected = true; return xConn; } catch ( java.io.IOException e ) { - throw new NoConnectException(); + throw new NoConnectException(e); } } diff --git a/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java b/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java index aec6a638e095..4cd8e433c056 100644 --- a/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java +++ b/jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java @@ -45,8 +45,7 @@ final class ConnectionDescriptor { try { port = Integer.parseInt(value); } catch (NumberFormatException e) { - throw new com.sun.star.lang.IllegalArgumentException( - e.toString()); + throw new com.sun.star.lang.IllegalArgumentException(e); } if (port < 0 || port > 65535) { throw new com.sun.star.lang.IllegalArgumentException( @@ -57,8 +56,7 @@ final class ConnectionDescriptor { try { backlog = Integer.parseInt(value); } catch (NumberFormatException e) { - throw new com.sun.star.lang.IllegalArgumentException( - e.toString()); + throw new com.sun.star.lang.IllegalArgumentException(e); } } else if (key.equalsIgnoreCase("tcpnodelay")) { if (value.equals("0")) { diff --git a/jurt/com/sun/star/lib/connections/socket/SocketConnection.java b/jurt/com/sun/star/lib/connections/socket/SocketConnection.java index 6f2a548afb2c..c0a94d62e735 100644 --- a/jurt/com/sun/star/lib/connections/socket/SocketConnection.java +++ b/jurt/com/sun/star/lib/connections/socket/SocketConnection.java @@ -173,7 +173,7 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { try { _outputStream.write(aData); } catch(IOException ioException) { - com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException.toString()); + com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException); notifyListeners_error(unoIOException); throw unoIOException; @@ -192,7 +192,7 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { try { _outputStream.flush(); } catch(IOException ioException) { - com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException.toString()); + com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException); notifyListeners_error(unoIOException); throw unoIOException; @@ -209,7 +209,7 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { try { _socket.close(); } catch(IOException ioException) { - com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException.toString()); + com.sun.star.io.IOException unoIOException = new com.sun.star.io.IOException(ioException); notifyListeners_error(unoIOException); throw unoIOException; |