Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 752AC200B90 for ; Sun, 11 Sep 2016 02:25:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 73B78160AD2; Sun, 11 Sep 2016 00:25:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BA4AD160ABE for ; Sun, 11 Sep 2016 02:25:21 +0200 (CEST) Received: (qmail 22198 invoked by uid 500); 11 Sep 2016 00:25:20 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 22187 invoked by uid 99); 11 Sep 2016 00:25:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Sep 2016 00:25:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 8F9562C1B7B for ; Sun, 11 Sep 2016 00:25:20 +0000 (UTC) Date: Sun, 11 Sep 2016 00:25:20 +0000 (UTC) From: "Rob Tompkins (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1252) NumberUtils.isNumber and NumberUtils.createNumber resolve inconsistently MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 11 Sep 2016 00:25:22 -0000 [ https://issues.apache.org/jira/browse/LANG-1252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15480705#comment-15480705 ] Rob Tompkins commented on LANG-1252: ------------------------------------ In Java 1.6 {code} NumberUtils.createNumber("+2"); {code} throws the following exception {code} java.lang.NumberFormatException: For input string: "+2" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:449) at java.math.BigInteger.(BigInteger.java:316) at org.apache.commons.lang3.math.NumberUtils.createBigInteger(NumberUtils.java:769) at org.apache.commons.lang3.math.NumberUtils.createNumber(NumberUtils.java:593) {code} In Java 1.7 the call succeeds. > NumberUtils.isNumber and NumberUtils.createNumber resolve inconsistently > ------------------------------------------------------------------------ > > Key: LANG-1252 > URL: https://issues.apache.org/jira/browse/LANG-1252 > Project: Commons Lang > Issue Type: Bug > Components: lang.math.* > Affects Versions: 3.4 > Reporter: Rob Tompkins > Assignee: Rob Tompkins > Fix For: Discussion > > > In considering the issues LANG-1060, LANG-1040, LANG-1038, and LANG-992, it seems that there are times when {{NumberUtils.isNumber}} resolves to {{false}} while {{NumberUtils.createNumber}}, given the same input, does not throw an exception, returning a valid {{java.lang.Number}}. This inconsistency should be resolved either by making {{isNumber}} more lenient or {{createNumber}} more stringent. -- This message was sent by Atlassian JIRA (v6.3.4#6332)