diff --git a/src/main/java/org/apache/commons/math/exception/MathArithmeticException.java b/src/main/java/org/apache/commons/math/exception/MathArithmeticException.java index bf692c7bb..4439c169a 100644 --- a/src/main/java/org/apache/commons/math/exception/MathArithmeticException.java +++ b/src/main/java/org/apache/commons/math/exception/MathArithmeticException.java @@ -61,6 +61,11 @@ public class MathArithmeticException extends ArithmeticException return context; } + /** {@inheritDoc} */ + public Throwable getException() { + return this; + } + /** {@inheritDoc} */ @Override public String getMessage() { diff --git a/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java b/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java index 4c7b71667..7608896a4 100644 --- a/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java +++ b/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java @@ -50,6 +50,11 @@ public class MathIllegalArgumentException extends IllegalArgumentException return context; } + /** {@inheritDoc} */ + public Throwable getException() { + return this; + } + /** {@inheritDoc} */ @Override public String getMessage() { diff --git a/src/main/java/org/apache/commons/math/exception/MathIllegalStateException.java b/src/main/java/org/apache/commons/math/exception/MathIllegalStateException.java index 3fd3ce235..15916ebce 100644 --- a/src/main/java/org/apache/commons/math/exception/MathIllegalStateException.java +++ b/src/main/java/org/apache/commons/math/exception/MathIllegalStateException.java @@ -72,6 +72,11 @@ public class MathIllegalStateException extends IllegalStateException return context; } + /** {@inheritDoc} */ + public Throwable getException() { + return this; + } + /** {@inheritDoc} */ @Override public String getMessage() { diff --git a/src/main/java/org/apache/commons/math/exception/MathUnsupportedOperationException.java b/src/main/java/org/apache/commons/math/exception/MathUnsupportedOperationException.java index f1a5d8594..2b0a70aaa 100644 --- a/src/main/java/org/apache/commons/math/exception/MathUnsupportedOperationException.java +++ b/src/main/java/org/apache/commons/math/exception/MathUnsupportedOperationException.java @@ -58,6 +58,11 @@ public class MathUnsupportedOperationException extends UnsupportedOperationExcep return context; } + /** {@inheritDoc} */ + public Throwable getException() { + return this; + } + /** {@inheritDoc} */ @Override public String getMessage() { diff --git a/src/main/java/org/apache/commons/math/exception/MathUserException.java b/src/main/java/org/apache/commons/math/exception/MathUserException.java index 31b179a89..44c4da506 100644 --- a/src/main/java/org/apache/commons/math/exception/MathUserException.java +++ b/src/main/java/org/apache/commons/math/exception/MathUserException.java @@ -85,6 +85,11 @@ public class MathUserException extends RuntimeException return context; } + /** {@inheritDoc} */ + public Throwable getException() { + return this; + } + /** {@inheritDoc} */ @Override public String getMessage() { diff --git a/src/main/java/org/apache/commons/math/exception/util/ExceptionContextProvider.java b/src/main/java/org/apache/commons/math/exception/util/ExceptionContextProvider.java index ef5944b0f..ae643f57c 100644 --- a/src/main/java/org/apache/commons/math/exception/util/ExceptionContextProvider.java +++ b/src/main/java/org/apache/commons/math/exception/util/ExceptionContextProvider.java @@ -30,4 +30,10 @@ public interface ExceptionContextProvider { * @return a reference to the exception context. */ ExceptionContext getContext(); + + /** Get a reference to the exception to which the context relates. + * @return a reference to the exception to which the context relates + */ + Throwable getException(); + } diff --git a/src/site/xdoc/changes.xml b/src/site/xdoc/changes.xml index 9b1dcb59a..5bd7c6f8d 100644 --- a/src/site/xdoc/changes.xml +++ b/src/site/xdoc/changes.xml @@ -52,6 +52,10 @@ The type attribute can be add,update,fix,remove. If the output is not quite correct, check for invisible trailing spaces! --> + + Added a getter to allow retrieving the exception related to an exception context + provider. + Added erf(double,double) to Erf and used this to improve tail probability accuracy in NormalDistributionImpl.