Kaydet (Commit) 93056481 authored tarafından Noel Grandin's avatar Noel Grandin

java: when rethrowing exceptions, store the original

Change-Id: I8a2a264597d0b1ae06b08136fea36003682380b5
üst 03c7c26c
......@@ -894,28 +894,30 @@ public class OOoBean
NoDocumentException,
java.io.IOException,
com.sun.star.lang.IllegalArgumentException
{
{
// wrap byte arrray into UNO stream
com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter aStream =
new com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter(
aOutBuffer );
com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter aStream = new com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter(
aOutBuffer);
// add stream to arguments
com.sun.star.beans.PropertyValue[] aExtendedArguments =
addArgument( aArguments, new com.sun.star.beans.PropertyValue(
"OutputStream", -1, aStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) );
com.sun.star.beans.PropertyValue[] aExtendedArguments = addArgument(
aArguments, new com.sun.star.beans.PropertyValue(
"OutputStream", -1, aStream,
com.sun.star.beans.PropertyState.DIRECT_VALUE));
// call normal store method
storeToURL( "private:stream", aExtendedArguments );
storeToURL("private:stream", aExtendedArguments);
// get byte array from document stream
try { aStream.closeOutput(); }
catch ( com.sun.star.io.NotConnectedException aExc )
{ /* TDB */ }
catch ( com.sun.star.io.BufferSizeExceededException aExc )
{ /* TDB */ }
catch ( com.sun.star.io.IOException aExc )
{ throw new java.io.IOException(); }
try {
aStream.closeOutput();
} catch (com.sun.star.io.NotConnectedException aExc) { /* TDB */
} catch (com.sun.star.io.BufferSizeExceededException aExc) { /* TDB */
} catch (com.sun.star.io.IOException ex1) {
java.io.IOException ex2 = new java.io.IOException();
ex2.initCause(ex1);
throw ex2;
}
return aStream.getBuffer();
}
......
......@@ -109,14 +109,9 @@ public class BasicMacroTools {
private static XURLTransformer makeParser(XMultiServiceFactory mMSF)
throws java.lang.Exception {
try {
return UnoRuntime.queryInterface(
XURLTransformer.class, mMSF.createInstance(
"com.sun.star.util.URLTransformer"));
} catch (Exception e) {
throw new Exception("could not create UTL-Transformer " +
e.toString());
}
return UnoRuntime.queryInterface(
XURLTransformer.class, mMSF.createInstance(
"com.sun.star.util.URLTransformer"));
}
public void loadLibrary(String LibraryName, String LibraryURL)
......
......@@ -56,8 +56,7 @@ public class _XPropertyWithState extends MultiMethodTest {
oObj.getDefaultAsProperty();
} catch (com.sun.star.lang.WrappedTargetException e){
e.printStackTrace(log);
throw new StatusException(Status.failed("'com.sun.star.lang.WrappedTargetException' was thrown"));
throw new StatusException(e, Status.failed("'com.sun.star.lang.WrappedTargetException' was thrown"));
}
tRes.tested("getDefaultAsProperty()", true);
......
......@@ -164,8 +164,7 @@ public class TableWindowAccessibility extends TestCase {
store.storeAsURL(aFile,new PropertyValue[]{});
log.println("... done");
} catch (com.sun.star.uno.Exception e) {
e.printStackTrace(log);
throw new StatusException(Status.failed("Couldn't register object"));
throw new StatusException(e, Status.failed("Couldn't register object"));
}
isolConnection = UnoRuntime.queryInterface(
......
......@@ -57,14 +57,16 @@ public class StrictResolver implements Resolver {
try {
m = resolveArguments(sd, c);
} catch (ClassNotFoundException e) {
throw new NoSuchMethodException(
"StrictResolver.getProxy: Can't find method: " + sd.getMethodName()
+ ":" + e.getMessage());
} catch (NoSuchMethodException e) {
throw new NoSuchMethodException(
"StrictResolver.getProxy: Can't find method: " + sd.getMethodName()
+ ":" + e.getMessage());
} catch (ClassNotFoundException ex1) {
NoSuchMethodException ex2 = new NoSuchMethodException(
"StrictResolver.getProxy: Can't find method: " + sd.getMethodName());
ex2.initCause(ex1);
throw ex2;
} catch (NoSuchMethodException ex1) {
NoSuchMethodException ex2 = new NoSuchMethodException(
"StrictResolver.getProxy: Can't find method: " + sd.getMethodName());
ex2.initCause(ex1);
throw ex2;
}
ScriptProxy sp = new ScriptProxy(m);
......@@ -76,12 +78,16 @@ public class StrictResolver implements Resolver {
try {
o = c.newInstance();
} catch (InstantiationException ie) {
throw new NoSuchMethodException(
"getScriptProxy: Can't instantiate: " + c.getName());
} catch (IllegalAccessException iae) {
throw new NoSuchMethodException(
"getScriptProxy: Can't access: " + c.getName());
} catch (InstantiationException ex1) {
NoSuchMethodException ex2 = new NoSuchMethodException(
"getScriptProxy: Can't instantiate: " + c.getName());
ex2.initCause(ex1);
throw ex2;
} catch (IllegalAccessException ex1) {
NoSuchMethodException ex2 = new NoSuchMethodException(
"getScriptProxy: Can't access: " + c.getName());
ex2.initCause(ex1);
throw ex2;
}
sp.setTargetObject(o);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment