diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-16 12:19:14 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-16 12:27:15 +0200 |
commit | 9341bf3dc38b2cc117ffbe12ff057511ed6e046d (patch) | |
tree | 3a54c1764eb0e3106695292a737944507d3b4fb6 /reportbuilder | |
parent | b2f69f626409442d1f0ca5049b946946ce9b01d8 (diff) |
java: when rethrowing, store the original exception
Change-Id: I34ce000c48d2d79bfec854c8dd55d12f2bee29c7
Diffstat (limited to 'reportbuilder')
6 files changed, 19 insertions, 15 deletions
diff --git a/reportbuilder/java/org/libreoffice/report/SOImageService.java b/reportbuilder/java/org/libreoffice/report/SOImageService.java index 319f9090a121..1979c4fd504a 100644 --- a/reportbuilder/java/org/libreoffice/report/SOImageService.java +++ b/reportbuilder/java/org/libreoffice/report/SOImageService.java @@ -146,19 +146,19 @@ public class SOImageService implements ImageService } catch (UnknownPropertyException ex) { - throw new ReportExecutionException(); + throw new ReportExecutionException(ex); } catch (WrappedTargetException ex) { - throw new ReportExecutionException(); + throw new ReportExecutionException(ex); } catch (com.sun.star.lang.IllegalArgumentException ex) { - throw new ReportExecutionException(); + throw new ReportExecutionException(ex); } catch (IOException ex) { - throw new ReportExecutionException(); + throw new ReportExecutionException(ex); } return null; } diff --git a/reportbuilder/java/org/libreoffice/report/StorageRepository.java b/reportbuilder/java/org/libreoffice/report/StorageRepository.java index 2f3e4249fd59..1ccfc5253f77 100644 --- a/reportbuilder/java/org/libreoffice/report/StorageRepository.java +++ b/reportbuilder/java/org/libreoffice/report/StorageRepository.java @@ -87,9 +87,11 @@ public class StorageRepository implements InputRepository, OutputRepository final XStream xStream = UnoRuntime.queryInterface(XStream.class, input.openStreamElement(name, ElementModes.READ)); return new BufferedInputStream(new XInputStreamToInputStreamAdapter(xStream.getInputStream()), 102400); } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex1) { - throw new IOException("createInputStream"); + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(ex1); + throw ex2; } } @@ -116,9 +118,11 @@ public class StorageRepository implements InputRepository, OutputRepository } return new BufferedOutputStream(new XOutputStreamToOutputStreamAdapter(stream.getOutputStream()), 204800); } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex1) { - throw new IOException("createOutputStream"); + java.io.IOException ex2 = new java.io.IOException(); + ex2.initCause(ex1); + throw ex2; } } diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java index 4a6604659010..f6d714722657 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/SOReportJobFactory.java @@ -216,12 +216,12 @@ public class SOReportJobFactory catch (java.lang.Exception e) { LOGGER.error("ReportProcessing failed", e); - throw new com.sun.star.lang.WrappedTargetException(e.getMessage(), this, null); + throw new com.sun.star.lang.WrappedTargetException(e.getMessage(), this, e); } catch (java.lang.IncompatibleClassChangeError e2) { LOGGER.error("Detected an IncompatibleClassChangeError"); - throw new com.sun.star.lang.WrappedTargetException("caught a " + e2.getClass().getName(), this, new com.sun.star.uno.Exception(e2.getLocalizedMessage())); + throw new com.sun.star.lang.WrappedTargetException("caught a " + e2.getClass().getName(), this, e2); } Thread.currentThread().setContextClassLoader(cl); diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java index 0c78d4a8d2e4..3fde6704afad 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/StarReportDataFactory.java @@ -74,7 +74,7 @@ public class StarReportDataFactory implements ReportDataFactory, Cloneable { message = "Failed to query data"; } - throw new ReportDataFactoryException(message); + throw new ReportDataFactoryException(message, e); } } @@ -99,7 +99,7 @@ public class StarReportDataFactory implements ReportDataFactory, Cloneable } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Clone failed?"); + throw new IllegalStateException(e); } } diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java b/reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java index e0724596773e..8ba9231850cd 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/output/StyleUtilities.java @@ -242,7 +242,7 @@ public class StyleUtilities } catch (CloneNotSupportedException e) { - throw new ReportProcessingException("Failed to clone font-face element"); + throw new ReportProcessingException("Failed to clone font-face element", e); } } @@ -308,7 +308,7 @@ public class StyleUtilities } catch (CloneNotSupportedException e) { - throw new ReportProcessingException("Failed to copy style. This should not have happened."); + throw new ReportProcessingException("Failed to copy style. This should not have happened.", e); } } else diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java b/reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java index f45eca92a47f..0023856170c0 100644 --- a/reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java +++ b/reportbuilder/java/org/libreoffice/report/pentaho/output/text/TextRawReportTarget.java @@ -1263,7 +1263,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } catch (IOException ioe) { - throw new ReportProcessingException("Failed to write settings document"); + throw new ReportProcessingException("Failed to write settings document", ioe); } } |