From e5fc96441182522c7e0c8d37921f8e0b14a85cad Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Tue, 24 Feb 2004 14:05:16 +0000 Subject: [PATCH] Throw build exception if name attribute is missing in a patternset PR: 25982 Obtained from: Jose Alberto Fernandez git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276149 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 2 ++ src/main/org/apache/tools/ant/types/PatternSet.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index 3b8a0fa3e..c54921b53 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -50,6 +50,8 @@ Fixed bugs: * MacroDef did not allow attributes named 'description'. Bugzilla Report 27175. +* Throw build exception if name attribute missing from patternset. Bugzill Report 25982. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/types/PatternSet.java b/src/main/org/apache/tools/ant/types/PatternSet.java index 0bb83bc92..2e9d4013a 100644 --- a/src/main/org/apache/tools/ant/types/PatternSet.java +++ b/src/main/org/apache/tools/ant/types/PatternSet.java @@ -122,7 +122,11 @@ public class PatternSet extends DataType implements Cloneable { * @return a printable form of this object. */ public String toString() { - StringBuffer buf = new StringBuffer(name != null ? name : ""); + if (name == null) { + throw new BuildException( + "Missing attribute \"name\" for a pattern"); + } + StringBuffer buf = new StringBuffer(name); if ((ifCond != null) || (unlessCond != null)) { buf.append(":"); String connector = "";