From 2aaf152da1961a643c99d7ce60f82ff372929cd8 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 18 Sep 2000 15:38:38 +0000 Subject: [PATCH] Only set location in BuildException if the task didn't provide it before. This will give the correct location for errors in build files invoked via the task. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268007 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/Target.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/Target.java b/src/main/org/apache/tools/ant/Target.java index 4d8c9ecf3..92a635111 100644 --- a/src/main/org/apache/tools/ant/Target.java +++ b/src/main/org/apache/tools/ant/Target.java @@ -144,7 +144,10 @@ public class Target { } catch(RuntimeException exc) { if (exc instanceof BuildException) { - ((BuildException)exc).setLocation(task.getLocation()); + BuildException be = (BuildException) exc; + if (be.getLocation() == Location.UNKNOWN_LOCATION) { + be.setLocation(task.getLocation()); + } } project.fireTaskFinished(task, exc); throw exc;