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 = "";