[
https://issues.apache.org/jira/browse/LANG-1527?focusedWorklogId=403277&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-403277
]
ASF GitHub Bot logged work on LANG-1527:
----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Mar/20 23:43
Start Date: 13/Mar/20 23:43
Worklog Time Spent: 10m
Work Description: Prodigysov commented on pull request #504: LANG-1527:
Remove an redundant argument check in NumberUtils
URL: https://github.com/apache/commons-lang/pull/504
See [JIRA issue
LANG-1527](https://issues.apache.org/jira/projects/LANG/issues/LANG-1527).
----------------------------------------------------------------
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: 403277)
Remaining Estimate: 0h
Time Spent: 10m
> NumberUtils.createBigDecimal has a redundant argument check
> -----------------------------------------------------------
>
> Key: LANG-1527
> URL: https://issues.apache.org/jira/browse/LANG-1527
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.math.*
> Reporter: Pengyu Nie
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> NumberUtils.createBigDecimal(String) has an argument check
> `str.trim().startsWith("--")`, which was added almost 20 years ago to
> handle a bug in JDK at that time. The corresponding check is already
> in place in nowadays' JDK and this check is redundant.
> {code:java}
> public static BigDecimal createBigDecimal(final String str) {
> if (str == null) {
> return null;
> }
> // handle JDK1.3.1 bug where "" throws IndexOutOfBoundsException
> if (StringUtils.isBlank(str)) {
> throw new NumberFormatException("A blank string is not a valid
> number");
> }
> if (str.trim().startsWith("--")) {
> // this is protection for poorness in java.lang.BigDecimal.
> // it accepts this as a legal value, but it does not appear
> // to be in specification of class. OS X Java parses it to
> // a wrong value.
> throw new NumberFormatException(str + " is not a valid number.");
> }
> return new BigDecimal(str);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)