summaryrefslogtreecommitdiff
path: root/xmerge
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-12-17 10:38:54 +0200
committerNoel Grandin <noel@peralex.com>2014-12-19 10:41:53 +0200
commit3090d96f73714d5f2cc151e94a202010b5e96cf3 (patch)
tree6dd9f60c8c72bc1caf411396342167bd2fe5d394 /xmerge
parenta96c308e52983b7bc0275e31e50a9b04e5805852 (diff)
xmerge: store the original exception in the cause field properly
Change-Id: I154b8b80aabd824edc62a7fdd831074fcf5cb21b
Diffstat (limited to 'xmerge')
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java
index 89f91499caaf..12799065b50b 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocumentException.java
@@ -33,16 +33,22 @@ import org.openoffice.xmerge.util.Resources;
*/
public final class OfficeDocumentException extends IOException {
- private StringBuffer message = null;
-
/**
* Constructor, capturing additional information from the {@code SAXException}.
*
* @param e The {@code SAXException}.
*/
public OfficeDocumentException(SAXException e) {
- super(e.toString());
- message = new StringBuffer();
+ super(constructMessage(e));
+ if (e.getException() != null) {
+ initCause(e.getException());
+ } else {
+ initCause(e);
+ }
+ }
+
+ private static String constructMessage(SAXException e) {
+ StringBuffer message = new StringBuffer();
if (e instanceof SAXParseException) {
String msgParseError =
Resources.getInstance().getString("PARSE_ERROR");
@@ -80,6 +86,7 @@ public final class OfficeDocumentException extends IOException {
if (ex != null) {
message.append(ex.getMessage());
}
+ return message.toString();
}
/**
@@ -99,15 +106,7 @@ public final class OfficeDocumentException extends IOException {
*/
public OfficeDocumentException(Exception e) {
super(e.getMessage());
+ initCause(e);
}
- /**
- * Returns the message value for the {@code Exception}.
- *
- * @return The message value for the {@code Exception}.
- */
- @Override
- public String getMessage() {
- return message.toString() + super.getMessage();
- }
} \ No newline at end of file