[Libreoffice-commits] core.git: 5 commits - bean/com bridges/source connectivity/com connectivity/qa desktop/test filter/qa forms/qa framework/qa javaunohelper/com jurt/com odk/examples qadevOOo/runner qadevOOo/testdocs qadevOOo/tests reportbuilder/java scripting/java swext/mediawiki sw/qa testtools/com wizards/com xmerge/source

Noel Grandin noel at peralex.com
Thu Oct 16 03:27:54 PDT 2014


 bean/com/sun/star/comp/beans/LocalOfficeConnection.java                                             |   12 -
 bean/com/sun/star/comp/beans/NoConnectionException.java                                             |    5 
 bean/com/sun/star/comp/beans/OOoBean.java                                                           |   99 +++++----
 bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_proxy.java                             |    2 
 connectivity/com/sun/star/sdbcx/comp/hsqldb/NativeStorageAccess.java                                |    6 
 connectivity/com/sun/star/sdbcx/comp/hsqldb/StorageAccess.java                                      |    6 
 connectivity/qa/complex/connectivity/HsqlDriverTest.java                                            |    2 
 connectivity/qa/connectivity/tools/RowSet.java                                                      |    3 
 desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java |   12 -
 filter/qa/complex/filter/detection/typeDetection/Helper.java                                        |    8 
 forms/qa/org/openoffice/xforms/XMLDocument.java                                                     |    2 
 framework/qa/complex/framework/autosave/ConfigHelper.java                                           |    2 
 framework/qa/complex/loadAllDocuments/StreamSimulator.java                                          |    3 
 javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java                      |   10 
 javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java                                   |    8 
 javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java                                          |    2 
 javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java                                     |   63 +-----
 javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java                                               |    4 
 jurt/com/sun/star/comp/loader/JavaLoader.java                                                       |   26 +-
 jurt/com/sun/star/comp/urlresolver/UrlResolver.java                                                 |    6 
 jurt/com/sun/star/lib/connections/pipe/PipeConnection.java                                          |   10 
 jurt/com/sun/star/lib/connections/pipe/pipeConnector.java                                           |    2 
 jurt/com/sun/star/lib/connections/socket/ConnectionDescriptor.java                                  |    6 
 jurt/com/sun/star/lib/connections/socket/SocketConnection.java                                      |    6 
 odk/examples/DevelopersGuide/GUI/DialogDocument.java                                                |    6 
 odk/examples/DevelopersGuide/GUI/ImageControlSample.java                                            |    2 
 odk/examples/DevelopersGuide/GUI/UnoDialogSample.java                                               |    2 
 odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java                                              |    2 
 odk/examples/DevelopersGuide/GUI/UnoMenu.java                                                       |    4 
 odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java                    |    3 
 qadevOOo/runner/complexlib/Assurance.java                                                           |    3 
 qadevOOo/runner/convwatch/ConvWatchCancelException.java                                             |    5 
 qadevOOo/runner/convwatch/ConvWatchException.java                                                   |    5 
 qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java                                             |    2 
 qadevOOo/runner/convwatch/MSOfficePrint.java                                                        |    2 
 qadevOOo/runner/convwatch/OfficePrint.java                                                          |    5 
 qadevOOo/runner/convwatch/ReportDesignerTest.java                                                   |    2 
 qadevOOo/runner/graphical/MSOfficePostscriptCreator.java                                            |    7 
 qadevOOo/runner/graphical/OfficeException.java                                                      |    5 
 qadevOOo/runner/graphical/WrongEnvironmentException.java                                            |    4 
 qadevOOo/runner/helper/ConfigHelper.java                                                            |   26 +-
 qadevOOo/runner/helper/StreamSimulator.java                                                         |    2 
 qadevOOo/runner/util/BasicMacroTools.java                                                           |  101 +++-------
 qadevOOo/runner/util/CalcTools.java                                                                 |   77 ++-----
 qadevOOo/runner/util/DesktopTools.java                                                              |    6 
 qadevOOo/runner/util/DrawTools.java                                                                 |    4 
 qadevOOo/runner/util/FormTools.java                                                                 |    2 
 qadevOOo/runner/util/SOfficeFactory.java                                                            |    3 
 qadevOOo/runner/util/UITools.java                                                                   |    8 
 qadevOOo/runner/util/WriterTools.java                                                               |    2 
 qadevOOo/runner/util/compare/GraphicalComparator.java                                               |   12 -
 qadevOOo/testdocs/backend/org/openoffice/JavaSystemBackend.java                                     |    2 
 qadevOOo/tests/java/ifc/beans/_XMultiPropertyStates.java                                            |    4 
 qadevOOo/tests/java/ifc/beans/_XPropertyWithState.java                                              |    3 
 qadevOOo/tests/java/ifc/document/_Settings.java                                                     |    4 
 qadevOOo/tests/java/ifc/io/_XActiveDataControl.java                                                 |    9 
 qadevOOo/tests/java/ifc/sheet/_XFormulaQuery.java                                                   |    3 
 qadevOOo/tests/java/ifc/sheet/_XSheetAuditing.java                                                  |    2 
 qadevOOo/tests/java/mod/_adabas/ODriver.java                                                        |    3 
 qadevOOo/tests/java/mod/_ado/ODriver.java                                                           |    3 
 qadevOOo/tests/java/mod/_dbaccess/ConnectionLineAccessibility.java                                  |   48 +---
 qadevOOo/tests/java/mod/_dbaccess/JoinViewAccessibility.java                                        |   56 +----
 qadevOOo/tests/java/mod/_dbaccess/ORowSet.java                                                      |    5 
 qadevOOo/tests/java/mod/_dbaccess/TableWindowAccessibility.java                                     |   53 +----
 qadevOOo/tests/java/mod/_dbpool/OConnectionPool.java                                                |    3 
 qadevOOo/tests/java/mod/_file/calc/ODriver.java                                                     |    3 
 qadevOOo/tests/java/mod/_file/dbase/ODriver.java                                                    |    3 
 qadevOOo/tests/java/mod/_file/flat/ODriver.java                                                     |    3 
 qadevOOo/tests/java/mod/_forms/ODatabaseForm.java                                                   |    5 
 qadevOOo/tests/java/mod/_forms/OFileControlModel.java                                               |    8 
 qadevOOo/tests/java/mod/_fwk/Desktop.java                                                           |    8 
 qadevOOo/tests/java/mod/_fwk/DispatchRecorderSupplier.java                                          |    4 
 qadevOOo/tests/java/mod/_fwk/JobExecutor.java                                                       |    4 
 qadevOOo/tests/java/mod/_fwk/JobHandler.java                                                        |    4 
 qadevOOo/tests/java/mod/_fwk/MailToDispatcher.java                                                  |    4 
 qadevOOo/tests/java/mod/_fwk/ModuleManager.java                                                     |    4 
 qadevOOo/tests/java/mod/_fwk/ServiceHandler.java                                                    |    4 
 qadevOOo/tests/java/mod/_fwk/SoundHandler.java                                                      |    4 
 qadevOOo/tests/java/mod/_fwk/URLTransformer.java                                                    |    4 
 qadevOOo/tests/java/mod/_fwl/FilterFactory.java                                                     |    6 
 qadevOOo/tests/java/mod/_fwl/TypeDetection.java                                                     |    6 
 qadevOOo/tests/java/mod/_jdbc/JDBCDriver.java                                                       |    3 
 qadevOOo/tests/java/mod/_mozab/MozabDriver.java                                                     |    2 
 qadevOOo/tests/java/mod/_odbc/ODBCDriver.java                                                       |    3 
 qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java                             |    2 
 qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java                                    |    3 
 qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java                                             |    3 
 qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java                                         |    3 
 qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java                                            |    3 
 qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java                                      |   21 --
 qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java                                           |    3 
 qadevOOo/tests/java/mod/_sd/DrawController_DrawView.java                                            |    3 
 qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java                                         |    3 
 qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java                                           |    3 
 qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java                                         |    3 
 qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java                                    |    3 
 qadevOOo/tests/java/mod/_sw/SwAccessibleDocumentPageView.java                                       |    3 
 qadevOOo/tests/java/mod/_sw/SwAccessiblePageView.java                                               |    3 
 qadevOOo/tests/java/mod/_toolkit/MutableTreeNode.java                                               |    2 
 reportbuilder/java/org/libreoffice/report/SOImageService.java                                       |    8 
 reportbuilder/java/org/libreoffice/report/StorageRepository.java                                    |   12 -
 reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java                           |    4 
 reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java                        |    4 
 reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java                        |    4 
 reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java              |    2 
 scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java                 |   10 
 scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java                           |   22 --
 scripting/java/com/sun/star/script/framework/container/Parcel.java                                  |    4 
 scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java                        |   36 ++-
 scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java                               |   14 -
 scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java                            |   31 ++-
 scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java                           |   31 ++-
 scripting/java/com/sun/star/script/framework/io/XStorageHelper.java                                 |    6 
 scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java     |    4 
 scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java   |    4 
 sw/qa/complex/writer/CheckBookmarks.java                                                            |    2 
 swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java                                |    2 
 testtools/com/sun/star/comp/bridge/TestComponent.java                                               |    8 
 wizards/com/sun/star/wizards/common/FileAccess.java                                                 |    3 
 wizards/com/sun/star/wizards/common/InvalidQueryException.java                                      |    9 
 wizards/com/sun/star/wizards/common/NoValidPathException.java                                       |   10 
 wizards/com/sun/star/wizards/common/NumericalHelper.java                                            |   20 -
 wizards/com/sun/star/wizards/common/Resource.java                                                   |    9 
 wizards/com/sun/star/wizards/common/SystemDialog.java                                               |    3 
 wizards/com/sun/star/wizards/db/RecordParser.java                                                   |    3 
 wizards/com/sun/star/wizards/report/ReportLayouter.java                                             |    3 
 wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java                               |    2 
 xmerge/source/bridge/java/XMergeBridge.java                                                         |   22 --
 xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java                      |    4 
 xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java                                    |    5 
 xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java                    |   10 
 xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java                |    4 
 132 files changed, 564 insertions(+), 699 deletions(-)

New commits:
commit 9341bf3dc38b2cc117ffbe12ff057511ed6e046d
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Oct 16 12:19:14 2014 +0200

    java: when rethrowing, store the original exception
    
    Change-Id: I34ce000c48d2d79bfec854c8dd55d12f2bee29c7

diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
index 52cef3c..a2f0db9 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 a60cedd..76821b8 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 d874386..4a82c5e 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 679d41e..1ea9cd2 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 20a3412..eefb371 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 5a399a2..747b2ac 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 e5b2545..5897fce 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 559fbd8..28d6dc3b 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 fb7a7ec..83026fd 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 0f6b337..e223676 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 d9ab6f5..204be38 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 2930915..f688fb9 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 ecb1df6..19d5919 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 48ca6c6..c867cad 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 aaf7691..47407b1 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 b00519a..f3d9a8e 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 23ab802..95d4014 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 8244d43..03b1a7f 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 60cf351..5a7e91c 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 2552c9b..4401607 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 95c064e..d701384 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 aec6a63..4cd8e43 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 6f2a548..c0a94d6 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 570f5b2..fd5df05 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 7415b05..d808b78 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 6fa8055..d2730e0 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 f3ba77a..27c578b 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 5dbb015..b6e9533 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 4cf8078..2a1d383 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 319f909..1979c4f 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 2f3e424..1ccfc52 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 4a66046..f6d7147 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 0c78d4a..3fde670 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 e072459..8ba9231 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 f45eca9..0023856 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 c5f6a43..196df54 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 4a5c076..bee487b 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 30fe66b..da0d31a 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 f722732..99f9d9e 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 7ca174a..2f87d2b 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 5f09b62..14e0366 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 3630ed9..6452256 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
commit b2f69f626409442d1f0ca5049b946946ce9b01d8
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Oct 16 12:17:47 2014 +0200

    java: when rethrowing, store the original exception
    
    Change-Id: I14666493e72da177fcfff1895ef3206f0e13cc01

diff --git a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java
index b9df352..92f5ee7 100644
--- a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java
+++ b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java
@@ -165,7 +165,7 @@ public class SecurityDialog extends WeakBase implements
             try {
                 checkBoxPath = AnyConverter.toString(args[0]);
             } catch (IllegalArgumentException e) {
-                throw new RuntimeException("SecurityDialog::initialize: " + e.getMessage());
+                throw new RuntimeException(e);
             }
 
             LogUtils.DEBUG("path: " + checkBoxPath);
@@ -189,13 +189,9 @@ public class SecurityDialog extends WeakBase implements
         try {
             _xDialog = createDialog();
         } catch (com.sun.star.uno.Exception e) {
-            LogUtils.DEBUG("Couldn't create dialog");
-            LogUtils.DEBUG("uno message: " + e.getMessage());
-            throw new RuntimeException(e.getMessage());
+            throw new RuntimeException(e);
         } catch (Exception e) {
-            LogUtils.DEBUG("Couldn't create dialog");
-            LogUtils.DEBUG("message: " + e.getMessage());
-            throw new RuntimeException(e.getMessage());
+            throw new RuntimeException(e);
         }
 
     }
diff --git a/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java
index e816f8e..fe2efd9 100644
--- a/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java
+++ b/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java
@@ -185,16 +185,12 @@ public class ScriptBrowseNode extends PropertySet implements
             try {
                 data = (ScriptMetaData)parent.getByName(name);
             } catch (NoSuchElementException nse) {
-
-                throw new com.sun.star.lang.IllegalArgumentException(
+                throw new com.sun.star.lang.IllegalArgumentException(nse,
                     name + " does not exist or can't be found ");
-
             } catch (com.sun.star.lang.WrappedTargetException wte) {
-
                 // rethrow
                 throw new InvocationTargetException(
                     "Scripting framework editing script ", null, wte.TargetException);
-
             }
 
             provider.getScriptEditor().edit(ctxt, data);
@@ -212,16 +208,12 @@ public class ScriptBrowseNode extends PropertySet implements
                 parent.removeByName(name);
                 result = new Any(new Type(Boolean.class), Boolean.TRUE);
             } catch (NoSuchElementException nse) {
-
-                throw new com.sun.star.lang.IllegalArgumentException(
+                throw new com.sun.star.lang.IllegalArgumentException(nse,
                     name + " does not exist or can't be found ");
-
             } catch (WrappedTargetException wte) {
-
                 // rethrow
                 throw new InvocationTargetException(
                     "Scripting framework deleting script ", null, wte.TargetException);
-
             }
 
         } else if (aFunctionName.equals("Renamable")) {
@@ -263,28 +255,20 @@ public class ScriptBrowseNode extends PropertySet implements
                 name = languageName;
                 result = new Any(new Type(XBrowseNode.class), this);
             } catch (NoSuchElementException nse) {
-
-                throw new com.sun.star.lang.IllegalArgumentException(
+                throw new com.sun.star.lang.IllegalArgumentException(nse,
                     name + " does not exist or can't be found ");
-
             } catch (ElementExistException eee) {
-
                 // rethrow
                 throw new InvocationTargetException(
                     "Scripting framework error renaming script ", null, eee);
-
             } catch (WrappedTargetException wte) {
-
                 // rethrow
                 throw new InvocationTargetException(
                     "Scripting framework rename script ", null, wte.TargetException);
-
             }
         } else {
-
             throw new com.sun.star.lang.IllegalArgumentException(
                 "Function " + aFunctionName + " not supported.");
-
         }
 
         return result;
diff --git a/scripting/java/com/sun/star/script/framework/container/Parcel.java b/scripting/java/com/sun/star/script/framework/container/Parcel.java
index 0c9d41d..df94463 100644
--- a/scripting/java/com/sun/star/script/framework/container/Parcel.java
+++ b/scripting/java/com/sun/star/script/framework/container/Parcel.java
@@ -175,8 +175,8 @@ public class Parcel implements XNameContainer {
 
             }
             // TO DO should catch specified exceptions
-            catch (Exception e) {
-                throw new com.sun.star.lang.WrappedTargetException();
+            catch (Exception ex) {
+                throw new com.sun.star.lang.WrappedTargetException(ex);
             }
 
         }
diff --git a/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java b/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java
index 45b10e9..0e25745 100644
--- a/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java
+++ b/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java
@@ -73,12 +73,18 @@ public class XMLParserFactory {
                 }
 
                 result = builder.parse(is);
-            } catch (SAXParseException spe) {
-                throw new IOException(spe.getMessage());
-            } catch (SAXException se) {
-                throw new IOException(se.getMessage());
-            } catch (ParserConfigurationException pce) {
-                throw new IOException(pce.getMessage());
+            } catch (SAXParseException ex1) {
+                IOException ex2 = new IOException();
+                ex2.initCause(ex1);
+                throw ex2;
+            } catch (SAXException ex1) {
+                IOException ex2 = new IOException();
+                ex2.initCause(ex1);
+                throw ex2;
+            } catch (ParserConfigurationException ex1) {
+                IOException ex2 = new IOException();
+                ex2.initCause(ex1);
+                throw ex2;
             }
 
             return result;
@@ -169,12 +175,18 @@ public class XMLParserFactory {
 
                     method.invoke(impl, new Object[] {doc});
                 }
-            } catch (NoSuchMethodException ex) {
-                throw new IOException(ex.getMessage());
-            } catch (ClassNotFoundException ex) {
-                throw new IOException(ex.getMessage());
-            } catch (Exception ex) {
-                throw new IOException(ex.getMessage());
+            } catch (NoSuchMethodException ex1) {
+                IOException ex2 = new IOException();
+                ex2.initCause(ex1);
+                throw ex2;
+            } catch (ClassNotFoundException ex1) {
+                IOException ex2 = new IOException();
+                ex2.initCause(ex1);
+                throw ex2;
+            } catch (Exception ex1) {
+                IOException ex2 = new IOException();
+                ex2.initCause(ex1);
+                throw ex2;
             }
         }
     }
diff --git a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
index 79f933c..3c27b03 100644
--- a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
+++ b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
@@ -255,12 +255,14 @@ public class UCBStreamHandler extends URLStreamHandler {
             }
 
             result = new ByteArrayInputStream(inputBytes[0]);
-        } catch (com.sun.star.io.IOException ioe) {
-            LogUtils.DEBUG("caught exception " + ioe);
-            throw new IOException(ioe.getMessage());
-        } catch (com.sun.star.uno.Exception e) {
-            LogUtils.DEBUG("caught exception " + e);
-            throw new IOException(e.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
+        } catch (com.sun.star.uno.Exception ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         } finally {
             if (xInputStream != null) {
                 try {
diff --git a/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java b/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java
index 402c158..10cb1db 100644
--- a/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java
+++ b/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java
@@ -19,6 +19,7 @@ package com.sun.star.script.framework.io;
 
 import com.sun.star.io.XInputStream;
 
+import java.io.IOException;
 import java.io.InputStream;
 
 public class XInputStreamWrapper extends InputStream {
@@ -36,8 +37,10 @@ public class XInputStreamWrapper extends InputStream {
 
         try {
             numRead = m_xInputStream.readBytes(byteRet, 1);
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
 
         if (numRead != 1) {
@@ -54,8 +57,10 @@ public class XInputStreamWrapper extends InputStream {
 
         try {
             return m_xInputStream.readBytes(byteRet, b.length);
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 
@@ -64,8 +69,10 @@ public class XInputStreamWrapper extends InputStream {
         try {
             m_xInputStream.skipBytes((int)n);
             return n;
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 
@@ -73,8 +80,10 @@ public class XInputStreamWrapper extends InputStream {
     public int available() throws java.io.IOException {
         try {
             return m_xInputStream.available();
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 
@@ -82,8 +91,10 @@ public class XInputStreamWrapper extends InputStream {
     public void close() throws java.io.IOException {
         try {
             m_xInputStream.closeInput();
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 }
\ No newline at end of file
diff --git a/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java b/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java
index 80ab81c..542fb0a 100644
--- a/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java
+++ b/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java
@@ -19,6 +19,7 @@ package com.sun.star.script.framework.io;
 
 import com.sun.star.io.XOutputStream;
 
+import java.io.IOException;
 import java.io.OutputStream;
 
 public class XOutputStreamWrapper extends OutputStream {
@@ -40,8 +41,10 @@ public class XOutputStreamWrapper extends OutputStream {
 
         try {
             m_xOutputStream.writeBytes(bytes);
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 
@@ -54,8 +57,10 @@ public class XOutputStreamWrapper extends OutputStream {
 
         try {
             m_xOutputStream.writeBytes(b);
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
     @Override
@@ -69,8 +74,10 @@ public class XOutputStreamWrapper extends OutputStream {
 
         try {
             m_xOutputStream.writeBytes(bytes);
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 
@@ -82,8 +89,10 @@ public class XOutputStreamWrapper extends OutputStream {
 
         try {
             m_xOutputStream.flush();
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 
@@ -95,8 +104,10 @@ public class XOutputStreamWrapper extends OutputStream {
 
         try {
             m_xOutputStream.closeOutput();
-        } catch (com.sun.star.io.IOException ioe) {
-            throw new java.io.IOException(ioe.getMessage());
+        } catch (com.sun.star.io.IOException ex1) {
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 }
\ No newline at end of file
diff --git a/scripting/java/com/sun/star/script/framework/io/XStorageHelper.java b/scripting/java/com/sun/star/script/framework/io/XStorageHelper.java
index c0132ca..0856e6d 100644
--- a/scripting/java/com/sun/star/script/framework/io/XStorageHelper.java
+++ b/scripting/java/com/sun/star/script/framework/io/XStorageHelper.java
@@ -153,9 +153,11 @@ public class XStorageHelper implements XEventListener {
             }
         } catch (com.sun.star.io.IOException ioe) {
             disposeObject();
-        } catch (com.sun.star.uno.Exception e) {
+        } catch (com.sun.star.uno.Exception ex1) {
             disposeObject();
-            throw new IOException(e.getMessage());
+            IOException ex2 = new IOException();
+            ex2.initCause(ex1);
+            throw ex2;
         }
     }
 
diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java
index e4aa8fc..59004f0 100644
--- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java
+++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java
@@ -144,9 +144,7 @@ class ScriptImpl implements XScript {
         try {
             this.m_xMultiComponentFactory = m_xContext.getServiceManager();
         } catch (Exception e) {
-            LogUtils.DEBUG(LogUtils.getTrace(e));
-            throw new com.sun.star.uno.RuntimeException(
-                "Error constructing  ScriptImpl [beanshell]: " + e.getMessage());
+            throw new com.sun.star.uno.RuntimeException(e);
         }
 
         LogUtils.DEBUG("ScriptImpl [beanshell] script data = " + metaData);
diff --git a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
index c347e80..25edc0f 100644
--- a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
+++ b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
@@ -139,9 +139,7 @@ class ScriptImpl implements XScript {
         try {
             this.m_xMultiComponentFactory = m_xContext.getServiceManager();
         } catch (Exception e) {
-            LogUtils.DEBUG(LogUtils.getTrace(e));
-            throw new com.sun.star.uno.RuntimeException(
-                "Error constructing  ScriptImpl: [javascript]");
+            throw new com.sun.star.uno.RuntimeException(e);
         }
 
         LogUtils.DEBUG("ScriptImpl [javascript] script data = " + metaData);
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java
index 8e27966..6935c1f 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.java
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -621,8 +621,7 @@ public class FileAccess
         }
         catch (com.sun.star.uno.Exception e)
         {
-            e.printStackTrace();
-            throw new NoValidPathException(null, "Internal error.");
+            throw new NoValidPathException(null, "Internal error.", e);
         }
 
         for (int j = 0; j < FolderName.size(); j++)
diff --git a/wizards/com/sun/star/wizards/common/InvalidQueryException.java b/wizards/com/sun/star/wizards/common/InvalidQueryException.java
index a5e256c..efe21aa 100644
--- a/wizards/com/sun/star/wizards/common/InvalidQueryException.java
+++ b/wizards/com/sun/star/wizards/common/InvalidQueryException.java
@@ -21,10 +21,17 @@ import com.sun.star.lang.XMultiServiceFactory;
 
 public class InvalidQueryException extends java.lang.Throwable
 {
-// TODO don't show messages in Excetions
+    // TODO don't show messages in Exceptions
     public InvalidQueryException(XMultiServiceFactory xMSF, String sCommand)
     {
         final int RID_REPORT = 2400;
         SystemDialog.showErrorBox(xMSF, "ReportWizard", "dbw", RID_REPORT + 65, "<STATEMENT>", sCommand); // Querycreationnotpossible
     }
+    // TODO don't show messages in Exceptions
+    public InvalidQueryException(XMultiServiceFactory xMSF, String sCommand, Throwable cause)
+    {
+        super(cause);
+        final int RID_REPORT = 2400;
+        SystemDialog.showErrorBox(xMSF, "ReportWizard", "dbw", RID_REPORT + 65, "<STATEMENT>", sCommand); // Querycreationnotpossible
+    }
 }
diff --git a/wizards/com/sun/star/wizards/common/NoValidPathException.java b/wizards/com/sun/star/wizards/common/NoValidPathException.java
index f00be24..074b8f5 100644
--- a/wizards/com/sun/star/wizards/common/NoValidPathException.java
+++ b/wizards/com/sun/star/wizards/common/NoValidPathException.java
@@ -31,4 +31,14 @@ public class NoValidPathException extends Exception
             SystemDialog.showErrorBox(xMSF, "dbwizres", "dbw", 521); // OfficePathnotavailable
         }
     }
+
+    public NoValidPathException(XMultiServiceFactory xMSF, String _sText, Throwable cause)
+    {
+        super(_sText, cause);
+        // TODO: NEVER open a dialog in an exception
+        if (xMSF != null)
+        {
+            SystemDialog.showErrorBox(xMSF, "dbwizres", "dbw", 521); // OfficePathnotavailable
+        }
+    }
 }
diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java
index f460ec4..1d5e483 100644
--- a/wizards/com/sun/star/wizards/common/NumericalHelper.java
+++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java
@@ -119,7 +119,7 @@ public class NumericalHelper
                 }
                 catch (java.lang.NumberFormatException e)
                 {
-                    throw new com.sun.star.lang.IllegalArgumentException(
+                    throw new com.sun.star.lang.IllegalArgumentException(e,
                             "Cannot convert to byte: " + aTypeObject.aValue);
                 }
                 break;
@@ -181,7 +181,7 @@ public class NumericalHelper
                 }
                 catch (java.lang.NumberFormatException e)
                 {
-                    throw new com.sun.star.lang.IllegalArgumentException(
+                    throw new com.sun.star.lang.IllegalArgumentException(e,
                             "Cannot convert to char: " + aTypeObject.aValue);
                 }
                 break;
@@ -234,7 +234,7 @@ public class NumericalHelper
                 }
                 catch (java.lang.NumberFormatException e)
                 {
-                    throw new com.sun.star.lang.IllegalArgumentException(
+                    throw new com.sun.star.lang.IllegalArgumentException(e,
                             "Cannot convert to short: " + aTypeObject.aValue);
                 }
                 break;
@@ -423,7 +423,7 @@ public class NumericalHelper
                 }
                 catch (java.lang.NumberFormatException e)
                 {
-                    throw new com.sun.star.lang.IllegalArgumentException(
+                    throw new com.sun.star.lang.IllegalArgumentException(e,
                             "Cannot convert to int: " + aTypeObject.aValue);
                 }
                 break;
@@ -476,7 +476,7 @@ public class NumericalHelper
                 }
                 catch (java.lang.NumberFormatException e)
                 {
-                    throw new com.sun.star.lang.IllegalArgumentException(
+                    throw new com.sun.star.lang.IllegalArgumentException(e,
                             "Cannot convert to short: " + aTypeObject.aValue);
                 }
                 break;
@@ -529,7 +529,7 @@ public class NumericalHelper
                 }
                 catch (java.lang.NumberFormatException e)
                 {
-                    throw new com.sun.star.lang.IllegalArgumentException(
+                    throw new com.sun.star.lang.IllegalArgumentException(e,
                             "Cannot convert to short: " + aTypeObject.aValue);
                 }
                 break;
@@ -582,7 +582,7 @@ public class NumericalHelper
                 }
                 catch (java.lang.NumberFormatException e)
                 {
-                    throw new com.sun.star.lang.IllegalArgumentException(
+                    throw new com.sun.star.lang.IllegalArgumentException(e,
                             "Cannot convert to short: " + aTypeObject.aValue);
                 }
                 break;
@@ -683,7 +683,7 @@ public class NumericalHelper
                 }
                 catch (java.lang.NumberFormatException e)
                 {
-                    throw new com.sun.star.lang.IllegalArgumentException(
+                    throw new com.sun.star.lang.IllegalArgumentException(e,
                             "Cannot convert to short: " + aTypeObject.aValue);
                 }
                 break;
@@ -1314,8 +1314,8 @@ public class NumericalHelper
             catch (java.lang.ClassCastException e)
             {
                 // unknown type cannot be converted
-                throw new com.sun.star.lang.IllegalArgumentException(
-                        "Cannot convert unknown type: '" + e.getMessage() + "'");
+                throw new com.sun.star.lang.IllegalArgumentException(e,
+                        "Cannot convert unknown type " +array.getClass());
             }
         }
         return aShortVal;
diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java
index 0ea3f5d..9f8f6da 100644
--- a/wizards/com/sun/star/wizards/common/Resource.java
+++ b/wizards/com/sun/star/wizards/common/Resource.java
@@ -79,8 +79,7 @@ public class Resource
         }
         catch (Exception exception)
         {
-            exception.printStackTrace();
-            throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found");
+            throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found", exception);
         }
     }
 
@@ -92,8 +91,7 @@ public class Resource
         }
         catch (Exception exception)
         {
-            exception.printStackTrace();
-            throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found");
+            throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found", exception);
         }
     }
 
@@ -110,8 +108,7 @@ public class Resource
         }
         catch (Exception exception)
         {
-            exception.printStackTrace(System.err);
-            throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found");
+            throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found", exception);
         }
     }
 
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java
index 0349954..62ebeb5 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.java
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.java
@@ -153,8 +153,7 @@ public class SystemDialog
         }
         catch (com.sun.star.lang.IllegalArgumentException iae)
         {
-            iae.printStackTrace();
-            throw new IllegalArgumentException(iae.getMessage());
+            throw new IllegalArgumentException(iae);
         }
         xFolderPicker.setTitle(title);
         xFolderPicker.setDescription(description);
diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java
index 3bc754f..d8acade 100644
--- a/wizards/com/sun/star/wizards/db/RecordParser.java
+++ b/wizards/com/sun/star/wizards/db/RecordParser.java
@@ -221,8 +221,7 @@ public class RecordParser extends QueryMetaData
         }
         catch (Exception exception)
         {
-            exception.printStackTrace(System.err);
-            throw new InvalidQueryException(xMSF, Command);
+            throw new InvalidQueryException(xMSF, Command, exception);
         }
     }
 
diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java
index 022e96d..953e532 100644
--- a/wizards/com/sun/star/wizards/report/ReportLayouter.java
+++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java
@@ -420,8 +420,7 @@ public class ReportLayouter
         }
         catch (Exception ex)
         {
-            ex.printStackTrace();
-            throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
+            throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed", ex);
         }
     }
 }
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
index 2315ea5..02548d0 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
@@ -276,7 +276,7 @@ public class DesignTemplate
         {
             // this should not happen
             a = null;
-            throw new java.lang.RuntimeException(e.getMessage());
+            throw new java.lang.RuntimeException(e);
         }
         catch (com.sun.star.uno.Exception e)
         {
commit 5cba8d44cabc3cbb18648efc9d8658d471b257e7
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Oct 16 12:16:51 2014 +0200

    java: when rethrowing, store the original exception
    
    Change-Id: Idfca83a2a646acab90886c0ef9c30dd7d2fc8b53

diff --git a/qadevOOo/runner/complexlib/Assurance.java b/qadevOOo/runner/complexlib/Assurance.java
index 3b4d03a..53d287e 100644
--- a/qadevOOo/runner/complexlib/Assurance.java
+++ b/qadevOOo/runner/complexlib/Assurance.java
@@ -173,5 +173,8 @@ public class Assurance
         public AssureException(String msg) {
             super(msg);
         }
+        public AssureException(Throwable cause) {
+            super(cause);
+        }
     }
 }
diff --git a/qadevOOo/runner/convwatch/ConvWatchCancelException.java b/qadevOOo/runner/convwatch/ConvWatchCancelException.java
index ad37c2d..f360293 100644
--- a/qadevOOo/runner/convwatch/ConvWatchCancelException.java
+++ b/qadevOOo/runner/convwatch/ConvWatchCancelException.java
@@ -24,4 +24,9 @@ public class ConvWatchCancelException extends ConvWatchException
         {
             super(_aMessage);
         }
+
+    public ConvWatchCancelException(String _aMessage, Throwable cause)
+    {
+        super(_aMessage, cause);
+    }
 }
diff --git a/qadevOOo/runner/convwatch/ConvWatchException.java b/qadevOOo/runner/convwatch/ConvWatchException.java
index 28b1512..efd1e67 100644
--- a/qadevOOo/runner/convwatch/ConvWatchException.java
+++ b/qadevOOo/runner/convwatch/ConvWatchException.java
@@ -24,5 +24,10 @@ public class ConvWatchException extends Exception
         {
             super(_aMessage);
         }
+
+    public ConvWatchException(String _aMessage, Throwable cause)
+    {
+        super(_aMessage, cause);
+    }
 }
 
diff --git a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java
index 2d59022..f9d1e29 100644
--- a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java
+++ b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java
@@ -279,7 +279,7 @@ public class GraphicalDifferenceCheck
         catch (com.sun.star.io.IOException e)
         {
             // wrap IOException
-            throw new ConvWatchCancelException("Wrap IOException caught, " + e.getMessage());
+            throw new ConvWatchCancelException("Wrap IOException caught", e);
         }
 
         GlobalLogWriter.get().println("Saving XComponent as " + resultURL);
diff --git a/qadevOOo/runner/convwatch/MSOfficePrint.java b/qadevOOo/runner/convwatch/MSOfficePrint.java
index ba65b5b..9ed3b4b 100644
--- a/qadevOOo/runner/convwatch/MSOfficePrint.java
+++ b/qadevOOo/runner/convwatch/MSOfficePrint.java
@@ -251,7 +251,7 @@ public class MSOfficePrint
             }
             catch (IndexOutOfBoundsException e)
             {
-                throw new ConvWatchCancelException/*WrongEnvironmentException*/("Given list is too short.");
+                throw new ConvWatchCancelException/*WrongEnvironmentException*/("Given list is too short.", e);
             }
 
             // return aHandler.getExitCode();
diff --git a/qadevOOo/runner/convwatch/OfficePrint.java b/qadevOOo/runner/convwatch/OfficePrint.java
index cc7867d..4326200 100644
--- a/qadevOOo/runner/convwatch/OfficePrint.java
+++ b/qadevOOo/runner/convwatch/OfficePrint.java
@@ -767,14 +767,13 @@ public class OfficePrint {
                     }
                     catch(ConvWatchCancelException e)
                     {
-                        e.printStackTrace();
                         GlobalLogWriter.get().println(e.getMessage());
-                        throw new ConvWatchCancelException("Exception caught. Problem with MSOffice printer methods.");
+                        throw new ConvWatchCancelException("Exception caught. Problem with MSOffice printer methods.", e);
                     }
                     catch(java.io.IOException e)
                     {
                         GlobalLogWriter.get().println(e.getMessage());
-                        throw new ConvWatchCancelException("IOException caught. Problem with MSOffice printer methods.");
+                        throw new ConvWatchCancelException("IOException caught. Problem with MSOffice printer methods.", e);
                     }
                     bBack = true;
                 }
diff --git a/qadevOOo/runner/convwatch/ReportDesignerTest.java b/qadevOOo/runner/convwatch/ReportDesignerTest.java
index 6dd5001..204f8d9 100644
--- a/qadevOOo/runner/convwatch/ReportDesignerTest.java
+++ b/qadevOOo/runner/convwatch/ReportDesignerTest.java
@@ -285,7 +285,7 @@ public class ReportDesignerTest extends ComplexTestCase {
             catch (AssureException e)
             {
                 stopOffice();
-                throw new AssureException(e.getMessage());
+                throw new AssureException(e);
             }
 
             // ------------------------------ Office shutdown ------------------------------
diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java
index 6133094..a5c1667 100644
--- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java
+++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java
@@ -89,14 +89,13 @@ public class MSOfficePostscriptCreator implements IOffice
         }
         catch(OfficeException e)
         {
-            e.printStackTrace();
             GlobalLogWriter.println(e.getMessage());
-            throw new OfficeException("Exception caught. Problem with MSOffice printer methods.");
+            throw new OfficeException("Exception caught. Problem with MSOffice printer methods.", e);
         }
         catch(java.io.IOException e)
         {
             GlobalLogWriter.println(e.getMessage());
-            throw new OfficeException("IOException caught. Problem with MSOffice printer methods.");
+            throw new OfficeException("IOException caught. Problem with MSOffice printer methods.", e);
         }
     }
 
@@ -258,7 +257,7 @@ public class MSOfficePostscriptCreator implements IOffice
             }
             catch (IndexOutOfBoundsException e)
             {
-                throw new WrongEnvironmentException("Given list is too short.");
+                throw new WrongEnvironmentException("Given list is too short.", e);
             }
         }
 
diff --git a/qadevOOo/runner/graphical/OfficeException.java b/qadevOOo/runner/graphical/OfficeException.java
index 1241c1b..94c0d3a 100644
--- a/qadevOOo/runner/graphical/OfficeException.java
+++ b/qadevOOo/runner/graphical/OfficeException.java
@@ -28,4 +28,9 @@ public class OfficeException extends Exception
         {
             super(_aMessage);
         }
+
+    public OfficeException(String _aMessage, Throwable cause)
+    {
+        super(_aMessage, cause);
+    }
 }
diff --git a/qadevOOo/runner/graphical/WrongEnvironmentException.java b/qadevOOo/runner/graphical/WrongEnvironmentException.java
index 922ee8c..fe60de5 100644
--- a/qadevOOo/runner/graphical/WrongEnvironmentException.java
+++ b/qadevOOo/runner/graphical/WrongEnvironmentException.java
@@ -24,4 +24,8 @@ public class WrongEnvironmentException extends OfficeException
         {
             super(_aMessage);
         }
+    public WrongEnvironmentException(String _aMessage, Throwable cause)
+    {
+        super(_aMessage, cause);
+    }
 }
diff --git a/qadevOOo/runner/helper/ConfigHelper.java b/qadevOOo/runner/helper/ConfigHelper.java
index da873a5..cfa61a3 100644
--- a/qadevOOo/runner/helper/ConfigHelper.java
+++ b/qadevOOo/runner/helper/ConfigHelper.java
@@ -212,18 +212,18 @@ public class ConfigHelper
         xProp = UnoRuntime.queryInterface(
                                     XPropertySet.class,
                                     xSetCont.getByName(groupName));
-        } catch (com.sun.star.container.NoSuchElementException e){
-            throw new com.sun.star.uno.Exception(
+        } catch (com.sun.star.container.NoSuchElementException ex){
+            throw new com.sun.star.uno.Exception(ex,
                 "could not get group '" + groupName +
-               "' from set '"+ setName +"':\n" + e.toString());
+               "' from set '"+ setName +"'");
         }
         try{
             xProp.setPropertyValue(propName, propValue);
-        } catch (com.sun.star.uno.Exception e) {
-             throw new com.sun.star.uno.Exception(
+        } catch (com.sun.star.uno.Exception ex) {
+             throw new com.sun.star.uno.Exception(ex,
                 "could not set property '" + propName +
                 "' from group '"+ groupName +
-                "' from set '"+ setName +"':\n" + e.toString());
+                "' from set '"+ setName +"'");
         }
     }
 
@@ -255,28 +255,28 @@ public class ConfigHelper
             Object xGroup=xSetCont.getByName(group);
             xGroupAccess = UnoRuntime.queryInterface(
                             XNameReplace.class,xGroup);
-        } catch(com.sun.star.container.NoSuchElementException e) {
-             throw new com.sun.star.uno.Exception(
+        } catch(com.sun.star.container.NoSuchElementException ex) {
+             throw new com.sun.star.uno.Exception(ex,
                 "could not get group '" + group +
-                "' from set '"+ setName +"':\n" + e.toString());
+                "' from set '"+ setName +"'");
         }
 
         try {
             Object xGroup=xGroupAccess.getByName(extGroup);
             xExtGroupCont = UnoRuntime.queryInterface(
                             XNameContainer.class,xGroup);
-        } catch(com.sun.star.container.NoSuchElementException e) {
-             throw new com.sun.star.uno.Exception(
+        } catch(com.sun.star.container.NoSuchElementException ex) {
+             throw new com.sun.star.uno.Exception(ex,
                 "could not get extensilbe group '"+extGroup+
                 "' from group '"+ group +

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list