[
https://issues.apache.org/jira/browse/LANG-1533?focusedWorklogId=514491&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-514491
]
ASF GitHub Bot logged work on LANG-1533:
----------------------------------------
Author: ASF GitHub Bot
Created on: 20/Nov/20 07:20
Start Date: 20/Nov/20 07:20
Worklog Time Spent: 10m
Work Description: coveralls commented on pull request #654:
URL: https://github.com/apache/commons-lang/pull/654#issuecomment-730957182
[](https://coveralls.io/builds/35115597)
Coverage remained the same at 94.989% when pulling
**40bf72ab047b47332d81b1c2b60c9fbb3a9ff9a6 on arturobernalg:feature/LANG-1533**
into **f2480a984fec5aaf354b4d179f51bd902ad3e0cc on apache:master**.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 514491)
Time Spent: 20m (was: 10m)
> RandomStringUtils.random() should not include \u0000
> -----------------------------------------------------
>
> Key: LANG-1533
> URL: https://issues.apache.org/jira/browse/LANG-1533
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.*
> Affects Versions: 3.8.1
> Reporter: Daniel Vega
> Priority: Minor
> Attachments: 0001-xxx.patch
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> When generating random strings we should not include char 0x00 by default.
> This is problematic for many tools and libraries. For example, if we try to
> save this value in a PosgreSQL database we'll get:
>
> {quote}PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00
> {quote}
>
> Currently we are avoiding some code code-point ranges. We should also skip
> {{codePoint=0}}
> {code:none}
> --- a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
> +++ b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
> @@ -400,6 +400,12 @@ public static String random(int count, int start, int
> end, final boolean letters
> if (chars == null) {
> codePoint = random.nextInt(gap) + start;
>
> + // Skip codePoint \u0000 because is problematic for some
> tools/libraries
> + if (codePoint==0) {
> + count++;
> + continue;
> + }
> +
> switch (Character.getType(codePoint)) {
> case Character.UNASSIGNED:
> case Character.PRIVATE_USE:
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)