summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Benson <mbenson@apache.org>2022-02-09 19:05:33 -0600
committerMatt Benson <mbenson@apache.org>2022-02-09 19:05:33 -0600
commit71f44247d449f7f3fa2928e8de76e3107f6497f5 (patch)
treee6c1cfa67e6f3a87473e0cac26261eebd5459ec5 /src
parent97cc23ef8b10cd514c808ab4d920034ab6301fad (diff)
downloadant-71f44247d449f7f3fa2928e8de76e3107f6497f5.tar.gz
add static BuildException factory method
Diffstat (limited to 'src')
-rw-r--r--src/main/org/apache/tools/ant/BuildException.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/org/apache/tools/ant/BuildException.java b/src/main/org/apache/tools/ant/BuildException.java
index 6dc2c12f9..996043a63 100644
--- a/src/main/org/apache/tools/ant/BuildException.java
+++ b/src/main/org/apache/tools/ant/BuildException.java
@@ -24,6 +24,18 @@ public class BuildException extends RuntimeException {
private static final long serialVersionUID = -5419014565354664240L;
+ /**
+ * Get a {@link BuildException} for the specified {@link Throwable}.
+ * @param t
+ * @return {@link BuildException}
+ */
+ public static BuildException of(Throwable t) {
+ if (t instanceof BuildException) {
+ return (BuildException) t;
+ }
+ return new BuildException(t);
+ }
+
/** Location in the build file where the exception occurred */
private Location location = Location.UNKNOWN_LOCATION;