From abaeb8910396286ff6d53290a8062d540583ece0 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 9 Apr 2003 15:37:57 +0000 Subject: [PATCH] Don't die on empty values. PR: 18625 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274424 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ src/main/org/apache/tools/ant/filters/ReplaceTokens.java | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index c6372a369..5697cded6 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -90,6 +90,9 @@ Fixed bugs: * and didn't honor the defaultexcludes attribute for the implicit fileset. Bugzilla Report 18637. +* The filter would throw an exception if the token's + value was an empty string. Bugzilla Report 18625. + Other changes: -------------- * Shipped XML parser is now Xerces 2.4.0 diff --git a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java b/src/main/org/apache/tools/ant/filters/ReplaceTokens.java index 92c547e37..1a3dc8126 100644 --- a/src/main/org/apache/tools/ant/filters/ReplaceTokens.java +++ b/src/main/org/apache/tools/ant/filters/ReplaceTokens.java @@ -190,8 +190,10 @@ public final class ReplaceTokens final String replaceWith = (String) hash.get(key.toString()); if (replaceWith != null) { - replaceData = replaceWith; - replaceIndex = 0; + if (replaceWith.length() > 0) { + replaceData = replaceWith; + replaceIndex = 0; + } return read(); } else { String newData = key.toString() + endToken;