summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-15 16:17:25 +0200
committerNoel Grandin <noel@peralex.com>2014-09-25 13:47:25 +0200
commit83636d2c09802aeeb1b30078022d228d04da21eb (patch)
tree8a0c619e16c1f6b5388939d5da2956f7ef758c19 /scripting
parentcf49392511e98851174b353782df9eb6bac46f77 (diff)
java: when rethrowing exceptions, store the original cause
so that we get a nice complete stacktrace when it hits the final handler Change-Id: Iec4fcc15a2a25c55f591b5e069dce3d010197a90
Diffstat (limited to 'scripting')
-rw-r--r--scripting/java/com/sun/star/script/framework/container/Parcel.java10
-rw-r--r--scripting/java/com/sun/star/script/framework/container/ParcelContainer.java32
-rw-r--r--scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java11
-rw-r--r--scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java4
-rw-r--r--scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java15
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java20
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java11
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java11
8 files changed, 35 insertions, 79 deletions
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 ba269ac3e447..bf47b60e1800 100644
--- a/scripting/java/com/sun/star/script/framework/container/Parcel.java
+++ b/scripting/java/com/sun/star/script/framework/container/Parcel.java
@@ -16,16 +16,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.script.framework.container;
+
import com.sun.star.script.framework.log.*;
import com.sun.star.script.framework.io.*;
import com.sun.star.script.framework.provider.PathUtils;
-
import com.sun.star.container.*;
import com.sun.star.uno.Type;
import com.sun.star.uno.UnoRuntime;
-
import com.sun.star.ucb.XSimpleFileAccess;
import com.sun.star.ucb.XSimpleFileAccess2;
+
import java.io.*;
public class Parcel implements XNameContainer
@@ -82,7 +82,7 @@ public class Parcel implements XNameContainer
// catch unknown or un-checked exceptions
catch ( Exception e )
{
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
if ( thescript == null )
{
@@ -199,7 +199,7 @@ public class Parcel implements XNameContainer
catch ( Exception e )
{
LogUtils.DEBUG("Failed to insert entry " + aName + ": " + e.getMessage());
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
}
@@ -263,7 +263,7 @@ public class Parcel implements XNameContainer
catch ( Exception e )
{
LogUtils.DEBUG("** Parcel.removeByName Exception: " + e );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
}
diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java
index 7a3a20cdfd78..6e954af9b970 100644
--- a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java
+++ b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java
@@ -21,19 +21,19 @@ package com.sun.star.script.framework.container;
import com.sun.star.script.framework.log.*;
import com.sun.star.script.framework.io.*;
import com.sun.star.script.framework.provider.PathUtils;
-
import com.sun.star.container.*;
import com.sun.star.uno.Type;
import com.sun.star.lang.*;
import com.sun.star.io.*;
+
import java.io.*;
import java.util.*;
+
import com.sun.star.ucb.XSimpleFileAccess;
import com.sun.star.ucb.XSimpleFileAccess2;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.XComponentContext;
import com.sun.star.uno.UnoRuntime;
-
import com.sun.star.uri.XUriReference;
import com.sun.star.uri.XUriReferenceFactory;
import com.sun.star.uri.XVndSunStarScriptUrl;
@@ -316,7 +316,7 @@ public class ParcelContainer implements XNameAccess
}
catch ( Exception e)
{
- throw new WrappedTargetException( e.toString() );
+ throw new WrappedTargetException(e);
}
if ( parcel == null )
{
@@ -401,13 +401,13 @@ public class ParcelContainer implements XNameAccess
{
LogUtils.DEBUG("ParcelContainer.loadParcels caught exception processing folders for " + getParcelContainerDir() );
LogUtils.DEBUG("TRACE: " + LogUtils.getTrace(e) );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
catch ( com.sun.star.uno.Exception e )
{
LogUtils.DEBUG("ParcelContainer.loadParcels caught exception processing folders for " + getParcelContainerDir() );
LogUtils.DEBUG("TRACE: " + LogUtils.getTrace(e) );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
}
@@ -448,7 +448,7 @@ public class ParcelContainer implements XNameAccess
{
LogUtils.DEBUG("createParcel() Exception while attempting to create = " + name );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
return p;
}
@@ -505,18 +505,18 @@ public class ParcelContainer implements XNameAccess
{
LogUtils.DEBUG("loadParcel() Exception while accessing filesystem url = " + parcelDescUrl + e );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
catch ( java.io.IOException e )
{
LogUtils.DEBUG("ParcelContainer.loadParcel() caught IOException while accessing " + parcelDescUrl + ": " + e );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
catch ( com.sun.star.uno.Exception e )
{
LogUtils.DEBUG("loadParcel() Exception while accessing filesystem url = " + parcelDescUrl + e );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
finally
@@ -562,7 +562,7 @@ public class ParcelContainer implements XNameAccess
if (!m_xSFA.isFolder( oldParcelDirUrl ) )
{
Exception e = new com.sun.star.io.IOException("Invalid Parcel directory: " + oldName );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
LogUtils.DEBUG(" ** ParcelContainer Renaming folder " + oldParcelDirUrl + " to " + newParcelDirUrl );
m_xSFA.move( oldParcelDirUrl, newParcelDirUrl );
@@ -570,12 +570,12 @@ public class ParcelContainer implements XNameAccess
catch ( com.sun.star.ucb.CommandAbortedException ce )
{
LogUtils.DEBUG(" ** ParcelContainer Renaming failed with " + ce );
- throw new com.sun.star.lang.WrappedTargetException( ce.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(ce);
}
catch ( com.sun.star.uno.Exception e )
{
LogUtils.DEBUG(" ** ParcelContainer Renaming failed with " + e );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
p.rename( newName );
@@ -609,7 +609,7 @@ public class ParcelContainer implements XNameAccess
catch( Exception e )
{
LogUtils.DEBUG("Error deleteing parcel " + name );
- throw new com.sun.star.lang.WrappedTargetException( e.toString() );
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
return parcels.remove( p );
@@ -641,12 +641,12 @@ public ParsedScriptUri parseScriptUri( String scriptURI ) throws com.sun.star.l
catch( com.sun.star.uno.Exception e )
{
LogUtils.DEBUG("Problems parsing URL:" + e.toString() );
- throw new com.sun.star.lang.IllegalArgumentException( "Problems parsing URL reason: " + e.toString() );
+ throw new com.sun.star.lang.IllegalArgumentException(e, "Problems parsing URL");
}
if ( xFac == null )
{
LogUtils.DEBUG("Failed to create UrlReference factory");
- throw new com.sun.star.lang.IllegalArgumentException( "Failed to create UrlReference factory for url " + scriptURI );
+ throw new com.sun.star.lang.IllegalArgumentException( "Failed to create UrlReference factory for url " + scriptURI );
}
XUriReference uriRef = xFac.parse( scriptURI );
@@ -655,7 +655,7 @@ public ParsedScriptUri parseScriptUri( String scriptURI ) throws com.sun.star.l
if ( sfUri == null )
{
LogUtils.DEBUG("Failed to parse url");
- throw new com.sun.star.lang.IllegalArgumentException( "Failed to parse url " + scriptURI );
+ throw new com.sun.star.lang.IllegalArgumentException( "Failed to parse url " + scriptURI );
}
ParsedScriptUri parsedUri = new ParsedScriptUri();
diff --git a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
index d36bada434b0..be9dd42db9f1 100644
--- a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
+++ b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
@@ -28,12 +28,9 @@ import java.io.OutputStream;
import java.io.InputStream;
import com.sun.star.uno.XComponentContext;
-
import com.sun.star.uno.UnoRuntime;
-
import com.sun.star.io.XOutputStream;
import com.sun.star.io.XTruncate;
-
import com.sun.star.deployment.XPackage;
public class UnoPkgContainer extends ParcelContainer
@@ -226,7 +223,7 @@ public class UnoPkgContainer extends ParcelContainer
{
LogUtils.DEBUG("getUnoPackagesDB() caught Exception: " + e );
LogUtils.DEBUG( LogUtils.getTrace( e ) );
- throw new com.sun.star.lang.WrappedTargetException( e.toString());
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
finally
{
@@ -280,7 +277,7 @@ public class UnoPkgContainer extends ParcelContainer
catch( Exception e )
{
LogUtils.DEBUG("In writeUnoPackageDB() Exception: " + e );
- throw new com.sun.star.lang.WrappedTargetException( e.toString());
+ throw new com.sun.star.lang.WrappedTargetException(e);
}
finally
{
@@ -317,7 +314,7 @@ public class UnoPkgContainer extends ParcelContainer
}
catch (com.sun.star.deployment.ExtensionRemovedException e)
{
- throw new com.sun.star.lang.WrappedTargetException(e.toString(), this, e);
+ throw new com.sun.star.lang.WrappedTargetException(e.getMessage(), this, e);
}
processUnoPackage( uri, language );
@@ -331,7 +328,7 @@ public class UnoPkgContainer extends ParcelContainer
}
catch ( java.io.IOException ioe )
{
- throw new com.sun.star.lang.WrappedTargetException( ioe.toString());
+ throw new com.sun.star.lang.WrappedTargetException(ioe);
}
}
db.addPackage( language, uri );
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 075ab6641c88..d630e3f530c8 100644
--- a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
+++ b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
@@ -126,12 +126,12 @@ public class UCBStreamHandler extends URLStreamHandler {
catch ( com.sun.star.ucb.CommandAbortedException cae )
{
LogUtils.DEBUG("caught exception: " + cae.toString() + " getting writable stream from " + url );
- throw new IOException( cae.toString() );
+ throw new IOException(cae);
}
catch ( com.sun.star.uno.Exception e )
{
LogUtils.DEBUG("caught unknown exception: " + e.toString() + " getting writable stream from " + url );
- throw new IOException( e.toString() );
+ throw new IOException(e);
}
return os;
}
diff --git a/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java b/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java
index 2f48fcc371e0..801cb0d4be3a 100644
--- a/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java
+++ b/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java
@@ -18,9 +18,10 @@
package com.sun.star.script.framework.io;
-import com.sun.star.io.XInputStream;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
+
+import com.sun.star.io.XInputStream;
public class XInputStreamImpl implements XInputStream
{
@@ -47,11 +48,11 @@ public class XInputStreamImpl implements XInputStream
}
catch ( IOException e )
{
- throw new com.sun.star.io.IOException( e.toString() );
+ throw new com.sun.star.io.IOException(e);
}
catch ( IndexOutOfBoundsException aie )
{
- throw new com.sun.star.io.BufferSizeExceededException( aie.toString() );
+ throw new com.sun.star.io.BufferSizeExceededException(aie);
}
return totalBytesRead;
}
@@ -76,7 +77,7 @@ public class XInputStreamImpl implements XInputStream
}
catch ( IOException e )
{
- throw new com.sun.star.io.IOException( e.toString() );
+ throw new com.sun.star.io.IOException(e);
}
}
@@ -89,7 +90,7 @@ public class XInputStreamImpl implements XInputStream
}
catch ( IOException e )
{
- throw new com.sun.star.io.IOException( e.toString() );
+ throw new com.sun.star.io.IOException(e);
}
return bytesAvail;
}
@@ -102,7 +103,7 @@ public class XInputStreamImpl implements XInputStream
}
catch( IOException e )
{
- throw new com.sun.star.io.IOException( e.toString() );
+ throw new com.sun.star.io.IOException(e);
}
}
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java
index 137d1a21ca6f..46147272eb83 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java
@@ -50,26 +50,6 @@ public class InstallationPathDescriptor extends WizardDescriptor {
putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N
// Make the left pane show list of steps etc.:
putProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N
- // Number the steps.
- // putProperty("WizardPanel_contentNumbered", Boolean.TRUE); // NOI18N
- /*
- // Optional: make nonmodal.
- setModal(false);
- // (If you make the wizard nonmodal, you will call it differently;
- // see InstallationPathAction for instructions.)
- // Optional: show a help tab with special info about the pane:
- putProperty("WizardPanel_helpDisplayed", Boolean.TRUE); // NOI18N
- // Optional: set the size of the left pane explicitly:
- putProperty("WizardPanel_leftDimension", new Dimension(100, 400)); // NOI18N
- // Optional: if you want a special background image for the left pane:
- try {
- putProperty("WizardPanel_image", // NOI18N
- Toolkit.getDefaultToolkit().getImage
- (new URL("nbresloc:/org/openoffice/netbeans/modules/office/wizard/InstallationPathImage.gif"))); // NOI18N
- } catch (MalformedURLException mfue) {
- throw new IllegalStateException(mfue.toString());
- }
- */
}
// Called when user moves forward or backward etc.:
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java
index f9f529e9763d..bdb25bd02fb3 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java
@@ -40,17 +40,6 @@ public class ParcelPropertiesVisualPanel extends javax.swing.JPanel {
// Provide a name in the title bar.
setName(NbBundle.getMessage(ParcelPropertiesVisualPanel.class, "TITLE_ParcelPropertiesVisualPanel"));
- /*
- // Optional: provide a special description for this pane.
- // You must have turned on WizardDescriptor.WizardPanel_helpDisplayed
- // (see descriptor in standard iterator template for an example of this).
- try {
- putClientProperty("WizardPanel_helpURL", // NOI18N
- new URL("nbresloc:/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualHelp.html")); // NOI18N
- } catch (MalformedURLException mfue) {
- throw new IllegalStateException(mfue.toString());
- }
- */
}
/** This method is called from within the constructor to
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java
index 9351760c77a0..3853944e72fe 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java
@@ -72,17 +72,6 @@ public class SelectPathVisualPanel extends javax.swing.JPanel {
// Provide a name in the title bar.
setName(NbBundle.getMessage(SelectPathVisualPanel.class, "TITLE_SelectPathVisualPanel"));
- /*
- // Optional: provide a special description for this pane.
- // You must have turned on WizardDescriptor.WizardPanel_helpDisplayed
- // (see descriptor in standard iterator template for an example of this).
- try {
- putClientProperty("WizardPanel_helpURL", // NOI18N
- new URL("nbresloc:/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualHelp.html")); // NOI18N
- } catch (MalformedURLException mfue) {
- throw new IllegalStateException(mfue.toString());
- }
- */
}
private void installationsComboBoxActionPerformed(