You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "kinow (via GitHub)" <gi...@apache.org> on 2023/06/26 19:01:34 UTC

[GitHub] [commons-text] kinow commented on a diff in pull request #434: added null-check to avoid NullPointerException

kinow commented on code in PR #434:
URL: https://github.com/apache/commons-text/pull/434#discussion_r1242635013


##########
src/main/java/org/apache/commons/text/RandomStringGenerator.java:
##########
@@ -183,9 +183,11 @@ public Builder filteredBy(final CharacterPredicate... predicates) {
          * @since 1.2
          */
         public Builder selectFrom(final char... chars) {
-            characterList = new ArrayList<>();
-            for (final char c : chars) {
-                characterList.add(c);
+            if(chars != null) {

Review Comment:
   Checkstyle issues in the PR (you can run `mvn` locally and that should do the same as GH Actions).
   
   ```bash
    Error:  src/main/java/org/apache/commons/text/RandomStringGenerator.java:[244,13] (whitespace) WhitespaceAfter: 'if' is not followed by whitespace.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org