summaryrefslogtreecommitdiff
path: root/xmerge
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-10-16 12:19:14 +0200
committerNoel Grandin <noel@peralex.com>2014-10-16 12:27:15 +0200
commit9341bf3dc38b2cc117ffbe12ff057511ed6e046d (patch)
tree3a54c1764eb0e3106695292a737944507d3b4fb6 /xmerge
parentb2f69f626409442d1f0ca5049b946946ce9b01d8 (diff)
java: when rethrowing, store the original exception
Change-Id: I34ce000c48d2d79bfec854c8dd55d12f2bee29c7
Diffstat (limited to 'xmerge')
-rw-r--r--xmerge/source/bridge/java/XMergeBridge.java22
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java4
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java5
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java10
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java4
5 files changed, 23 insertions, 22 deletions
diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java
index 30fe66b48d99..da0d31a180b8 100644
--- a/xmerge/source/bridge/java/XMergeBridge.java
+++ b/xmerge/source/bridge/java/XMergeBridge.java
@@ -312,11 +312,11 @@ public class XMergeBridge {
}
catch (IOException e){
- throw new com.sun.star.uno.RuntimeException(e.getMessage());
+ throw new com.sun.star.uno.RuntimeException(e);
}
catch (Exception e){
- throw new com.sun.star.uno.RuntimeException("Xmerge Exception");
+ throw new com.sun.star.uno.RuntimeException(e);
}
}
@@ -476,13 +476,10 @@ public class XMergeBridge {
}
ConverterInfoMgr.removeByJar(jarName);
}
- catch (StackOverflowError sOE){
- System.out.println("\nERROR : Stack Overflow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n");
-
- }
- catch (Exception e) {
- System.out.println("Error:"+e);
- throw new IOException("Xmerge Exception");
+ catch (Exception ex1) {
+ IOException ex2 = new IOException();
+ ex2.initCause(ex1);
+ throw ex2;
}
}
else{
@@ -513,9 +510,10 @@ public class XMergeBridge {
catch (StackOverflowError sOE){
System.out.println("\nERROR : Stack Overflow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n");
}
- catch (Exception e) {
- System.out.println("Error:"+e);
- throw new IOException("Xmerge Exception");
+ catch (Exception ex1) {
+ IOException ex2 = new IOException();
+ ex2.initCause(ex1);
+ throw ex2;
}
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java
index f722732be8c3..99f9d9e7fdf6 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/dom/DOMDocument.java
@@ -291,7 +291,9 @@ public class DOMDocument
return writer.toString().getBytes();
} catch (Exception e) {
// We don't have another parser
- throw new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl);
+ IOException ex2 = new IOException("No appropriate API (JAXP/Xerces) to serialize XML document: " + domImpl);
+ ex2.initCause(e);
+ throw ex2;
}
}
}
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java
index 7ca174a0af1d..2f87d2b8e1de 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/Driver.java
@@ -144,9 +144,8 @@ public final class Driver {
myConvert.addInputStream(f.getName(), fis);
}
} catch (Exception addExcept) {
- System.out.println("\nFile <" + processFile + "> is not in <" +
- fromMime + "> format");
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("\nFile <" + processFile + "> is not in <" +
+ fromMime + "> format", addExcept);
}
ConvertData dataOut = null;
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java
index 5f09b628788b..14e036687828 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java
@@ -128,9 +128,8 @@ public class ConverterInfo {
}
} catch (Exception e) {
- RegistryException re = new RegistryException(
- "Class implementation of the plug-in cannot be loaded.");
- throw re;
+ throw new RegistryException(
+ "Class implementation of the plug-in cannot be loaded.", e);
}
}
@@ -200,9 +199,8 @@ public class ConverterInfo {
}
} catch (Exception e) {
- RegistryException re = new RegistryException(
- "Class implementation of the plug-in cannot be loaded.");
- throw re;
+ throw new RegistryException(
+ "Class implementation of the plug-in cannot be loaded.", e);
}
}
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java
index 3630ed9c2d1d..6452256d25bb 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/RegistryException.java
@@ -31,4 +31,8 @@ public class RegistryException extends Exception {
public RegistryException(String message) {
super(message);
}
+
+ public RegistryException(String message, Throwable cause) {
+ super(message, cause);
+ }
} \ No newline at end of file