summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-10-16 12:17:47 +0200
committerNoel Grandin <noel@peralex.com>2014-10-16 12:27:14 +0200
commitb2f69f626409442d1f0ca5049b946946ce9b01d8 (patch)
treefdd7bde284b00b3fbbc8ed62b8b35da6097bb281 /wizards
parent5cba8d44cabc3cbb18648efc9d8658d471b257e7 (diff)
java: when rethrowing, store the original exception
Change-Id: I14666493e72da177fcfff1895ef3206f0e13cc01
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.java3
-rw-r--r--wizards/com/sun/star/wizards/common/InvalidQueryException.java9
-rw-r--r--wizards/com/sun/star/wizards/common/NoValidPathException.java10
-rw-r--r--wizards/com/sun/star/wizards/common/NumericalHelper.java20
-rw-r--r--wizards/com/sun/star/wizards/common/Resource.java9
-rw-r--r--wizards/com/sun/star/wizards/common/SystemDialog.java3
-rw-r--r--wizards/com/sun/star/wizards/db/RecordParser.java3
-rw-r--r--wizards/com/sun/star/wizards/report/ReportLayouter.java3
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java2
9 files changed, 36 insertions, 26 deletions
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java
index 8e279668de62..6935c1f3e3c7 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.java
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -621,8 +621,7 @@ public class FileAccess
}
catch (com.sun.star.uno.Exception e)
{
- e.printStackTrace();
- throw new NoValidPathException(null, "Internal error.");
+ throw new NoValidPathException(null, "Internal error.", e);
}
for (int j = 0; j < FolderName.size(); j++)
diff --git a/wizards/com/sun/star/wizards/common/InvalidQueryException.java b/wizards/com/sun/star/wizards/common/InvalidQueryException.java
index a5e256c719d3..efe21aa68e26 100644
--- a/wizards/com/sun/star/wizards/common/InvalidQueryException.java
+++ b/wizards/com/sun/star/wizards/common/InvalidQueryException.java
@@ -21,10 +21,17 @@ import com.sun.star.lang.XMultiServiceFactory;
public class InvalidQueryException extends java.lang.Throwable
{
-// TODO don't show messages in Excetions
+ // TODO don't show messages in Exceptions
public InvalidQueryException(XMultiServiceFactory xMSF, String sCommand)
{
final int RID_REPORT = 2400;
SystemDialog.showErrorBox(xMSF, "ReportWizard", "dbw", RID_REPORT + 65, "<STATEMENT>", sCommand); // Querycreationnotpossible
}
+ // TODO don't show messages in Exceptions
+ public InvalidQueryException(XMultiServiceFactory xMSF, String sCommand, Throwable cause)
+ {
+ super(cause);
+ final int RID_REPORT = 2400;
+ SystemDialog.showErrorBox(xMSF, "ReportWizard", "dbw", RID_REPORT + 65, "<STATEMENT>", sCommand); // Querycreationnotpossible
+ }
}
diff --git a/wizards/com/sun/star/wizards/common/NoValidPathException.java b/wizards/com/sun/star/wizards/common/NoValidPathException.java
index f00be24997cf..074b8f52698d 100644
--- a/wizards/com/sun/star/wizards/common/NoValidPathException.java
+++ b/wizards/com/sun/star/wizards/common/NoValidPathException.java
@@ -31,4 +31,14 @@ public class NoValidPathException extends Exception
SystemDialog.showErrorBox(xMSF, "dbwizres", "dbw", 521); // OfficePathnotavailable
}
}
+
+ public NoValidPathException(XMultiServiceFactory xMSF, String _sText, Throwable cause)
+ {
+ super(_sText, cause);
+ // TODO: NEVER open a dialog in an exception
+ if (xMSF != null)
+ {
+ SystemDialog.showErrorBox(xMSF, "dbwizres", "dbw", 521); // OfficePathnotavailable
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java
index f460ec43278a..1d5e4833e040 100644
--- a/wizards/com/sun/star/wizards/common/NumericalHelper.java
+++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java
@@ -119,7 +119,7 @@ public class NumericalHelper
}
catch (java.lang.NumberFormatException e)
{
- throw new com.sun.star.lang.IllegalArgumentException(
+ throw new com.sun.star.lang.IllegalArgumentException(e,
"Cannot convert to byte: " + aTypeObject.aValue);
}
break;
@@ -181,7 +181,7 @@ public class NumericalHelper
}
catch (java.lang.NumberFormatException e)
{
- throw new com.sun.star.lang.IllegalArgumentException(
+ throw new com.sun.star.lang.IllegalArgumentException(e,
"Cannot convert to char: " + aTypeObject.aValue);
}
break;
@@ -234,7 +234,7 @@ public class NumericalHelper
}
catch (java.lang.NumberFormatException e)
{
- throw new com.sun.star.lang.IllegalArgumentException(
+ throw new com.sun.star.lang.IllegalArgumentException(e,
"Cannot convert to short: " + aTypeObject.aValue);
}
break;
@@ -423,7 +423,7 @@ public class NumericalHelper
}
catch (java.lang.NumberFormatException e)
{
- throw new com.sun.star.lang.IllegalArgumentException(
+ throw new com.sun.star.lang.IllegalArgumentException(e,
"Cannot convert to int: " + aTypeObject.aValue);
}
break;
@@ -476,7 +476,7 @@ public class NumericalHelper
}
catch (java.lang.NumberFormatException e)
{
- throw new com.sun.star.lang.IllegalArgumentException(
+ throw new com.sun.star.lang.IllegalArgumentException(e,
"Cannot convert to short: " + aTypeObject.aValue);
}
break;
@@ -529,7 +529,7 @@ public class NumericalHelper
}
catch (java.lang.NumberFormatException e)
{
- throw new com.sun.star.lang.IllegalArgumentException(
+ throw new com.sun.star.lang.IllegalArgumentException(e,
"Cannot convert to short: " + aTypeObject.aValue);
}
break;
@@ -582,7 +582,7 @@ public class NumericalHelper
}
catch (java.lang.NumberFormatException e)
{
- throw new com.sun.star.lang.IllegalArgumentException(
+ throw new com.sun.star.lang.IllegalArgumentException(e,
"Cannot convert to short: " + aTypeObject.aValue);
}
break;
@@ -683,7 +683,7 @@ public class NumericalHelper
}
catch (java.lang.NumberFormatException e)
{
- throw new com.sun.star.lang.IllegalArgumentException(
+ throw new com.sun.star.lang.IllegalArgumentException(e,
"Cannot convert to short: " + aTypeObject.aValue);
}
break;
@@ -1314,8 +1314,8 @@ public class NumericalHelper
catch (java.lang.ClassCastException e)
{
// unknown type cannot be converted
- throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert unknown type: '" + e.getMessage() + "'");
+ throw new com.sun.star.lang.IllegalArgumentException(e,
+ "Cannot convert unknown type " +array.getClass());
}
}
return aShortVal;
diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java
index 0ea3f5dd3de7..9f8f6da67f76 100644
--- a/wizards/com/sun/star/wizards/common/Resource.java
+++ b/wizards/com/sun/star/wizards/common/Resource.java
@@ -79,8 +79,7 @@ public class Resource
}
catch (Exception exception)
{
- exception.printStackTrace();
- throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found");
+ throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found", exception);
}
}
@@ -92,8 +91,7 @@ public class Resource
}
catch (Exception exception)
{
- exception.printStackTrace();
- throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found");
+ throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found", exception);
}
}
@@ -110,8 +108,7 @@ public class Resource
}
catch (Exception exception)
{
- exception.printStackTrace(System.err);
- throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found");
+ throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found", exception);
}
}
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java
index 0349954d556a..62ebeb5bffde 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.java
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.java
@@ -153,8 +153,7 @@ public class SystemDialog
}
catch (com.sun.star.lang.IllegalArgumentException iae)
{
- iae.printStackTrace();
- throw new IllegalArgumentException(iae.getMessage());
+ throw new IllegalArgumentException(iae);
}
xFolderPicker.setTitle(title);
xFolderPicker.setDescription(description);
diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java
index 3bc754fff8a9..d8acade3eaae 100644
--- a/wizards/com/sun/star/wizards/db/RecordParser.java
+++ b/wizards/com/sun/star/wizards/db/RecordParser.java
@@ -221,8 +221,7 @@ public class RecordParser extends QueryMetaData
}
catch (Exception exception)
{
- exception.printStackTrace(System.err);
- throw new InvalidQueryException(xMSF, Command);
+ throw new InvalidQueryException(xMSF, Command, exception);
}
}
diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java
index 022e96de2082..953e532c4e81 100644
--- a/wizards/com/sun/star/wizards/report/ReportLayouter.java
+++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java
@@ -420,8 +420,7 @@ public class ReportLayouter
}
catch (Exception ex)
{
- ex.printStackTrace();
- throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
+ throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed", ex);
}
}
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
index 2315ea5bead9..02548d0c7bc6 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
@@ -276,7 +276,7 @@ public class DesignTemplate
{
// this should not happen
a = null;
- throw new java.lang.RuntimeException(e.getMessage());
+ throw new java.lang.RuntimeException(e);
}
catch (com.sun.star.uno.Exception e)
{