FAQ
Repository: ant
Updated Branches:
   refs/heads/master c03b8a506 -> eb4cd6385


and fix the array-based join method as well


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/eb4cd638
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/eb4cd638
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/eb4cd638

Branch: refs/heads/master
Commit: eb4cd638508027846de00dcf5a3c095c9701c3ef
Parents: c03b8a5
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Mon May 16 12:05:17 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Mon May 16 12:05:17 2016 +0200

----------------------------------------------------------------------
  src/main/org/apache/tools/ant/util/StringUtils.java | 3 +++
  .../junit/org/apache/tools/ant/util/StringUtilsTest.java | 7 ++++++-
  2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/eb4cd638/src/main/org/apache/tools/ant/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/StringUtils.java b/src/main/org/apache/tools/ant/util/StringUtils.java
index be2fe0b..d225bfd 100644
--- a/src/main/org/apache/tools/ant/util/StringUtils.java
+++ b/src/main/org/apache/tools/ant/util/StringUtils.java
@@ -297,6 +297,9 @@ public final class StringUtils {
       * @return the joined string
       */
      public static String join(Object[] array, CharSequence separator) {
+ if (array == null) {
+ return "";
+ }
       return join(Arrays.asList(array), separator);
      }


http://git-wip-us.apache.org/repos/asf/ant/blob/eb4cd638/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
index 81ea3c6..8f58cc8 100644
--- a/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
@@ -182,11 +182,16 @@ public class StringUtilsTest {
      }

      @Test
- public void testJoinNullArray() {
+ public void testJoinNullCollection() {
       assertEquals("", StringUtils.join((Collection<String>)null, ", "));
      }

      @Test
+ public void testJoinNullArray() {
+ assertEquals("", StringUtils.join((String[])null, ", "));
+ }
+
+ @Test
      public void testJoinNullSeparator() {
       assertEquals("abc", StringUtils.join(Arrays.asList("a", "b", "c"), null));
      }

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupnotifications @
categoriesant
postedMay 16, '16 at 10:05a
activeMay 16, '16 at 10:05a
posts1
users1
websiteant.apache.org

1 user in discussion

Bodewig: 1 post

People

Translate

site design / logo © 2017 Grokbase