[Libreoffice-commits] core.git: bean/com bridges/test codemaker/source framework/qa javaunohelper/com jurt/com qadevOOo/runner qadevOOo/tests ridljar/com scripting/java xmerge/source xmlsecurity/test_docs
Noel Grandin
noel at peralex.com
Thu Sep 25 04:48:18 PDT 2014
bean/com/sun/star/beans/LocalOfficeConnection.java | 2
bean/com/sun/star/comp/beans/LocalOfficeConnection.java | 2
bridges/test/java_uno/nativethreadpool/Relay.java | 8
codemaker/source/javamaker/javatype.cxx | 137 +++
framework/qa/complex/framework/recovery/RecoveryTools.java | 16
javaunohelper/com/sun/star/comp/helper/Bootstrap.java | 2
javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java | 14
javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java | 8
javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java | 16
javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java | 12
javaunohelper/com/sun/star/lib/uno/helper/Factory.java | 7
javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java | 2
jurt/com/sun/star/comp/connections/PipedConnection.java | 7
jurt/com/sun/star/comp/loader/FactoryHelper.java | 14
jurt/com/sun/star/comp/servicemanager/ServiceManager.java | 2
jurt/com/sun/star/lib/connections/socket/socketAcceptor.java | 7
jurt/com/sun/star/lib/connections/socket/socketConnector.java | 9
jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java | 4
jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java | 6
jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java | 352 ++++------
jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java | 279 +++----
jurt/com/sun/star/lib/uno/protocols/urp/urp.java | 2
qadevOOo/runner/lib/StatusException.java | 8
qadevOOo/runner/util/UITools.java | 2
qadevOOo/runner/util/utils.java | 4
qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java | 2
qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java | 2
qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java | 2
qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java | 2
ridljar/com/sun/star/uno/Type.java | 2
ridljar/com/sun/star/uno/UnoRuntime.java | 8
scripting/java/com/sun/star/script/framework/container/Parcel.java | 10
scripting/java/com/sun/star/script/framework/container/ParcelContainer.java | 32
scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java | 11
scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java | 4
scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java | 15
scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java | 20
scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java | 11
scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java | 11
xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java | 11
xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java | 7
xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java | 4
42 files changed, 556 insertions(+), 520 deletions(-)
New commits:
commit 83636d2c09802aeeb1b30078022d228d04da21eb
Author: Noel Grandin <noel at peralex.com>
Date: Fri Aug 15 16:17:25 2014 +0200
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
diff --git a/bean/com/sun/star/beans/LocalOfficeConnection.java b/bean/com/sun/star/beans/LocalOfficeConnection.java
index b091d54..a47650d 100644
--- a/bean/com/sun/star/beans/LocalOfficeConnection.java
+++ b/bean/com/sun/star/beans/LocalOfficeConnection.java
@@ -311,7 +311,7 @@ public class LocalOfficeConnection
System.out.println( e );
e.printStackTrace();
System.out.println( "--- end." );
- throw new com.sun.star.uno.RuntimeException( e.toString() );
+ throw new com.sun.star.uno.RuntimeException(e);
}
return null;
diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
index 7f1a95a..ac260fe 100644
--- a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
+++ b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
@@ -379,7 +379,7 @@ public class LocalOfficeConnection
System.out.println( e );
e.printStackTrace();
System.out.println( "--- end." );
- throw new com.sun.star.uno.RuntimeException( e.toString() );
+ throw new com.sun.star.uno.RuntimeException(e);
}
return null;
diff --git a/bridges/test/java_uno/nativethreadpool/Relay.java b/bridges/test/java_uno/nativethreadpool/Relay.java
index 8e371b2..c5322b6 100644
--- a/bridges/test/java_uno/nativethreadpool/Relay.java
+++ b/bridges/test/java_uno/nativethreadpool/Relay.java
@@ -43,9 +43,9 @@ public final class Relay implements XRelay, XSource {
} catch (RuntimeException e) {
throw e;
} catch (com.sun.star.uno.Exception e) {
- throw new WrappedTargetRuntimeException(e.toString(), this, e);
+ throw new WrappedTargetRuntimeException(e.getMessage(), this, e);
} catch (Exception e) {
- throw new com.sun.star.uno.RuntimeException(e.toString(), this);
+ throw new com.sun.star.uno.RuntimeException(e, this);
}
final XAcceptor acceptor = Acceptor.create(context);
final XBridgeFactory factory;
@@ -55,7 +55,7 @@ public final class Relay implements XRelay, XSource {
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
} catch (com.sun.star.uno.Exception e) {
- throw new WrappedTargetRuntimeException(e.toString(), this, e);
+ throw new WrappedTargetRuntimeException(e.getMessage(), this, e);
}
new Thread() {
@Override
@@ -85,7 +85,7 @@ public final class Relay implements XRelay, XSource {
Thread.sleep(3000); // wait for new thread to accept connection
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- throw new com.sun.star.uno.RuntimeException(e.toString(), this);
+ throw new com.sun.star.uno.RuntimeException(e, this);
}
}
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index 9e08171..5d02644 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -1672,6 +1672,8 @@ void handleExceptionType(
i->name, index++);
}
}
+
+ // create default constructor
SAL_WNODEPRECATED_DECLARATIONS_PUSH
std::auto_ptr< ClassFile::Code > code(cf->newCode());
SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -1702,6 +1704,78 @@ void handleExceptionType(
cf->addMethod(
ClassFile::ACC_PUBLIC, "<init>", "()V", code.get(),
std::vector< OString >(), "");
+
+
+ // create (Throwable Cause) constructor
+ code.reset(cf->newCode());
+ code->loadLocalReference(0);
+ code->loadLocalReference(1);
+ code->instrInvokespecial(superClass, "<init>", "(Ljava/lang/Throwable;)V");
+ stack = 0;
+ if (baseRuntimeException) {
+ stack = std::max(
+ stack,
+ addFieldInit(
+ manager, className, "Context", false,
+ "com.sun.star.uno.XInterface", dependencies, code.get()));
+ }
+ for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
+ entity->getDirectMembers().begin());
+ i != entity->getDirectMembers().end(); ++i)
+ {
+ if (!baseException || i != entity->getDirectMembers().begin()) {
+ stack = std::max(
+ stack,
+ addFieldInit(
+ manager, className, i->name, false, i->type, dependencies,
+ code.get()));
+ }
+ }
+ code->instrReturn();
+ code->setMaxStackAndLocals(stack + 2, 2);
+ cf->addMethod(
+ ClassFile::ACC_PUBLIC, "<init>", "(Ljava/lang/Throwable;)V", code.get(),
+ std::vector< OString >(), "");
+
+ // create (Throwable Cause, String Message) constructor
+ code.reset(cf->newCode());
+ code->loadLocalReference(0);
+ if (baseException || baseRuntimeException) {
+ code->loadLocalReference(2);
+ code->loadLocalReference(1);
+ code->instrInvokespecial(superClass, "<init>", "(Ljava/lang/String;Ljava/lang/Throwable;)V");
+ } else {
+ code->loadLocalReference(1);
+ code->loadLocalReference(2);
+ code->instrInvokespecial(superClass, "<init>", "(Ljava/lang/Throwable;Ljava/lang/String;)V");
+ }
+ stack = 0;
+ if (baseRuntimeException) {
+ stack = std::max(
+ stack,
+ addFieldInit(
+ manager, className, "Context", false,
+ "com.sun.star.uno.XInterface", dependencies, code.get()));
+ }
+ for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
+ entity->getDirectMembers().begin());
+ i != entity->getDirectMembers().end(); ++i)
+ {
+ if (!baseException || i != entity->getDirectMembers().begin()) {
+ stack = std::max(
+ stack,
+ addFieldInit(
+ manager, className, i->name, false, i->type, dependencies,
+ code.get()));
+ }
+ }
+ code->instrReturn();
+ code->setMaxStackAndLocals(stack + 3, 3);
+ cf->addMethod(
+ ClassFile::ACC_PUBLIC, "<init>", "(Ljava/lang/Throwable;Ljava/lang/String;)V", code.get(),
+ std::vector< OString >(), "");
+
+ // create (String Message) constructor
code.reset(cf->newCode());
code->loadLocalReference(0);
code->loadLocalReference(1);
@@ -1731,24 +1805,27 @@ void handleExceptionType(
cf->addMethod(
ClassFile::ACC_PUBLIC, "<init>", "(Ljava/lang/String;)V", code.get(),
std::vector< OString >(), "");
- MethodDescriptor desc(manager, dependencies, "void", 0, 0);
+
+
+ // create (String Message, Object Context, T1 m1, ..., Tn mn) constructor
+ MethodDescriptor desc1(manager, dependencies, "void", 0, 0);
code.reset(cf->newCode());
code->loadLocalReference(0);
sal_uInt16 index2 = 1;
- desc.addParameter("string", false, true, 0);
code->loadLocalReference(index2++);
+ desc1.addParameter("string", false, true, 0);
if (!(baseException || baseRuntimeException)) {
addExceptionBaseArguments(
- manager, dependencies, &desc, code.get(), entity->getDirectBase(),
+ manager, dependencies, &desc1, code.get(), entity->getDirectBase(),
&index2);
}
- code->instrInvokespecial(superClass, "<init>", desc.getDescriptor());
+ code->instrInvokespecial(superClass, "<init>", desc1.getDescriptor());
sal_uInt16 maxSize = index2;
if (baseRuntimeException) {
maxSize = std::max(
maxSize,
addDirectArgument(
- manager, dependencies, &desc, code.get(), &index2, className,
+ manager, dependencies, &desc1, code.get(), &index2, className,
"Context", false, "com.sun.star.uno.XInterface"));
}
for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
@@ -1759,7 +1836,7 @@ void handleExceptionType(
maxSize = std::max(
maxSize,
addDirectArgument(
- manager, dependencies, &desc, code.get(), &index2,
+ manager, dependencies, &desc1, code.get(), &index2,
className, codemaker::convertString(i->name), false,
i->type));
}
@@ -1767,8 +1844,52 @@ void handleExceptionType(
code->instrReturn();
code->setMaxStackAndLocals(maxSize, index2);
cf->addMethod(
- ClassFile::ACC_PUBLIC, "<init>", desc.getDescriptor(), code.get(),
- std::vector< OString >(), desc.getSignature());
+ ClassFile::ACC_PUBLIC, "<init>", desc1.getDescriptor(), code.get(),
+ std::vector< OString >(), desc1.getSignature());
+
+ // create (Throwable Cause, String Message, Object Context, T1 m1, ..., Tn mn) constructor
+ MethodDescriptor desc2(manager, dependencies, "void", 0, 0);
+ code.reset(cf->newCode());
+ code->loadLocalReference(0);
+ sal_uInt16 index3 = 1;
+ code->loadLocalReference(index3++);
+ code->loadLocalReference(index3++);
+ // Note that we hack in the java.lang.Throwable parameter further down,
+ // because MethodDescriptor does not know how to handle it.
+ desc2.addParameter("string", false, true, 0);
+ if (!(baseException || baseRuntimeException)) {
+ addExceptionBaseArguments(
+ manager, dependencies, &desc2, code.get(), entity->getDirectBase(),
+ &index3);
+ }
+ code->instrInvokespecial(superClass, "<init>", "(Ljava/lang/Throwable;" + desc2.getDescriptor().copy(1));
+ sal_uInt16 maxSize2 = index3;
+ if (baseRuntimeException) {
+ maxSize2 = std::max(
+ maxSize2,
+ addDirectArgument(
+ manager, dependencies, &desc2, code.get(), &index3, className,
+ "Context", false, "com.sun.star.uno.XInterface"));
+ }
+ for (std::vector< unoidl::ExceptionTypeEntity::Member >::const_iterator i(
+ entity->getDirectMembers().begin());
+ i != entity->getDirectMembers().end(); ++i)
+ {
+ if (!baseException || i != entity->getDirectMembers().begin()) {
+ maxSize2 = std::max(
+ maxSize2,
+ addDirectArgument(
+ manager, dependencies, &desc2, code.get(), &index3,
+ className, codemaker::convertString(i->name), false,
+ i->type));
+ }
+ }
+ code->instrReturn();
+ code->setMaxStackAndLocals(maxSize2, index3);
+ cf->addMethod(
+ ClassFile::ACC_PUBLIC, "<init>", "(Ljava/lang/Throwable;" + desc2.getDescriptor().copy(1), code.get(),
+ std::vector< OString >(), desc2.getSignature());
+
addTypeInfo(className, typeInfo, dependencies, cf.get());
writeClassFile(options, className, *cf.get());
}
diff --git a/framework/qa/complex/framework/recovery/RecoveryTools.java b/framework/qa/complex/framework/recovery/RecoveryTools.java
index 080d84c..8a2b034 100644
--- a/framework/qa/complex/framework/recovery/RecoveryTools.java
+++ b/framework/qa/complex/framework/recovery/RecoveryTools.java
@@ -24,11 +24,14 @@ import com.sun.star.awt.XWindow;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+
import helper.FileTools;
import helper.UnoProvider;
+
import java.io.File;
import java.io.PrintWriter;
import java.util.HashMap;
+
import lib.TestParameters;
import share.LogWriter;
import util.PropertyName;
@@ -155,7 +158,7 @@ public class RecoveryTools {
}
} catch (Exception e){
- throw new com.sun.star.io.IOException("could not remove old recovery data: " + e.toString());
+ throw new com.sun.star.io.IOException("could not remove old recovery data", e);
}
}
@@ -186,7 +189,7 @@ public class RecoveryTools {
return recFiles;
} catch (Exception e){
- throw new com.sun.star.io.IOException("could not get recovery folder: " + e.toString());
+ throw new com.sun.star.io.IOException("could not get recovery folder", e);
}
}
@@ -265,7 +268,7 @@ public class RecoveryTools {
log.println("click ' " + buttonName + "' button..");
oUITools.clickButton(buttonName);
} catch ( java.lang.Exception e){
- throw new com.sun.star.accessibility.IllegalAccessibleComponentStateException("Could not click '"+buttonName +"' at modal dialog: " + e.toString());
+ throw new com.sun.star.accessibility.IllegalAccessibleComponentStateException("Could not click '"+buttonName +"' at modal dialog", e);
}
pause();
}
@@ -285,7 +288,7 @@ public class RecoveryTools {
try{
recFiles = getRecoveryFiles();
} catch ( com.sun.star.io.IOException e){
- throw new com.sun.star.io.IOException("Could not get recovery files: " + e.toString());
+ throw new com.sun.star.io.IOException("Could not get recovery files", e);
}
try{
@@ -307,7 +310,10 @@ public class RecoveryTools {
}
} catch (java.io.IOException e){
- throw new java.io.IOException("Could not copy recovery files: " + e.toString());
+ // the new constructor that takes a Throwable is only available in Java1.6
+ java.io.IOException newEx = new java.io.IOException("Could not copy recovery files");
+ newEx.initCause(e);
+ throw newEx;
}
}
diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
index 80daf4b..2501b57 100644
--- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
+++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
@@ -312,7 +312,7 @@ public class Bootstrap {
// Wait 500 ms, then try to connect again, but do not wait
// longer than 5 min (= 600 * 500 ms) total:
if (i == 600) {
- throw new BootstrapException(ex.toString());
+ throw new BootstrapException(ex);
}
Thread.sleep( 500 );
}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
index b802520..1fa4286 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
@@ -18,7 +18,9 @@
package com.sun.star.lib.uno.adapter;
import java.io.IOException;
+
import com.sun.star.io.XInputStream;
+
import java.io.InputStream;
/** The <code>InputStreamToInputXStreamAdapter</code> wraps the
@@ -54,7 +56,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
try {
bytesAvail = iIn.available();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
return(bytesAvail);
@@ -66,7 +68,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
try {
iIn.close();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
}
@@ -92,7 +94,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
} catch (IOException e) {
- throw new com.sun.star.io.IOException("reader error: "+e.toString());
+ throw new com.sun.star.io.IOException("reader error", e);
}
}
@@ -118,7 +120,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
} catch (IOException e) {
- throw new com.sun.star.io.IOException("reader error: "+e.toString());
+ throw new com.sun.star.io.IOException("reader error", e);
}
}
@@ -131,7 +133,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
try {
iIn.available();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
do {
@@ -146,7 +148,7 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream {
try {
iIn.skip(tmpIntVal);
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
} while (tmpLongVal > 0);
}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java
index 954888c..087a4a5 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter.java
@@ -19,7 +19,9 @@
package com.sun.star.lib.uno.adapter;
import java.io.IOException;
+
import com.sun.star.io.XOutputStream;
+
import java.io.OutputStream;
/** The <code>OutputStreamToXOutputStreamAdapter</code> wraps
@@ -50,7 +52,7 @@ public final class OutputStreamToXOutputStreamAdapter implements XOutputStream {
try {
iOut.close();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
}
@@ -60,7 +62,7 @@ public final class OutputStreamToXOutputStreamAdapter implements XOutputStream {
try {
iOut.flush();
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
}
@@ -71,7 +73,7 @@ public final class OutputStreamToXOutputStreamAdapter implements XOutputStream {
try {
iOut.write(b);
} catch (IOException e) {
- throw new com.sun.star.io.IOException(e.toString());
+ throw new com.sun.star.io.IOException(e);
}
}
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
index 2d9652e..8352a0b 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
@@ -18,7 +18,9 @@
package com.sun.star.lib.uno.adapter;
import java.io.IOException;
+
import com.sun.star.io.XInputStream;
+
import java.io.InputStream;
/**
@@ -53,7 +55,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
try {
bytesAvail = xin.available();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
return(bytesAvail);
@@ -64,7 +66,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
try {
xin.closeInput();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -85,7 +87,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
}
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -105,7 +107,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
System.arraycopy(tmp[0], 0, b, 0, b.length);
}
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
return (bytesRead);
@@ -139,7 +141,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
} catch (Exception e) {
- throw new IOException("reader error: "+e.toString());
+ throw new IOException(e);
}
}
@@ -153,7 +155,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
try {
avail = xin.available();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
do {
@@ -168,7 +170,7 @@ public final class XInputStreamToInputStreamAdapter extends InputStream {
try {
xin.skipBytes(tmpIntVal);
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
} while (tmpLongVal > 0);
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java
index 478dfc4..7608521 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToOutputStreamAdapter.java
@@ -19,7 +19,9 @@
package com.sun.star.lib.uno.adapter;
import java.io.IOException;
+
import com.sun.star.io.XOutputStream;
+
import java.io.OutputStream;
/**
@@ -51,7 +53,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.closeOutput();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -60,7 +62,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.flush();
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -70,7 +72,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.writeBytes(b);
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -86,7 +88,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.writeBytes(tmp);
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
@@ -99,7 +101,7 @@ public final class XOutputStreamToOutputStreamAdapter extends OutputStream {
try {
xout.writeBytes(oneByte);
} catch (Exception e) {
- throw new IOException(e.toString());
+ throw new IOException(e);
}
}
}
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
index 19f6fc0..ca0bf84 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
@@ -22,7 +22,6 @@ import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XInitialization;
import com.sun.star.registry.XRegistryKey;
-
import com.sun.star.uno.UnoRuntime;
@@ -198,15 +197,15 @@ public class Factory
else if (targetException instanceof com.sun.star.uno.Exception)
throw (com.sun.star.uno.Exception)targetException;
else
- throw new com.sun.star.uno.Exception( targetException.toString(), this );
+ throw new com.sun.star.uno.Exception(targetException, targetException.getMessage(), this);
}
catch (IllegalAccessException exc)
{
- throw new com.sun.star.uno.RuntimeException( exc.toString(), this );
+ throw new com.sun.star.uno.RuntimeException( exc, exc.getMessage(), this);
}
catch (InstantiationException exc)
{
- throw new com.sun.star.uno.RuntimeException( exc.toString(), this );
+ throw new com.sun.star.uno.RuntimeException( exc, exc.getMessage(), this);
}
}
// XSingleComponentFactory impl
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
index 5766792..23ab802 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
@@ -220,7 +220,7 @@ public class UnoUrl {
try {
ch = Integer.parseInt(s.substring(i+1,i+3),16);
} catch (NumberFormatException e) {
- throw new com.sun.star.lang.IllegalArgumentException(e.toString());
+ throw new com.sun.star.lang.IllegalArgumentException(e);
}
if (ch < 0)
throw new com.sun.star.lang.IllegalArgumentException(
diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java
index d48b2a6..8cae64d 100644
--- a/jurt/com/sun/star/comp/connections/PipedConnection.java
+++ b/jurt/com/sun/star/comp/connections/PipedConnection.java
@@ -20,12 +20,9 @@ package com.sun.star.comp.connections;
import com.sun.star.comp.loader.FactoryHelper;
-
import com.sun.star.connection.XConnection;
-
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
-
import com.sun.star.registry.XRegistryKey;
/**
@@ -121,7 +118,7 @@ public class PipedConnection implements XConnection {
wait(__waitTime);
}
catch(InterruptedException interruptedException) {
- throw new com.sun.star.io.IOException(interruptedException.toString());
+ throw new com.sun.star.io.IOException(interruptedException);
}
}
@@ -175,7 +172,7 @@ public class PipedConnection implements XConnection {
wait(__waitTime); // we wait for data or for the pipe to be closed
}
catch(InterruptedException interruptedException) {
- throw new com.sun.star.io.IOException(interruptedException.toString());
+ throw new com.sun.star.io.IOException(interruptedException);
}
}
diff --git a/jurt/com/sun/star/comp/loader/FactoryHelper.java b/jurt/com/sun/star/comp/loader/FactoryHelper.java
index 92b4801..3fdbac4 100644
--- a/jurt/com/sun/star/comp/loader/FactoryHelper.java
+++ b/jurt/com/sun/star/comp/loader/FactoryHelper.java
@@ -29,9 +29,7 @@ import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.lang.XTypeProvider;
-
import com.sun.star.registry.XRegistryKey;
-
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.Type;
@@ -207,11 +205,11 @@ public class FactoryHelper {
else if (targetException instanceof com.sun.star.uno.RuntimeException)
throw (com.sun.star.uno.RuntimeException)targetException;
else
- throw new com.sun.star.uno.Exception( targetException.toString() );
+ throw new com.sun.star.uno.Exception( targetException );
} catch (IllegalAccessException illegalAccessException) {
- throw new com.sun.star.uno.Exception( illegalAccessException.toString() );
+ throw new com.sun.star.uno.Exception( illegalAccessException );
} catch (InstantiationException instantiationException) {
- throw new com.sun.star.uno.Exception( instantiationException.toString() );
+ throw new com.sun.star.uno.Exception( instantiationException );
}
}
@@ -283,11 +281,11 @@ public class FactoryHelper {
else if (targetException instanceof com.sun.star.uno.RuntimeException)
throw (com.sun.star.uno.RuntimeException)targetException;
else
- throw new com.sun.star.uno.Exception( targetException.toString() );
+ throw new com.sun.star.uno.Exception( targetException );
} catch (IllegalAccessException illegalAccessException) {
- throw new com.sun.star.uno.Exception( illegalAccessException.toString() );
+ throw new com.sun.star.uno.Exception( illegalAccessException );
} catch (InstantiationException instantiationException) {
- throw new com.sun.star.uno.Exception( instantiationException.toString() );
+ throw new com.sun.star.uno.Exception( instantiationException );
}
}
diff --git a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
index 38e5cb3..729fda5 100644
--- a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
+++ b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
@@ -192,7 +192,7 @@ public class ServiceManager implements XMultiServiceFactory,
return factoriesByServiceNames.keySet().toArray(
new String[ factoriesByServiceNames.size() ] );
} catch(Exception ex) {
- throw new com.sun.star.uno.RuntimeException(ex.toString());
+ throw new com.sun.star.uno.RuntimeException(ex);
}
}
diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
index 4902d52..e3dbea7 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
@@ -26,6 +26,7 @@ import com.sun.star.connection.XConnection;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;
+
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
@@ -133,7 +134,7 @@ public final class socketAcceptor implements XAcceptor {
host == null ? null
: InetAddress.getByName(host));
} catch (IOException e) {
- throw new ConnectionSetupException(e.toString());
+ throw new ConnectionSetupException(e);
}
acceptingDescription = connectionDescription;
tcpNoDelay = desc.getTcpNoDelay();
@@ -157,7 +158,7 @@ public final class socketAcceptor implements XAcceptor {
return new SocketConnection(acceptingDescription, socket);
}
catch(IOException e) {
- throw new ConnectionSetupException(e.toString());
+ throw new ConnectionSetupException(e);
}
}
@@ -174,7 +175,7 @@ public final class socketAcceptor implements XAcceptor {
serv.close();
}
catch (IOException e) {
- throw new com.sun.star.uno.RuntimeException(e.toString());
+ throw new com.sun.star.uno.RuntimeException(e);
}
}
diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
index ce76eaa..a0c4937 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
@@ -26,6 +26,7 @@ import com.sun.star.connection.XConnector;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;
+
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
@@ -113,7 +114,7 @@ public final class socketConnector implements XConnector {
try {
desc = new ConnectionDescriptor(connectionDescription);
} catch (com.sun.star.lang.IllegalArgumentException e) {
- throw new ConnectionSetupException(e.toString());
+ throw new ConnectionSetupException(e);
}
if (desc.getHost() == null)
@@ -127,7 +128,7 @@ public final class socketConnector implements XConnector {
try {
adr = InetAddress.getAllByName(desc.getHost());
} catch (UnknownHostException e) {
- throw new ConnectionSetupException(e.toString());
+ throw new ConnectionSetupException(e);
}
Socket socket = null;
for (int i = 0; i < adr.length; ++i) {
@@ -136,7 +137,7 @@ public final class socketConnector implements XConnector {
break;
} catch (IOException e) {
if (i == adr.length - 1)
- throw new NoConnectException(e.toString());
+ throw new NoConnectException(e);
}
}
XConnection con;
@@ -146,7 +147,7 @@ public final class socketConnector implements XConnector {
con = new SocketConnection(connectionDescription, socket);
} catch (IOException e) {
- throw new NoConnectException(e.toString());
+ throw new NoConnectException(e);
}
connected = true;
return con;
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java
index 87b3ea1..48fea08 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java
@@ -46,7 +46,7 @@ class XConnectionInputStream_Adapter extends InputStream {
try {
len = _xConnection.read(_bytes, 1);
} catch(com.sun.star.io.IOException ioException) {
- throw new IOException(ioException.toString());
+ throw new IOException(ioException);
}
if(DEBUG) System.err.println("#### " + getClass().getName() + " - one byte read:" + _bytes[0][0]);
@@ -61,7 +61,7 @@ class XConnectionInputStream_Adapter extends InputStream {
try {
len = _xConnection.read(_bytes, len - off);
} catch(com.sun.star.io.IOException ioException) {
- throw new IOException(ioException.toString());
+ throw new IOException(ioException);
}
System.arraycopy(_bytes[0], 0, b, off, len);
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java
index 3730722..954afe8 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java
@@ -44,7 +44,7 @@ class XConnectionOutputStream_Adapter extends OutputStream {
try {
_xConnection.write(_bytes);
} catch(com.sun.star.io.IOException ioException) {
- throw new IOException(ioException.toString());
+ throw new IOException(ioException);
}
if(DEBUG) System.err.println("#### " + this.getClass() + " - one byte written:" + _bytes[0]);
@@ -65,7 +65,7 @@ class XConnectionOutputStream_Adapter extends OutputStream {
try {
_xConnection.write(bytes);
} catch(com.sun.star.io.IOException ioException) {
- throw new IOException(ioException.toString());
+ throw new IOException(ioException);
}
}
@@ -74,7 +74,7 @@ class XConnectionOutputStream_Adapter extends OutputStream {
try {
_xConnection.flush();
} catch(com.sun.star.io.IOException ioException) {
- throw new IOException(ioException.toString());
+ throw new IOException(ioException);
}
}
}
diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java
index 55c36cd..8a42b4a 100644
--- a/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java
+++ b/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java
@@ -26,6 +26,7 @@ import com.sun.star.uno.IFieldDescription;
import com.sun.star.uno.Type;
import com.sun.star.uno.TypeClass;
import com.sun.star.uno.XInterface;
+
import java.io.ByteArrayOutputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
@@ -46,7 +47,7 @@ final class Marshal {
try {
output.writeByte(value);
} catch (IOException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
@@ -54,19 +55,23 @@ final class Marshal {
try {
output.writeShort(value);
} catch (IOException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
public void writeObjectId(String objectId) {
- if (objectId == null) {
- writeStringValue(null);
- write16Bit(0xFFFF);
- } else {
- boolean[] found = new boolean[1];
- int index = objectIdCache.add(found, objectId);
- writeStringValue(found[0] ? null : objectId);
- write16Bit(index);
+ try {
+ if (objectId == null) {
+ writeStringValue(null);
+ write16Bit(0xFFFF);
+ } else {
+ boolean[] found = new boolean[1];
+ int index = objectIdCache.add(found, objectId);
+ writeStringValue(found[0] ? null : objectId);
+ write16Bit(index);
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
@@ -75,107 +80,127 @@ final class Marshal {
}
public void writeThreadId(ThreadId threadId) {
- byte[] data = threadId.getBytes();
- boolean[] found = new boolean[1];
- int index = threadIdCache.add(found, data);
- if (found[0]) {
- writeCompressedNumber(0);
- } else {
- writeCompressedNumber(data.length);
- writeBytes(data);
+ try {
+ byte[] data = threadId.getBytes();
+ boolean[] found = new boolean[1];
+ int index = threadIdCache.add(found, data);
+ if (found[0]) {
+ writeCompressedNumber(0);
+ } else {
+ writeCompressedNumber(data.length);
+ writeBytes(data);
+ }
+ write16Bit(index);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
- write16Bit(index);
}
public void writeType(TypeDescription type) {
- TypeClass typeClass = type.getTypeClass();
- if (TypeDescription.isTypeClassSimple(typeClass)) {
- write8Bit(typeClass.getValue());
- } else {
- boolean[] found = new boolean[1];
- int index = typeCache.add(found, type.getTypeName());
- write8Bit(typeClass.getValue() | (found[0] ? 0 : 0x80));
- write16Bit(index);
- if (!found[0]) {
- writeStringValue(type.getTypeName());
+ try {
+ TypeClass typeClass = type.getTypeClass();
+ if (TypeDescription.isTypeClassSimple(typeClass)) {
+ write8Bit(typeClass.getValue());
+ } else {
+ boolean[] found = new boolean[1];
+ int index = typeCache.add(found, type.getTypeName());
+ write8Bit(typeClass.getValue() | (found[0] ? 0 : 0x80));
+ write16Bit(index);
+ if (!found[0]) {
+ writeStringValue(type.getTypeName());
+ }
}
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
public void writeValue(TypeDescription type, Object value) {
- switch(type.getTypeClass().getValue()) {
- case TypeClass.VOID_value:
- break;
-
- case TypeClass.BOOLEAN_value:
- writeBooleanValue((Boolean) value);
- break;
-
- case TypeClass.BYTE_value:
- writeByteValue((Byte) value);
- break;
-
- case TypeClass.SHORT_value:
- case TypeClass.UNSIGNED_SHORT_value:
- writeShortValue((Short) value);
- break;
-
- case TypeClass.LONG_value:
- case TypeClass.UNSIGNED_LONG_value:
- writeLongValue((Integer) value);
- break;
-
- case TypeClass.HYPER_value:
- case TypeClass.UNSIGNED_HYPER_value:
- writeHyperValue((Long) value);
- break;
-
- case TypeClass.FLOAT_value:
- writeFloatValue((Float) value);
- break;
-
- case TypeClass.DOUBLE_value:
- writeDoubleValue((Double) value);
- break;
-
- case TypeClass.CHAR_value:
- writeCharValue((Character) value);
- break;
-
- case TypeClass.STRING_value:
- writeStringValue((String) value);
- break;
-
- case TypeClass.TYPE_value:
- writeTypeValue((Type) value);
- break;
-
- case TypeClass.ANY_value:
- writeAnyValue(value);
- break;
-
- case TypeClass.SEQUENCE_value:
- writeSequenceValue(type, value);
- break;
-
- case TypeClass.ENUM_value:
- writeEnumValue(type, (Enum) value);
- break;
-
- case TypeClass.STRUCT_value:
- writeStructValue(type, value);
- break;
-
- case TypeClass.EXCEPTION_value:
- writeExceptionValue(type, (Exception) value);
- break;
-
- case TypeClass.INTERFACE_value:
- writeInterfaceValue(type, (XInterface) value);
- break;
-
- default:
- throw new IllegalArgumentException("Bad type descriptor " + type);
+ try {
+ switch(type.getTypeClass().getValue()) {
+ case TypeClass.VOID_value:
+ break;
+
+ case TypeClass.BOOLEAN_value:
+ writeBooleanValue((Boolean) value);
+ break;
+
+ case TypeClass.BYTE_value:
+ writeByteValue((Byte) value);
+ break;
+
+ case TypeClass.SHORT_value:
+ case TypeClass.UNSIGNED_SHORT_value:
+ writeShortValue((Short) value);
+ break;
+
+ case TypeClass.LONG_value:
+ case TypeClass.UNSIGNED_LONG_value:
+ writeLongValue((Integer) value);
+ break;
+
+ case TypeClass.HYPER_value:
+ case TypeClass.UNSIGNED_HYPER_value:
+ writeHyperValue((Long) value);
+ break;
+
+ case TypeClass.FLOAT_value:
+ writeFloatValue((Float) value);
+ break;
+
+ case TypeClass.DOUBLE_value:
+ writeDoubleValue((Double) value);
+ break;
+
+ case TypeClass.CHAR_value:
+ writeCharValue((Character) value);
+ break;
+
+ case TypeClass.STRING_value:
+ writeStringValue((String) value);
+ break;
+
+ case TypeClass.TYPE_value:
+ writeTypeValue((Type) value);
+ break;
+
+ case TypeClass.ANY_value:
+ writeAnyValue(value);
+ break;
+
+ case TypeClass.SEQUENCE_value:
+ writeSequenceValue(type, value);
+ break;
+
+ case TypeClass.ENUM_value:
+ writeEnumValue(type, (Enum) value);
+ break;
+
+ case TypeClass.STRUCT_value:
+ writeStructValue(type, value);
+ break;
+
+ case TypeClass.EXCEPTION_value:
+ writeExceptionValue(type, (Exception) value);
+ break;
+
+ case TypeClass.INTERFACE_value:
+ writeInterfaceValue(type, (XInterface) value);
+ break;
+
+ default:
+ throw new IllegalArgumentException("Bad type descriptor " + type);
+ }
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
}
}
@@ -185,12 +210,8 @@ final class Marshal {
return data;
}
- private void writeBooleanValue(Boolean value) {
- try {
- output.writeBoolean(value != null && value.booleanValue());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private void writeBooleanValue(Boolean value) throws IOException {
+ output.writeBoolean(value != null && value.booleanValue());
}
private void writeByteValue(Byte value) {
@@ -201,78 +222,49 @@ final class Marshal {
write16Bit(value == null ? 0 : value.shortValue());
}
- private void writeLongValue(Integer value) {
+ private void writeLongValue(Integer value) throws IOException {
write32Bit(value == null ? 0 : value.intValue());
}
- private void writeHyperValue(Long value) {
- try {
- output.writeLong(value == null ? 0 : value.longValue());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private void writeHyperValue(Long value) throws IOException {
+ output.writeLong(value == null ? 0 : value.longValue());
}
- private void writeFloatValue(Float value) {
- try {
- output.writeFloat(value == null ? 0 : value.floatValue());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private void writeFloatValue(Float value) throws IOException {
+ output.writeFloat(value == null ? 0 : value.floatValue());
}
- private void writeDoubleValue(Double value) {
- try {
- output.writeDouble(value == null ? 0 : value.doubleValue());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private void writeDoubleValue(Double value) throws IOException {
+ output.writeDouble(value == null ? 0 : value.doubleValue());
}
- private void writeCharValue(Character value) {
- try {
- output.writeChar(value == null ? 0 : value.charValue());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private void writeCharValue(Character value) throws IOException {
+ output.writeChar(value == null ? 0 : value.charValue());
}
- private void writeStringValue(String value) {
+ private void writeStringValue(String value) throws IOException {
if (value == null) {
writeCompressedNumber(0);
} else {
- byte[] data;
- try {
- data = value.getBytes("UTF8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e.toString());
- }
+ byte[] data = value.getBytes("UTF8");
writeCompressedNumber(data.length);
writeBytes(data);
}
}
- private void writeTypeValue(Type value) {
- try {
- writeType(
- TypeDescription.getTypeDescription(
- value == null ? Type.VOID : value));
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e.toString());
- }
+ private void writeTypeValue(Type value) throws ClassNotFoundException {
+ writeType(
+ TypeDescription.getTypeDescription(
+ value == null ? Type.VOID : value));
}
- private void writeAnyValue(Object value) {
+ private void writeAnyValue(Object value) throws ClassNotFoundException {
TypeDescription type;
if (value == null || value instanceof XInterface) {
type = TypeDescription.getTypeDescription(XInterface.class);
} else if (value instanceof Any) {
Any any = (Any) value;
- try {
- type = TypeDescription.getTypeDescription(any.getType());
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e.toString());
- }
+ type = TypeDescription.getTypeDescription(any.getType());
value = any.getObject();
} else if (value.getClass() == Object.class) {
// Avoid StackOverflowError:
@@ -285,7 +277,7 @@ final class Marshal {
writeValue(type, value);
}
- private void writeSequenceValue(TypeDescription type, Object value) {
+ private void writeSequenceValue(TypeDescription type, Object value) throws IOException {
if (value == null) {
writeCompressedNumber(0);
} else {
@@ -304,41 +296,29 @@ final class Marshal {
}
}
- private void writeEnumValue(TypeDescription type, Enum value) {
+ private void writeEnumValue(TypeDescription type, Enum value) throws IllegalAccessException, IOException, InvocationTargetException, NoSuchMethodException {
int n;
if (value == null) {
- try {
- n = ((Enum)
- (type.getZClass().getMethod("getDefault", (Class[]) null).
- invoke(null, (Object[]) null))).
- getValue();
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e.toString());
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.toString());
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e.toString());
- }
+ n = ((Enum)
+ (type.getZClass().getMethod("getDefault", (Class[]) null).
+ invoke(null, (Object[]) null))).
+ getValue();
} else {
n = value.getValue();
}
write32Bit(n);
}
- private void writeStructValue(TypeDescription type, Object value) {
+ private void writeStructValue(TypeDescription type, Object value) throws IllegalAccessException {
IFieldDescription[] fields = type.getFieldDescriptions();
for (int i = 0; i < fields.length; ++i) {
- try {
- writeValue(
- (TypeDescription) fields[i].getTypeDescription(),
- value == null ? null : fields[i].getField().get(value));
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e.toString());
- }
+ writeValue(
+ (TypeDescription) fields[i].getTypeDescription(),
+ value == null ? null : fields[i].getField().get(value));
}
}
- private void writeExceptionValue(TypeDescription type, Exception value) {
+ private void writeExceptionValue(TypeDescription type, Exception value) throws IllegalAccessException, IOException {
writeStringValue(value == null ? null : value.getMessage());
writeStructValue(type, value);
}
@@ -347,15 +327,11 @@ final class Marshal {
writeInterface(value, new Type(type));
}
- private void write32Bit(int value) {
- try {
- output.writeInt(value);
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private void write32Bit(int value) throws IOException {
+ output.writeInt(value);
}
- private void writeCompressedNumber(int number) {
+ private void writeCompressedNumber(int number) throws IOException {
if (number >= 0 && number < 0xFF) {
write8Bit(number);
} else {
@@ -364,12 +340,8 @@ final class Marshal {
}
}
- private void writeBytes(byte[] data) {
- try {
- output.write(data);
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private void writeBytes(byte[] data) throws IOException {
+ output.write(data);
}
private final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java
index b567c9e..48d7630 100644
--- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java
+++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java
@@ -17,6 +17,13 @@
*/
package com.sun.star.lib.uno.protocols.urp;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+
import com.sun.star.lib.uno.environments.remote.ThreadId;
import com.sun.star.lib.uno.typedesc.TypeDescription;
import com.sun.star.uno.Any;
@@ -26,12 +33,6 @@ import com.sun.star.uno.IFieldDescription;
import com.sun.star.uno.Type;
import com.sun.star.uno.TypeClass;
import com.sun.star.uno.XInterface;
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Array;
-import java.lang.reflect.InvocationTargetException;
final class Unmarshal {
public Unmarshal(IBridge bridge, int cacheSize) {
@@ -46,7 +47,7 @@ final class Unmarshal {
try {
return input.readUnsignedByte();
} catch (IOException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
@@ -54,25 +55,29 @@ final class Unmarshal {
try {
return input.readUnsignedShort();
} catch (IOException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
public String readObjectId() {
- String id = readStringValue();
- int index = read16Bit();
- if (index == 0xFFFF) {
- if (id.length() == 0) {
- id = null;
- }
- } else {
- if (id.length() == 0) {
- id = objectIdCache[index];
+ try {
+ String id = readStringValue();
+ int index = read16Bit();
+ if (index == 0xFFFF) {
+ if (id.length() == 0) {
+ id = null;
+ }
} else {
- objectIdCache[index] = id;
+ if (id.length() == 0) {
+ id = objectIdCache[index];
+ } else {
+ objectIdCache[index] = id;
+ }
}
+ return id;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
- return id;
}
public Object readInterface(Type type) {
@@ -81,23 +86,27 @@ final class Unmarshal {
}
public ThreadId readThreadId() {
- int len = readCompressedNumber();
- byte[] data ;
- ThreadId id = null;
- if (len != 0) {
- data = new byte[len];
- readBytes(data);
- id = new ThreadId(data);
- }
- int index = read16Bit();
- if (index != 0xFFFF) {
- if (len == 0) {
- id = threadIdCache[index];
- } else {
- threadIdCache[index] = id;
+ try {
+ int len = readCompressedNumber();
+ byte[] data ;
+ ThreadId id = null;
+ if (len != 0) {
+ data = new byte[len];
+ readBytes(data);
+ id = new ThreadId(data);
+ }
+ int index = read16Bit();
+ if (index != 0xFFFF) {
+ if (len == 0) {
+ id = threadIdCache[index];
+ } else {
+ threadIdCache[index] = id;
+ }
}
+ return id;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
- return id;
}
public TypeDescription readType() {
@@ -112,8 +121,10 @@ final class Unmarshal {
try {
type = TypeDescription.getTypeDescription(
readStringValue());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
if (index != 0xFFFF) {
@@ -128,63 +139,67 @@ final class Unmarshal {
}
public Object readValue(TypeDescription type) {
- switch (type.getTypeClass().getValue()) {
- case TypeClass.VOID_value:
- return null;
+ try {
+ switch (type.getTypeClass().getValue()) {
+ case TypeClass.VOID_value:
+ return null;
- case TypeClass.BOOLEAN_value:
- return readBooleanValue();
+ case TypeClass.BOOLEAN_value:
+ return readBooleanValue();
- case TypeClass.BYTE_value:
- return readByteValue();
+ case TypeClass.BYTE_value:
+ return readByteValue();
- case TypeClass.SHORT_value:
- case TypeClass.UNSIGNED_SHORT_value:
- return readShortValue();
+ case TypeClass.SHORT_value:
+ case TypeClass.UNSIGNED_SHORT_value:
+ return readShortValue();
- case TypeClass.LONG_value:
- case TypeClass.UNSIGNED_LONG_value:
- return readLongValue();
+ case TypeClass.LONG_value:
+ case TypeClass.UNSIGNED_LONG_value:
+ return readLongValue();
- case TypeClass.HYPER_value:
- case TypeClass.UNSIGNED_HYPER_value:
- return readHyperValue();
+ case TypeClass.HYPER_value:
+ case TypeClass.UNSIGNED_HYPER_value:
+ return readHyperValue();
- case TypeClass.FLOAT_value:
- return readFloatValue();
+ case TypeClass.FLOAT_value:
+ return readFloatValue();
- case TypeClass.DOUBLE_value:
- return readDoubleValue();
+ case TypeClass.DOUBLE_value:
+ return readDoubleValue();
- case TypeClass.CHAR_value:
- return readCharValue();
+ case TypeClass.CHAR_value:
+ return readCharValue();
- case TypeClass.STRING_value:
- return readStringValue();
+ case TypeClass.STRING_value:
+ return readStringValue();
- case TypeClass.TYPE_value:
- return readTypeValue();
+ case TypeClass.TYPE_value:
+ return readTypeValue();
- case TypeClass.ANY_value:
- return readAnyValue();
+ case TypeClass.ANY_value:
+ return readAnyValue();
- case TypeClass.SEQUENCE_value:
- return readSequenceValue(type);
+ case TypeClass.SEQUENCE_value:
+ return readSequenceValue(type);
- case TypeClass.ENUM_value:
- return readEnumValue(type);
+ case TypeClass.ENUM_value:
+ return readEnumValue(type);
- case TypeClass.STRUCT_value:
- return readStructValue(type);
+ case TypeClass.STRUCT_value:
+ return readStructValue(type);
- case TypeClass.EXCEPTION_value:
- return readExceptionValue(type);
+ case TypeClass.EXCEPTION_value:
+ return readExceptionValue(type);
- case TypeClass.INTERFACE_value:
- return readInterfaceValue(type);
+ case TypeClass.INTERFACE_value:
+ return readInterfaceValue(type);
- default:
- throw new IllegalArgumentException("Bad type descriptor " + type);
+ default:
+ throw new IllegalArgumentException("Bad type descriptor " + type);
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
@@ -192,7 +207,7 @@ final class Unmarshal {
try {
return input.available() > 0;
} catch (IOException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
@@ -200,78 +215,46 @@ final class Unmarshal {
input = new DataInputStream(new ByteArrayInputStream(data));
}
- private Boolean readBooleanValue() {
- try {
- return input.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private Boolean readBooleanValue() throws IOException {
+ return input.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
}
- private Byte readByteValue() {
- try {
- return Byte.valueOf(input.readByte());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private Byte readByteValue() throws IOException {
+ return Byte.valueOf(input.readByte());
}
- private Short readShortValue() {
- try {
- return Short.valueOf(input.readShort());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private Short readShortValue() throws IOException {
+ return Short.valueOf(input.readShort());
}
- private Integer readLongValue() {
- try {
- return Integer.valueOf(input.readInt());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private Integer readLongValue() throws IOException {
+ return Integer.valueOf(input.readInt());
}
- private Long readHyperValue() {
- try {
- return Long.valueOf(input.readLong());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private Long readHyperValue() throws IOException {
+ return Long.valueOf(input.readLong());
}
- private Float readFloatValue() {
- try {
- return new Float(input.readFloat());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private Float readFloatValue() throws IOException {
+ return new Float(input.readFloat());
}
- private Double readDoubleValue() {
- try {
- return new Double(input.readDouble());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private Double readDoubleValue() throws IOException {
+ return new Double(input.readDouble());
}
- private Character readCharValue() {
- try {
- return new Character(input.readChar());
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private Character readCharValue() throws IOException {
+ return new Character(input.readChar());
}
- private String readStringValue() {
+ private String readStringValue() throws IOException {
int len = readCompressedNumber();
byte[] data = new byte[len];
readBytes(data);
try {
return new String(data, "UTF8");
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
@@ -279,7 +262,7 @@ final class Unmarshal {
return new Type(readType());
}
- private Object readAnyValue() {
+ private Object readAnyValue() throws IOException {
TypeDescription type = readType();
switch (type.getTypeClass().getValue()) {
case TypeClass.VOID_value:
@@ -373,7 +356,7 @@ final class Unmarshal {
}
}
- private Object readSequenceValue(TypeDescription type) {
+ private Object readSequenceValue(TypeDescription type) throws IOException {
int len = readCompressedNumber();
TypeDescription ctype = (TypeDescription) type.getComponentType();
if (ctype.getTypeClass() == TypeClass.BYTE) {
@@ -391,18 +374,18 @@ final class Unmarshal {
}
}
- private Enum readEnumValue(TypeDescription type) {
+ private Enum readEnumValue(TypeDescription type) throws IOException {
try {
return (Enum)
type.getZClass().getMethod(
"fromInt", new Class[] { int.class }).
invoke(null, new Object[] { readLongValue() });
} catch (IllegalAccessException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
} catch (InvocationTargetException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
@@ -411,28 +394,28 @@ final class Unmarshal {
try {
value = type.getZClass().newInstance();
} catch (IllegalAccessException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
} catch (InstantiationException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
readFields(type, value);
return value;
}
- private Exception readExceptionValue(TypeDescription type) {
+ private Exception readExceptionValue(TypeDescription type) throws IOException {
Exception value;
try {
value = (Exception)
type.getZClass().getConstructor(new Class[] { String.class }).
newInstance(new Object[] { readStringValue() });
} catch (IllegalAccessException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
} catch (InstantiationException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
} catch (InvocationTargetException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
readFields(type, value);
return value;
@@ -442,21 +425,13 @@ final class Unmarshal {
return readInterface(new Type(type));
}
- private int readCompressedNumber() {
+ private int readCompressedNumber() throws IOException {
int number = read8Bit();
- try {
- return number < 0xFF ? number : input.readInt();
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ return number < 0xFF ? number : input.readInt();
}
- private void readBytes(byte[] data) {
- try {
- input.readFully(data);
- } catch (IOException e) {
- throw new RuntimeException(e.toString());
- }
+ private void readBytes(byte[] data) throws IOException {
+ input.readFully(data);
}
private void readFields(TypeDescription type, Object value) {
@@ -468,7 +443,7 @@ final class Unmarshal {
readValue(
(TypeDescription) fields[i].getTypeDescription()));
} catch (IllegalAccessException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
}
diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java
index f60f697..b527e64 100644
--- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java
+++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java
@@ -136,7 +136,7 @@ public final class urp implements IProtocol {
monitor.wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
if (state == STATE_TERMINATED) {
diff --git a/qadevOOo/runner/lib/StatusException.java b/qadevOOo/runner/lib/StatusException.java
index c965892..a4bf07f 100644
--- a/qadevOOo/runner/lib/StatusException.java
+++ b/qadevOOo/runner/lib/StatusException.java
@@ -41,6 +41,14 @@ public class StatusException extends RuntimeException {
}
/**
+ * Constructs a StatusException containing an exception Status.
+ */
+ public StatusException( Throwable t, Status st ) {
+ super( t );
+ this.status = st;
+ }
+
+ /**
* Creates a StatusException containing a Status.
*/
public StatusException( Status st ) {
diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java
index d57167c..3f4701b 100644
--- a/qadevOOo/runner/util/UITools.java
+++ b/qadevOOo/runner/util/UITools.java
@@ -257,7 +257,7 @@ public class UITools {
return cMessage;
} catch (Exception e) {
- throw new Exception("Could not get message from Basic-MessageBox: " + e.toString());
+ throw new Exception("Could not get message from Basic-MessageBox:", e);
}
}
diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
index 9a3faf4..775ed23 100644
--- a/qadevOOo/runner/util/utils.java
+++ b/qadevOOo/runner/util/utils.java
@@ -795,7 +795,7 @@ public class utils {
xContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander"));
return xME.expandMacros(expand);
} catch (Exception e) {
- throw new Exception("could not expand macro: " + e.toString(), e);
+ throw new Exception("could not expand macro", e);
}
}
@@ -848,7 +848,7 @@ public class utils {
utils.shortWait(3000);
} catch (Exception e) {
- throw new Exception("ERROR: could not dispatch URL '" + URL + "': " + e.toString());
+ throw new Exception("ERROR: could not dispatch URL '" + URL + "'", e);
}
}
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java b/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java
index 9b55bbd..1703c95 100644
--- a/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_HandoutView.java
@@ -208,7 +208,7 @@ public class DrawController_HandoutView extends TestCase {
utils.dispatchURL(xMSF, xDrawDoc, ".uno:HandoutMode");
} catch (Exception e){
e.printStackTrace(log);
- throw new StatusException(Status.failed(e.toString()));
+ throw new StatusException(e, Status.failed(e.getMessage()));
}
utils.shortWait(500);
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java b/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java
index 42feb43..65a641d 100644
--- a/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_NotesView.java
@@ -205,7 +205,7 @@ public class DrawController_NotesView extends TestCase {
utils.dispatchURL(xMSF, xDrawDoc, ".uno:NotesMode");
} catch (Exception e){
e.printStackTrace(log);
- throw new StatusException(Status.failed(e.toString()));
+ throw new StatusException(e, Status.failed(e.getMessage()));
}
utils.shortWait(500);
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java b/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java
index f48b6ef..afb690a 100644
--- a/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_OutlineView.java
@@ -205,7 +205,7 @@ public class DrawController_OutlineView extends TestCase {
utils.dispatchURL(xMSF, xDrawDoc, ".uno:OutlineMode");
} catch (Exception e){
e.printStackTrace(log);
- throw new StatusException(Status.failed(e.toString()));
+ throw new StatusException(e, Status.failed(e.getMessage()));
}
utils.shortWait(500);
diff --git a/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java b/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java
index 73780a8..5163c4f 100644
--- a/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java
+++ b/qadevOOo/tests/java/mod/_sd/DrawController_PresentationView.java
@@ -205,7 +205,7 @@ public class DrawController_PresentationView extends TestCase {
utils.dispatchURL(xMSF, xDrawDoc, ".uno:DiaMode");
} catch (Exception e){
e.printStackTrace(log);
- throw new StatusException(Status.failed(e.toString()));
+ throw new StatusException(e, Status.failed(e.getMessage()));
}
utils.shortWait(500);
diff --git a/ridljar/com/sun/star/uno/Type.java b/ridljar/com/sun/star/uno/Type.java
index adbcebd..a4da5b1 100644
--- a/ridljar/com/sun/star/uno/Type.java
+++ b/ridljar/com/sun/star/uno/Type.java
@@ -284,7 +284,7 @@ public class Type {
Class.forName(i < 0 ? typeName : typeName.substring(0, i)),
false, i >= 0);
} catch (ClassNotFoundException e) {
- throw new RuntimeException(e.toString());
+ throw new RuntimeException(e);
}
}
diff --git a/ridljar/com/sun/star/uno/UnoRuntime.java b/ridljar/com/sun/star/uno/UnoRuntime.java
index 5576c2c..40403cd 100644
--- a/ridljar/com/sun/star/uno/UnoRuntime.java
+++ b/ridljar/com/sun/star/uno/UnoRuntime.java
@@ -247,7 +247,7 @@ public class UnoRuntime {
fs = TypeDescription.getTypeDescription(t).
getFieldDescriptions();
} catch (ClassNotFoundException e) {
- throw new java.lang.RuntimeException(e.toString());
+ throw new java.lang.RuntimeException(e);
}
for (int i = 0; i< fs.length; ++i) {
Type ft = new Type(fs[i].getTypeDescription());
@@ -263,7 +263,7 @@ public class UnoRuntime {
return false;
}
} catch (IllegalAccessException e) {
- throw new java.lang.RuntimeException(e.toString());
+ throw new java.lang.RuntimeException(e);
}
}
return true;
@@ -338,7 +338,7 @@ public class UnoRuntime {
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.lang.Exception e) {
- throw new java.lang.RuntimeException(e.toString());
+ throw new java.lang.RuntimeException(e);
}
case TypeClass.ENUM_value:
try {
@@ -347,7 +347,7 @@ public class UnoRuntime {
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.lang.Exception e) {
- throw new java.lang.RuntimeException(e.toString());
+ throw new java.lang.RuntimeException(e);
}
default:
throw new IllegalArgumentException(
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 ba269ac..bf47b60 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 7a3a20c..6e954af 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 d36bada..be9dd42 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 075ab66..d630e3f 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 2f48fcc..801cb0d 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 137d1a2..4614727 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 f9f529e..bdb25bd 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 9351760..3853944 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(
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 a2e67c0..cbade8a 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
@@ -27,7 +27,6 @@ import java.io.IOException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
-
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamResult;
@@ -36,7 +35,6 @@ import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Node;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-
import org.openoffice.xmerge.util.Debug;
/**
@@ -296,16 +294,15 @@ public class DOMDocument
throw new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl);
}
}
- } catch (ClassNotFoundException cnfe) {
- throw new IOException(cnfe.toString());
- } catch (Exception e) {
+ }
+ catch (Exception e) {
// We may get some other errors, but the bottom line is that
// the steps being executed no longer work
- throw new IOException(e.toString());
+ throw new IOException(e);
}
byte bytes[] = baos.toByteArray();
return bytes;
}
-}
\ No newline at end of file
+}
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
index df3fec9..d468b42 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
@@ -813,17 +813,14 @@ public abstract class OfficeDocument
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);
+ throw new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl, e);
}
}
}
- catch (ClassNotFoundException cnfe) {
- throw new IOException(cnfe.toString());
- }
catch (Exception e) {
// We may get some other errors, but the bottom line is that
// the steps being executed no longer work
- throw new IOException(e.toString());
+ throw new IOException(e);
}
byte bytes[] = baos.toByteArray();
diff --git a/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java b/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java
index 6629a32..d9c2c07 100644
--- a/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java
+++ b/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java
@@ -130,10 +130,10 @@ class MyHandler implements HttpHandler {
System.out.println("requested: " + sRequestPath);
File fileRequest = new File(new File(".").getCanonicalPath(), sRequestPath);
if (!fileRequest.exists()) {
- throw new Exception("The file " + fileRequest.toString() + " does not exist!\n");
+ throw new IOException("The file " + fileRequest + " does not exist!");
}
else if (fileRequest.isDirectory()) {
- throw new Exception(fileRequest.toString() + " is a directory!\n");
+ throw new IOException(fileRequest + " is a directory!\n");
}
More information about the Libreoffice-commits
mailing list