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


make StingUtils#join do what its tests expect


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

Branch: refs/heads/master
Commit: c03b8a506f20e65892ed6892fb43de1aeec02f69
Parents: 24f3afe
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Mon May 16 12:02:03 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Mon May 16 12:02:03 2016 +0200

----------------------------------------------------------------------
  src/main/org/apache/tools/ant/util/StringUtils.java | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/c03b8a50/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 fc2fb46..be2fe0b 100644
--- a/src/main/org/apache/tools/ant/util/StringUtils.java
+++ b/src/main/org/apache/tools/ant/util/StringUtils.java
@@ -22,6 +22,7 @@ import java.io.StringWriter;
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.Vector;
+import java.util.stream.Collector;
  import java.util.stream.Collectors;

  import org.apache.tools.ant.BuildException;
@@ -282,7 +283,10 @@ public final class StringUtils {
       * @return the joined string
       */
      public static String join(Collection<?> collection, CharSequence separator) {
- return collection.stream().map( o -> String.valueOf(o) ).collect(Collectors.joining(separator));
+ if (collection == null) {
+ return "";
+ }
+ return collection.stream().map( o -> String.valueOf(o) ).collect(joining(separator));
      }

      /**
@@ -295,4 +299,8 @@ public final class StringUtils {
      public static String join(Object[] array, CharSequence separator) {
       return join(Arrays.asList(array), separator);
      }
+
+ private static Collector<CharSequence,?,String> joining(CharSequence separator) {
+ return separator == null ? Collectors.joining() : Collectors.joining(separator);
+ }
  }

Search Discussions

Related Discussions

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

1 user in discussion

Bodewig: 1 post

People

Translate

site design / logo © 2017 Grokbase