diff options
42 files changed, 201 insertions, 210 deletions
diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java index 52cef3c1f235..a2f0db9c785c 100644 --- a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java +++ b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java @@ -186,10 +186,12 @@ public class LocalOfficeConnection mProtocol = aURL.getProtocol(); mInitialObject = aURL.getRootOid(); } - catch ( com.sun.star.lang.IllegalArgumentException eIll ) + catch ( com.sun.star.lang.IllegalArgumentException ex1 ) { - throw new java.net.MalformedURLException( + java.net.MalformedURLException ex2 = new java.net.MalformedURLException( "Invalid UNO connection URL."); + ex2.initCause(ex1); + throw ex2; } } mURL = url; @@ -425,7 +427,7 @@ public class LocalOfficeConnection xLocalServiceManager.createInstanceWithContext( "com.sun.star.bridge.BridgeFactory", xLocalContext)); } catch (com.sun.star.uno.Exception e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); + throw new com.sun.star.uno.RuntimeException(e); } synchronized(this) { if(mBridge == null) { @@ -434,7 +436,7 @@ public class LocalOfficeConnection connector = xLocalServiceManager.createInstanceWithContext( "com.sun.star.connection.Connector", xLocalContext); } catch (com.sun.star.uno.Exception e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); + throw new com.sun.star.uno.RuntimeException(e); } XConnector connector_xConnector = UnoRuntime.queryInterface(XConnector.class, connector); // connect to the server @@ -447,7 +449,7 @@ public class LocalOfficeConnection try { mBridge = xBridgeFactory.createBridge(sBridgeName, protDcp, xConnection, null); } catch (com.sun.star.bridge.BridgeExistsException e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); + throw new com.sun.star.uno.RuntimeException(e); } } rootObject = mBridge.getInstance(rootOid); diff --git a/bean/com/sun/star/comp/beans/NoConnectionException.java b/bean/com/sun/star/comp/beans/NoConnectionException.java index a60ceddd137e..76821b8cb0c4 100644 --- a/bean/com/sun/star/comp/beans/NoConnectionException.java +++ b/bean/com/sun/star/comp/beans/NoConnectionException.java @@ -26,6 +26,11 @@ package com.sun.star.comp.beans; */ public class NoConnectionException extends Exception { + + public NoConnectionException() {} + + public NoConnectionException(Throwable cause) { super(cause); } + } diff --git a/bean/com/sun/star/comp/beans/OOoBean.java b/bean/com/sun/star/comp/beans/OOoBean.java index d8743865f0b4..4a82c5ec6310 100644 --- a/bean/com/sun/star/comp/beans/OOoBean.java +++ b/bean/com/sun/star/comp/beans/OOoBean.java @@ -157,26 +157,27 @@ public class OOoBean @internal */ - private synchronized void setOOoConnection( OfficeConnection iNewConnection ) - throws HasConnectionException, NoConnectionException - { + private synchronized void setOOoConnection(OfficeConnection iNewConnection) + throws HasConnectionException, NoConnectionException { // the connection cannot be exchanged - if ( iConnection != null ) + if (iConnection != null) throw new HasConnectionException(); // is there a real connection, not just the proxy? com.sun.star.uno.XComponentContext xComponentContext = null; - try { xComponentContext = iNewConnection.getComponentContext(); } - catch ( java.lang.Throwable aExc ) - { throw new NoConnectionException(); } - if ( xComponentContext == null ) + try { + xComponentContext = iNewConnection.getComponentContext(); + } catch (java.lang.Throwable aExc) { + throw new NoConnectionException(aExc); + } + if (xComponentContext == null) throw new NoConnectionException(); // set the connection iConnection = iNewConnection; // get notified when connection dies - if ( xConnectionListener != null ) + if (xConnectionListener != null) xConnectionListener.end(); xConnectionListener = this.new EventListener("setOOoConnection"); } @@ -300,7 +301,7 @@ public class OOoBean aConnectorThread.start(); try { aConnectorThread.join(nOOoStartTimeOut); } catch ( InterruptedException aExc ) - { throw new NoConnectionException(); } + { throw new NoConnectionException(aExc); } if ( xServiceFactory == null ) throw new NoConnectionException(); } @@ -493,13 +494,15 @@ public class OOoBean // @requirement FUNC.CON.LOST/0.2 NoConnectionException - { - if ( iConnection == null ) + { + if (iConnection == null) throw new NoConnectionException(); - try { xFrameWindow.getAWTComponent().setVisible(false); } - catch ( com.sun.star.lang.DisposedException aExc ) - { throw new NoConnectionException(); } + try { + xFrameWindow.getAWTComponent().setVisible(false); + } catch (com.sun.star.lang.DisposedException aExc) { + throw new NoConnectionException(aExc); + } } // @requirement FUNC.BEAN.LOAD/0.4 @@ -675,8 +678,9 @@ public class OOoBean catch ( com.sun.star.uno.Exception aExc ) { // TDB: handling failure in createInstance - aExc.printStackTrace(); - throw new java.io.IOException(); + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(aExc); + throw ex2; } aCallWatchThread.cancel(); @@ -692,7 +696,7 @@ public class OOoBean } catch ( InterruptedException aExc ) { - throw new NoConnectionException(); + throw new NoConnectionException(aExc); } } @@ -808,27 +812,30 @@ public class OOoBean java.io.IOException, com.sun.star.lang.IllegalArgumentException, NoDocumentException - { + { // no document available? - if ( aDocument == null ) + if (aDocument == null) throw new NoDocumentException(); - try - { + try { // start runtime timeout - CallWatchThread aCallWatchThread = - new CallWatchThread( nOOoCallTimeOut, "storeToURL" ); + CallWatchThread aCallWatchThread = new CallWatchThread( + nOOoCallTimeOut, "storeToURL"); // store the document - try { aDocument.storeToURL( aURL, aArguments ); } - catch ( com.sun.star.io.IOException aExc ) - { throw new java.io.IOException(); } + try { + aDocument.storeToURL(aURL, aArguments); + } catch (com.sun.star.io.IOException aExc) { + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(aExc); + throw ex2; + } // end runtime timeout aCallWatchThread.cancel(); + } catch (java.lang.InterruptedException aExc) { + throw new NoConnectionException(aExc); } - catch ( java.lang.InterruptedException aExc ) - { throw new NoConnectionException(); } } /** Stores a document to a stream. @@ -848,26 +855,28 @@ public class OOoBean { // wrap Java stream into UNO stream - com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter aStream = - new com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter( - aOutStream ); + com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter aStream = new com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter( + aOutStream); // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "OutputStream", -1, aStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); + com.sun.star.beans.PropertyValue[] aExtendedArguments = addArgument( + aArguments, new com.sun.star.beans.PropertyValue( + "OutputStream", -1, aStream, + com.sun.star.beans.PropertyState.DIRECT_VALUE)); // call normal store method - storeToURL( "private:stream", aExtendedArguments ); + storeToURL("private:stream", aExtendedArguments); // get byte array from document stream - try { aStream.closeOutput(); } - catch ( com.sun.star.io.NotConnectedException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.BufferSizeExceededException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.IOException aExc ) - { throw new java.io.IOException(); } + try { + aStream.closeOutput(); + } catch (com.sun.star.io.NotConnectedException aExc) { /* TDB */ + } catch (com.sun.star.io.BufferSizeExceededException aExc) { /* TDB */ + } catch (com.sun.star.io.IOException aExc) { + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(aExc); + throw ex2; + } return aOutStream; } @@ -1081,11 +1090,11 @@ xLayoutManager.showElement("private:resource/menubar/menubar"); } catch ( com.sun.star.beans.UnknownPropertyException aExc ) { - throw new RuntimeException( "not layout manager found" ); + throw new RuntimeException( "not layout manager found", aExc ); } catch ( com.sun.star.lang.WrappedTargetException aExc ) { - throw new RuntimeException( "not layout manager found" ); + throw new RuntimeException( "not layout manager found", aExc ); } // notify change diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java index 679d41e1b469..1ea9cd241d63 100644 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java +++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java @@ -41,8 +41,10 @@ public class NativeStorageAccess { mode = NativeStorageAccess.READWRITE | NativeStorageAccess.SEEKABLE; openStream(name, (String)key, mode); - } catch(Exception e){ - throw new java.io.IOException(); + } catch(Exception ex1){ + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(ex1); + throw ex2; } } private native void openStream(String name,String key, int mode); diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess.java b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess.java index 20a341201ca3..eefb37124d5c 100644 --- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess.java +++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess.java @@ -32,8 +32,10 @@ public class StorageAccess implements org.hsqldb.lib.Storage { access = new NativeStorageAccess(name, this.readonly ? "r" : "rw" ,key); - } catch(Exception e){ - throw new java.io.IOException(); + } catch(Exception ex1){ + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(ex1); + throw ex2; } } public void close() throws java.io.IOException{ diff --git a/connectivity/qa/complex/connectivity/HsqlDriverTest.java b/connectivity/qa/complex/connectivity/HsqlDriverTest.java index 5a399a2de362..747b2ac870b8 100644 --- a/connectivity/qa/complex/connectivity/HsqlDriverTest.java +++ b/connectivity/qa/complex/connectivity/HsqlDriverTest.java @@ -59,7 +59,7 @@ public class HsqlDriverTest extends ComplexTestCase { HsqlDatabase database = new HsqlDatabase( param.getMSF() ); ds = database.getDataSource().getXDataSource(); } catch(Exception ex) { - throw new RuntimeException("factory: unable to construct data source" ); + throw new RuntimeException("factory: unable to construct data source", ex ); } try{ diff --git a/connectivity/qa/connectivity/tools/RowSet.java b/connectivity/qa/connectivity/tools/RowSet.java index e5b2545c2c53..5897fce5f0d8 100644 --- a/connectivity/qa/connectivity/tools/RowSet.java +++ b/connectivity/qa/connectivity/tools/RowSet.java @@ -58,8 +58,7 @@ public class RowSet implements XRowSet, XRow } catch ( Exception e ) { - e.printStackTrace(System.err); - throw new java.lang.InstantiationError(); + throw new java.lang.RuntimeException(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 559fbd810f64..28d6dc3b092c 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 @@ -156,8 +156,8 @@ public class OptionsEventHandler { } else if (sMethod.equals("back") || sMethod.equals("initialize")) { loadData(aWindow); } - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new com.sun.star.lang.IllegalArgumentException( + } catch (com.sun.star.lang.IllegalArgumentException ex) { + throw new com.sun.star.lang.IllegalArgumentException(ex, "Method external_event requires a string in the event object argument.", this, (short) -1); } @@ -216,8 +216,8 @@ public class OptionsEventHandler { //The value is still contained in a com.sun.star.uno.Any - so convert it. try { sValue = AnyConverter.toString(aText); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new com.sun.star.lang.IllegalArgumentException( + } catch (com.sun.star.lang.IllegalArgumentException ex) { + throw new com.sun.star.lang.IllegalArgumentException(ex, "Wrong property type.", this, (short) -1); } @@ -350,8 +350,8 @@ public class OptionsEventHandler { String sName = null; try { sName = AnyConverter.toString(aWindowName); - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new com.sun.star.uno.Exception( + } catch (com.sun.star.lang.IllegalArgumentException ex) { + throw new com.sun.star.uno.Exception(ex, "Name - property of window is not a string.", this); } diff --git a/filter/qa/complex/filter/detection/typeDetection/Helper.java b/filter/qa/complex/filter/detection/typeDetection/Helper.java index fb7a7ecddff8..83026fd75997 100644 --- a/filter/qa/complex/filter/detection/typeDetection/Helper.java +++ b/filter/qa/complex/filter/detection/typeDetection/Helper.java @@ -344,7 +344,7 @@ public class Helper { String fileURL = m_hFileURLs.get(fileAlias).toString(); return utils.getFullURL(ensureEndingFileSep(m_sTestDocPath) + fileURL); } catch (NullPointerException e){ - throw new FileAliasNotFoundException(fileAlias); + throw new FileAliasNotFoundException(fileAlias, e); } } @@ -359,7 +359,7 @@ public class Helper { try{ return m_hFileTypes.get(fileAlias).toString(); } catch (NullPointerException e){ - throw new FileAliasNotFoundException(fileAlias); + throw new FileAliasNotFoundException(fileAlias, e); } } @@ -425,7 +425,7 @@ class FileAliasNotFoundException extends java.lang.Exception{ /** throws error message with wrong alias name * @param fileAlias the alias name */ - public FileAliasNotFoundException(String fileAlias){ - super("Could not get '"+fileAlias +"'"); + public FileAliasNotFoundException(String fileAlias, Throwable cause){ + super("Could not get '"+fileAlias +"'", cause); } } diff --git a/forms/qa/org/openoffice/xforms/XMLDocument.java b/forms/qa/org/openoffice/xforms/XMLDocument.java index 0f6b337f76c4..e2236767a346 100644 --- a/forms/qa/org/openoffice/xforms/XMLDocument.java +++ b/forms/qa/org/openoffice/xforms/XMLDocument.java @@ -76,7 +76,7 @@ public class XMLDocument extends integration.forms.DocumentHelper } catch (WrappedTargetException ex) { - throw new NoSuchElementException(); + throw new NoSuchElementException(ex); } } diff --git a/framework/qa/complex/framework/autosave/ConfigHelper.java b/framework/qa/complex/framework/autosave/ConfigHelper.java index d9ab6f50d5b3..204be38935bc 100644 --- a/framework/qa/complex/framework/autosave/ConfigHelper.java +++ b/framework/qa/complex/framework/autosave/ConfigHelper.java @@ -76,7 +76,7 @@ class ConfigHelper } catch(com.sun.star.uno.Exception ex) { - throw new com.sun.star.container.NoSuchElementException(ex.getMessage()); + throw new com.sun.star.container.NoSuchElementException(ex); } } diff --git a/framework/qa/complex/loadAllDocuments/StreamSimulator.java b/framework/qa/complex/loadAllDocuments/StreamSimulator.java index 2930915e2715..f688fb98d41d 100644 --- a/framework/qa/complex/loadAllDocuments/StreamSimulator.java +++ b/framework/qa/complex/loadAllDocuments/StreamSimulator.java @@ -107,8 +107,7 @@ public class StreamSimulator implements com.sun.star.io.XInputStream , } catch(com.sun.star.uno.Exception exUno) { - throw new com.sun.star.io.NotConnectedException( - "Could not open the file."); + throw new com.sun.star.io.NotConnectedException(exUno); } } diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java index ecb1df66c296..19d5919383d8 100644 --- a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java +++ b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java @@ -87,12 +87,10 @@ public final class ByteArrayToXInputStreamAdapter System.arraycopy(m_bytes, m_pos, values[0], 0, param); m_pos += param; return param; - } catch (ArrayIndexOutOfBoundsException ae) { - ae.printStackTrace(); - throw new com.sun.star.io.BufferSizeExceededException("buffer overflow"); - } catch (Exception e) { - e.printStackTrace(); - throw new com.sun.star.io.IOException("error accessing buffer"); + } catch (ArrayIndexOutOfBoundsException ex) { + throw new com.sun.star.io.BufferSizeExceededException(ex, "buffer overflow"); + } catch (Exception ex) { + throw new com.sun.star.io.IOException(ex, "error accessing buffer"); } } diff --git a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java index 48ca6c68ab72..c867cad5d439 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java @@ -762,7 +762,9 @@ public class InterfaceContainer implements Cloneable } catch(java.lang.IndexOutOfBoundsException e) { - throw new java.util.NoSuchElementException(); + java.util.NoSuchElementException ex2 = new java.util.NoSuchElementException(); + ex2.initCause(e); + throw ex2; } } @@ -828,7 +830,9 @@ public class InterfaceContainer implements Cloneable return previous; } catch(IndexOutOfBoundsException e) { - throw new NoSuchElementException(); + java.util.NoSuchElementException ex2 = new java.util.NoSuchElementException(); + ex2.initCause(e); + throw ex2; } } diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java index aaf7691c123a..47407b1e78ad 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java @@ -167,7 +167,7 @@ XMultiPropertySet } catch (NoSuchFieldException e) { - throw new com.sun.star.uno.RuntimeException("there is no member variable: " + memberName); + throw new com.sun.star.uno.RuntimeException(e, "there is no member variable: " + memberName); } Class cl= propField.getType(); Type t= new Type(cl); diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java index b00519af7712..f3d9a8e907b2 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java @@ -135,9 +135,7 @@ public final class PropertySetMixin { + "theTypeDescriptionManager")). getByHierarchicalName(type.getTypeName()))); } catch (NoSuchElementException e) { - throw new RuntimeException( - "unexpected com.sun.star.container.NoSuchElementException: " - + e.getMessage()); + throw new RuntimeException(e); } HashMap<String,PropertyData> map = new HashMap<String,PropertyData>(); ArrayList<String> handleNames = new ArrayList<String>(); @@ -481,7 +479,7 @@ public final class PropertySetMixin { } catch (UnknownPropertyException e) { continue; } catch (WrappedTargetException e) { - throw new WrappedTargetRuntimeException( + throw new WrappedTargetRuntimeException(e, e.getMessage(), object, e.TargetException); } s[n++] = new PropertyValue(handleMap[i], i, value, state[0]); @@ -715,17 +713,15 @@ public final class PropertySetMixin { f.set(o, v); } catch (com.sun.star.lang.IllegalArgumentException e) { if (e.ArgumentPosition == 1) { - throw new com.sun.star.lang.IllegalArgumentException( + throw new com.sun.star.lang.IllegalArgumentException(e, e.getMessage(), object, illegalArgumentPosition); } else { - throw new RuntimeException( - "unexpected com.sun.star.lang.IllegalArgumentException: " - + e.getMessage()); + throw new RuntimeException(e); } } catch (com.sun.star.lang.IllegalAccessException e) { //TODO Clarify whether PropertyVetoException is the correct // exception to throw when trying to set a read-only property: - throw new PropertyVetoException( + throw new PropertyVetoException(e, "cannot set read-only property " + name, object); } catch (WrappedTargetRuntimeException e) { //FIXME A WrappedTargetRuntimeException from XIdlField2.get is not @@ -736,14 +732,14 @@ public final class PropertySetMixin { AnyConverter.getType(e.TargetException)) && (p.property.Attributes & PropertyAttribute.OPTIONAL) != 0) { - throw new UnknownPropertyException(name, object); + throw new UnknownPropertyException(e, name, object); } else if (new Type(PropertyVetoException.class).isSupertypeOf( AnyConverter.getType(e.TargetException)) && ((p.property.Attributes & PropertyAttribute.CONSTRAINED) != 0)) { - throw new PropertyVetoException(name, object); + throw new PropertyVetoException(e, name, object); } else { throw new WrappedTargetException( e.getMessage(), object, e.TargetException); @@ -765,9 +761,7 @@ public final class PropertySetMixin { value = field.get( new Any(type, UnoRuntime.queryInterface(type, object))); } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException( - "unexpected com.sun.star.lang.IllegalArgumentException: " - + e.getMessage()); + throw new RuntimeException(e); } catch (WrappedTargetRuntimeException e) { //FIXME A WrappedTargetRuntimeException from XIdlField2.get is not // guaranteed to originate directly within XIdlField2.get (and thus @@ -777,7 +771,7 @@ public final class PropertySetMixin { AnyConverter.getType(e.TargetException)) && (p.property.Attributes & PropertyAttribute.OPTIONAL) != 0) { - throw new UnknownPropertyException(name, object); + throw new UnknownPropertyException(e, name, object); } else { throw new WrappedTargetException( e.getMessage(), object, e.TargetException); @@ -806,10 +800,7 @@ public final class PropertySetMixin { XIdlField2.class, ambiguous.getField("Value")).get(value); } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException( - "unexpected" - + " com.sun.star.lang.IllegalArgumentException: " - + e.getMessage()); + throw new RuntimeException(e); } undoAmbiguous = false; } else if (undoDefaulted @@ -825,10 +816,7 @@ public final class PropertySetMixin { XIdlField2.class, defaulted.getField("Value")).get(value); } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException( - "unexpected" - + " com.sun.star.lang.IllegalArgumentException: " - + e.getMessage()); + throw new RuntimeException(e); } undoDefaulted = false; } else if (undoOptional @@ -848,10 +836,7 @@ public final class PropertySetMixin { XIdlField2.class, optional.getField("Value")).get(value); } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException( - "unexpected" - + " com.sun.star.lang.IllegalArgumentException: " - + e.getMessage()); + throw new RuntimeException(e); } undoOptional = false; } else { @@ -892,13 +877,9 @@ public final class PropertySetMixin { XIdlField2.class, type.getField("IsAmbiguous")).set( strct, Boolean.valueOf(isAmbiguous)); } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException( - "unexpected com.sun.star.lang.IllegalArgumentException: " - + e.getMessage()); + throw new RuntimeException(e); } catch (com.sun.star.lang.IllegalAccessException e) { - throw new RuntimeException( - "unexpected com.sun.star.lang.IllegalAccessException: " - + e.getMessage()); + throw new RuntimeException(e); } return strct[0]; } else if (wrapDefaulted @@ -919,13 +900,9 @@ public final class PropertySetMixin { XIdlField2.class, type.getField("IsDefaulted")).set( strct, Boolean.valueOf(isDefaulted)); } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException( - "unexpected com.sun.star.lang.IllegalArgumentException: " - + e.getMessage()); + throw new RuntimeException(e); } catch (com.sun.star.lang.IllegalAccessException e) { - throw new RuntimeException( - "unexpected com.sun.star.lang.IllegalAccessException: " - + e.getMessage()); + throw new RuntimeException(e); } return strct[0]; } else if (wrapOptional @@ -948,13 +925,9 @@ public final class PropertySetMixin { wrapDefaulted, isDefaulted, false)); } } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new RuntimeException( - "unexpected com.sun.star.lang.IllegalArgumentException: " - + e.getMessage()); + throw new RuntimeException(e); } catch (com.sun.star.lang.IllegalAccessException e) { - throw new RuntimeException( - "unexpected com.sun.star.lang.IllegalAccessException: " - + e.getMessage()); + throw new RuntimeException(e); } return strct[0]; } else { diff --git a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java index 23ab8022e17c..95d401440b3d 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java @@ -241,8 +241,8 @@ public class UnoUrl { } } catch (UnsupportedEncodingException e) { - throw new com.sun.star.lang.IllegalArgumentException( - "Couldn't convert parameter string to UTF-8 string:" + e.getMessage()); + throw new com.sun.star.lang.IllegalArgumentException(e, + "Couldn't convert parameter string to UTF-8 string"); } } diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java b/jurt/com/sun/star/comp/loader/JavaLoader.java index 8244d43c326c..03b1a7fbd205 100644 --- a/jurt/com/sun/star/comp/loader/JavaLoader.java +++ b/jurt/com/sun/star/comp/loader/JavaLoader.java @@ -121,10 +121,10 @@ public class JavaLoader implements XImplementationLoader, } return ret; } catch (com.sun.star.uno.Exception exc) { - throw new com.sun.star.uno.RuntimeException( + throw new com.sun.star.uno.RuntimeException(exc, exc.getMessage(), this ); } catch (java.lang.Exception exc) { - throw new com.sun.star.uno.RuntimeException( + throw new com.sun.star.uno.RuntimeException(exc, exc.getMessage(), this ); } } @@ -174,7 +174,7 @@ public class JavaLoader implements XImplementationLoader, multiServiceFactory = (XMultiServiceFactory) AnyConverter.toObject( new Type(XMultiServiceFactory.class), args[0]); } catch (ClassCastException castEx) { - throw new com.sun.star.lang.IllegalArgumentException( + throw new com.sun.star.lang.IllegalArgumentException(castEx, "The argument must be an instance of XMultiServiceFactory"); } } @@ -330,21 +330,21 @@ public class JavaLoader implements XImplementationLoader, returnObject = oRet; } } catch ( NoSuchMethodException e) { - throw new CannotActivateFactoryException("Can not activate the factory for " - + implementationName + " because " + e.toString() ); + throw new CannotActivateFactoryException(e, "Can not activate the factory for " + + implementationName); } catch ( SecurityException e) { - throw new CannotActivateFactoryException("Can not activate the factory for " - + implementationName + " because " + e.toString() ); + throw new CannotActivateFactoryException(e, "Can not activate the factory for " + + implementationName); } catch ( IllegalAccessException e ) { - throw new CannotActivateFactoryException("Can not activate the factory for " - + implementationName + " because " + e.toString() ); + throw new CannotActivateFactoryException(e, "Can not activate the factory for " + + implementationName); } catch ( IllegalArgumentException e ) { - throw new CannotActivateFactoryException("Can not activate the factory for " - + implementationName + " because " + e.toString() ); + throw new CannotActivateFactoryException(e, "Can not activate the factory for " + + implementationName); } catch ( InvocationTargetException e ) { - throw new CannotActivateFactoryException("Can not activate the factory for " - + implementationName + " because " + e.getCause().toString() ); + throw new CannotActivateFactoryException(e, "Can not activate the factory for " + + implementationName); } return returnObject; diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java index 60cf351162b9..5a7e91c77fe5 100644 --- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java +++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java @@ -87,7 +87,7 @@ public class UrlResolver { xBridgeFactory = UnoRuntime.queryInterface(XBridgeFactory.class, _xMultiServiceFactory.createInstance("com.sun.star.bridge.BridgeFactory")); } catch (com.sun.star.uno.Exception e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); + throw new com.sun.star.uno.RuntimeException(e); } XBridge xBridge = xBridgeFactory.getBridge(conDcp + ";" + protDcp); @@ -96,7 +96,7 @@ public class UrlResolver { try { connector = _xMultiServiceFactory.createInstance("com.sun.star.connection.Connector"); } catch (com.sun.star.uno.Exception e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); + throw new com.sun.star.uno.RuntimeException(e); } XConnector connector_xConnector = UnoRuntime.queryInterface(XConnector.class, connector); @@ -106,7 +106,7 @@ public class UrlResolver { try { xBridge = xBridgeFactory.createBridge(conDcp + ";" + protDcp, protDcp, xConnection, null); } catch (com.sun.star.bridge.BridgeExistsException e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); + throw new com.sun.star.uno.RuntimeException(e); } } rootObject = xBridge.getInstance(rootOid); 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; diff --git a/odk/examples/DevelopersGuide/GUI/DialogDocument.java b/odk/examples/DevelopersGuide/GUI/DialogDocument.java index 570f5b2a78f5..fd5df052b05b 100644 --- a/odk/examples/DevelopersGuide/GUI/DialogDocument.java +++ b/odk/examples/DevelopersGuide/GUI/DialogDocument.java @@ -134,11 +134,9 @@ public class DialogDocument extends UnoDialogSample { aPropertyValues[1] = aPropertyValue; xComponentLoader.loadComponentFromURL(_sUrl, "_self", 0, aPropertyValues); } catch (com.sun.star.lang.IllegalArgumentException ex) { - ex.printStackTrace(); - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen...", ex); } catch (com.sun.star.uno.Exception ex) { - ex.printStackTrace(); - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen...", ex); } } diff --git a/odk/examples/DevelopersGuide/GUI/ImageControlSample.java b/odk/examples/DevelopersGuide/GUI/ImageControlSample.java index 7415b055bb92..d808b78af69a 100644 --- a/odk/examples/DevelopersGuide/GUI/ImageControlSample.java +++ b/odk/examples/DevelopersGuide/GUI/ImageControlSample.java @@ -158,6 +158,6 @@ public class ImageControlSample extends UnoDialogSample{ xGraphic = xGraphicProvider.queryGraphic(aPropertyValues); return xGraphic; }catch (com.sun.star.uno.Exception ex){ - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen...", ex); }} } diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java index 6fa8055d3a11..d2730e0f3e54 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java @@ -1240,7 +1240,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // finally set the created pointer at the windowpeer of the control xControl.getPeer().setPointer(xPointer); } catch (com.sun.star.uno.Exception ex) { - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen...", ex); } } diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java index f3ba77ac6206..27c578ba4270 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java @@ -223,7 +223,7 @@ public class UnoDialogSample2 extends UnoDialogSample { new Object[] {Boolean.FALSE, Integer.valueOf(_nHeight), sName, Integer.valueOf(_nPosX), Integer.valueOf(_nPosY), Boolean.TRUE, Integer.valueOf(_nStep), _sStringItemList, Integer.valueOf(_nWidth)}); m_xDlgModelNameContainer.insertByName(sName, xLBModelMPSet); }catch (com.sun.star.uno.Exception ex) { - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen...", ex); } return xListBox; } diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu.java b/odk/examples/DevelopersGuide/GUI/UnoMenu.java index 5dbb0154484c..b6e9533ecb8a 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoMenu.java +++ b/odk/examples/DevelopersGuide/GUI/UnoMenu.java @@ -84,7 +84,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { xPopupMenu.addMenuListener(this); }catch( Exception e ) { - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen...", e); } return xPopupMenu; } @@ -102,7 +102,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { xMenuBar.addMenuListener(_xMenuListener); _xTopWindow.setMenuBar(xMenuBar); }catch( Exception e ) { - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen...", e); }} protected void closeDialog(){ diff --git a/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java b/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java index 4cf807828b5c..2a1d3836517f 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java +++ b/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java @@ -122,8 +122,7 @@ public class ConnectionAwareClient extends java.awt.Frame catch ( com.sun.star.uno.Exception exc ) { _txtLabel.setText( exc.getMessage() ); - exc.printStackTrace(); - throw new java.lang.RuntimeException( exc.getMessage() ); + throw new java.lang.RuntimeException( exc ); } } diff --git a/reportbuilder/java/org/libreoffice/report/SOImageService.java b/reportbuilder/java/org/libreoffice/report/SOImageService.java index 319f9090a121..1979c4fd504a 100644 --- a/reportbuilder/java/org/libreoffice/report/SOImageService.java +++ b/reportbuilder/java/org/libreoffice/report/SOImageService.java @@ -146,19 +146,19 @@ public class SOImageService implements ImageService } catch (UnknownPropertyException ex) { - throw new ReportExecutionException(); + throw new ReportExecutionException(ex); } catch (WrappedTargetException ex) { - throw new ReportExecutionException(); + throw new ReportExecutionException(ex); } catch (com.sun.star.lang.IllegalArgumentException ex) { - throw new ReportExecutionException(); + throw new ReportExecutionException(ex); } catch (IOException ex) { - throw new ReportExecutionException(); + throw new ReportExecutionException(ex); } return null; } diff --git a/reportbuilder/java/org/libreoffice/report/StorageRepository.java b/reportbuilder/java/org/libreoffice/report/StorageRepository.java index 2f3e4249fd59..1ccfc5253f77 100644 --- a/reportbuilder/java/org/libreoffice/report/StorageRepository.java +++ b/reportbuilder/java/org/libreoffice/report/StorageRepository.java @@ -87,9 +87,11 @@ public class StorageRepository implements InputRepository, OutputRepository final XStream xStream = UnoRuntime.queryInterface(XStream.class, input.openStreamElement(name, ElementModes.READ)); return new BufferedInputStream(new XInputStreamToInputStreamAdapter(xStream.getInputStream()), 102400); } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex1) { - throw new IOException("createInputStream"); + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(ex1); + throw ex2; } } @@ -116,9 +118,11 @@ public class StorageRepository implements InputRepository, OutputRepository } return new BufferedOutputStream(new XOutputStreamToOutputStreamAdapter(stream.getOutputStream()), 204800); } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex1) { - throw new IOException("createOutputStream"); + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(ex1); + throw ex2; } } diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java index 4a6604659010..f6d714722657 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java @@ -216,12 +216,12 @@ public class SOReportJobFactory catch (java.lang.Exception e) { LOGGER.error("ReportProcessing failed", e); - throw new com.sun.star.lang.WrappedTargetException(e.getMessage(), this, null); + throw new com.sun.star.lang.WrappedTargetException(e.getMessage(), this, e); } catch (java.lang.IncompatibleClassChangeError e2) { LOGGER.error("Detected an IncompatibleClassChangeError"); - throw new com.sun.star.lang.WrappedTargetException("caught a " + e2.getClass().getName(), this, new com.sun.star.uno.Exception(e2.getLocalizedMessage())); + throw new com.sun.star.lang.WrappedTargetException("caught a " + e2.getClass().getName(), this, e2); } Thread.currentThread().setContextClassLoader(cl); diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java index 0c78d4a8d2e4..3fde6704afad 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java @@ -74,7 +74,7 @@ public class StarReportDataFactory implements ReportDataFactory, Cloneable { message = "Failed to query data"; } - throw new ReportDataFactoryException(message); + throw new ReportDataFactoryException(message, e); } } @@ -99,7 +99,7 @@ public class StarReportDataFactory implements ReportDataFactory, Cloneable } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Clone failed?"); + throw new IllegalStateException(e); } } diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java b/reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java index e0724596773e..8ba9231850cd 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java @@ -242,7 +242,7 @@ public class StyleUtilities } catch (CloneNotSupportedException e) { - throw new ReportProcessingException("Failed to clone font-face element"); + throw new ReportProcessingException("Failed to clone font-face element", e); } } @@ -308,7 +308,7 @@ public class StyleUtilities } catch (CloneNotSupportedException e) { - throw new ReportProcessingException("Failed to copy style. This should not have happened."); + throw new ReportProcessingException("Failed to copy style. This should not have happened.", e); } } else diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java b/reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java index f45eca92a47f..0023856170c0 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java @@ -1263,7 +1263,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } catch (IOException ioe) { - throw new ReportProcessingException("Failed to write settings document"); + throw new ReportProcessingException("Failed to write settings document", ioe); } } diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java b/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java index c5f6a439bf0e..196df54fd112 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java @@ -62,7 +62,7 @@ class WikiProtocolSocketFactory implements SecureProtocolSocketFactory } catch( Exception e ) { - throw new RuntimeException( "No access to the default trust manager!" ); + throw new RuntimeException( "No access to the default trust manager!", e ); } } diff --git a/testtools/com/sun/star/comp/bridge/TestComponent.java b/testtools/com/sun/star/comp/bridge/TestComponent.java index 4a5c0763461a..bee487bc4ef2 100644 --- a/testtools/com/sun/star/comp/bridge/TestComponent.java +++ b/testtools/com/sun/star/comp/bridge/TestComponent.java @@ -285,7 +285,7 @@ public class TestComponent { return new Type[]{new Type(XPerformanceTest.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class)}; } catch(Exception exception) { - throw new com.sun.star.uno.RuntimeException(exception.getMessage()); + throw new com.sun.star.uno.RuntimeException(exception); } } @@ -721,7 +721,7 @@ public class TestComponent { Thread.sleep(nWaitMUSEC / 10000); } catch(InterruptedException interruptedException) { - throw new com.sun.star.uno.RuntimeException(interruptedException.getMessage()); + throw new com.sun.star.uno.RuntimeException(interruptedException); } if(_bFirstCall) @@ -738,7 +738,7 @@ public class TestComponent { Thread.sleep(nWaitMUSEC / 10000); } catch(InterruptedException interruptedException) { - throw new com.sun.star.uno.RuntimeException(interruptedException.getMessage()); + throw new com.sun.star.uno.RuntimeException(interruptedException); } _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); @@ -954,7 +954,7 @@ public class TestComponent { return new Type[]{new Type(XBridgeTest.class), new Type(XRecursiveCall.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class)}; } catch(Exception exception) { - throw new com.sun.star.uno.RuntimeException(exception.getMessage()); + throw new com.sun.star.uno.RuntimeException(exception); } } diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java index 30fe66b48d99..da0d31a180b8 100644 --- a/xmerge/source/bridge/java/XMergeBridge.java +++ b/xmerge/source/bridge/java/XMergeBridge.java @@ -312,11 +312,11 @@ public class XMergeBridge { } catch (IOException e){ - throw new com.sun.star.uno.RuntimeException(e.getMessage()); + throw new com.sun.star.uno.RuntimeException(e); } catch (Exception e){ - throw new com.sun.star.uno.RuntimeException("Xmerge Exception"); + throw new com.sun.star.uno.RuntimeException(e); } } @@ -476,13 +476,10 @@ public class XMergeBridge { } ConverterInfoMgr.removeByJar(jarName); } - catch (StackOverflowError sOE){ - System.out.println("\nERROR : Stack Overflow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n"); - - } - catch (Exception e) { - System.out.println("Error:"+e); - throw new IOException("Xmerge Exception"); + catch (Exception ex1) { + IOException ex2 = new IOException(); + ex2.initCause(ex1); + throw ex2; } } else{ @@ -513,9 +510,10 @@ public class XMergeBridge { catch (StackOverflowError sOE){ System.out.println("\nERROR : Stack Overflow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n"); } - catch (Exception e) { - System.out.println("Error:"+e); - throw new IOException("Xmerge Exception"); + catch (Exception ex1) { + IOException ex2 = new IOException(); + ex2.initCause(ex1); + throw ex2; } diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java index f722732be8c3..99f9d9e7fdf6 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java @@ -291,7 +291,9 @@ public class DOMDocument return writer.toString().getBytes(); } catch (Exception e) { // We don't have another parser - throw new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl); + IOException ex2 = new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl); + ex2.initCause(e); + throw ex2; } } } diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java index 7ca174a0af1d..2f87d2b8e1de 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java @@ -144,9 +144,8 @@ public final class Driver { myConvert.addInputStream(f.getName(), fis); } } catch (Exception addExcept) { - System.out.println("\nFile <" + processFile + "> is not in <" + - fromMime + "> format"); - throw new IllegalArgumentException(); + throw new IllegalArgumentException("\nFile <" + processFile + "> is not in <" + + fromMime + "> format", addExcept); } ConvertData dataOut = null; diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java index 5f09b628788b..14e036687828 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java @@ -128,9 +128,8 @@ public class ConverterInfo { } } catch (Exception e) { - RegistryException re = new RegistryException( - "Class implementation of the plug-in cannot be loaded."); - throw re; + throw new RegistryException( + "Class implementation of the plug-in cannot be loaded.", e); } } @@ -200,9 +199,8 @@ public class ConverterInfo { } } catch (Exception e) { - RegistryException re = new RegistryException( - "Class implementation of the plug-in cannot be loaded."); - throw re; + throw new RegistryException( + "Class implementation of the plug-in cannot be loaded.", e); } } diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java index 3630ed9c2d1d..6452256d25bb 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java @@ -31,4 +31,8 @@ public class RegistryException extends Exception { public RegistryException(String message) { super(message); } + + public RegistryException(String message, Throwable cause) { + super(message, cause); + } }
\ No newline at end of file |