From 4d7bc0e158af463ab6d54f9ab35a01a5e011a831 Mon Sep 17 00:00:00 2001 From: Antoine Levy-Lambert Date: Sat, 20 Feb 2010 23:57:59 +0000 Subject: [PATCH] fix getClassLocation method in Diagnostics class. Bug 48782. Reported by Torsten Werner. Patch by Ludovic Claude. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@912258 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ src/main/org/apache/tools/ant/Diagnostics.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/WHATSNEW b/WHATSNEW index 317f1aeb9..c779be6a7 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -29,6 +29,9 @@ Fixed bugs: * VectorSet#remove(Object) would fail if the size of the vector equaled its capacity. + + * Regression : ant -diagnostics was returning with exit code 1 + Bugzilla Report 48782 Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/Diagnostics.java b/src/main/org/apache/tools/ant/Diagnostics.java index 35ef35f5d..72cd8aed3 100644 --- a/src/main/org/apache/tools/ant/Diagnostics.java +++ b/src/main/org/apache/tools/ant/Diagnostics.java @@ -180,6 +180,9 @@ public final class Diagnostics { * @since Ant 1.8.0 */ private static URL getClassLocation(Class clazz) { + if (clazz.getProtectionDomain().getCodeSource() == null) { + return null; + } return clazz.getProtectionDomain().getCodeSource().getLocation(); }