commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [1/2] [text] adding validation for pair (closes #66)
Date Mon, 02 Oct 2017 10:22:21 GMT
Repository: commons-text
Updated Branches:
  refs/heads/master da61665e2 -> c0d4830ea


adding validation for pair (closes #66)


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/339566bb
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/339566bb
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/339566bb

Branch: refs/heads/master
Commit: 339566bbc2e7f45fad9cffb52e8049241e63ac45
Parents: da61665
Author: Amey Jadiye <ameyjadiye@gmail.com>
Authored: Sat Sep 30 14:57:48 2017 +0530
Committer: Pascal Schumacher <pascalschumacher@gmx.net>
Committed: Mon Oct 2 12:20:41 2017 +0200

----------------------------------------------------------------------
 src/main/java/org/apache/commons/text/RandomStringGenerator.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/339566bb/src/main/java/org/apache/commons/text/RandomStringGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/RandomStringGenerator.java b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
index d8892fc..02af0d4 100644
--- a/src/main/java/org/apache/commons/text/RandomStringGenerator.java
+++ b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
@@ -341,8 +341,10 @@ public final class RandomStringGenerator {
          * @return {@code this}, to allow method chaining.
          */
         public Builder withinRange(final char[] ... pairs) {
-            characterList = new ArrayList<>();
+            characterList = new ArrayList<Character>();
             for (final char[] pair :  pairs) {
+                Validate.isTrue(pair.length == 2,
+                      "Each pair must contain minimum and maximum code point");
                 final int minimumCodePoint = pair[0];
                 final int maximumCodePoint = pair[1];
                 Validate.isTrue(minimumCodePoint <= maximumCodePoint,


Mime
View raw message