You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Artem Sakhnov (JIRA)" <ji...@apache.org> on 2008/04/24 12:29:21 UTC

[jira] Created: (LANG-428) StringUtils.isNumeric

StringUtils.isNumeric
---------------------

                 Key: LANG-428
                 URL: https://issues.apache.org/jira/browse/LANG-428
             Project: Commons Lang
          Issue Type: Bug
    Affects Versions: 2.3
            Reporter: Artem Sakhnov
            Priority: Minor


StringUtils.isNumeric.
if we put empty string as parameter we got true.
StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (LANG-428) StringUtils.isNumeric

Posted by "James Carman (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Carman resolved LANG-428.
-------------------------------

    Resolution: Invalid

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "Artem Sakhnov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592081#action_12592081 ] 

Artem Sakhnov commented on LANG-428:
------------------------------------

just put there 1 more condition for empty string )))) thats be nice.

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "James Carman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592067#action_12592067 ] 

James Carman commented on LANG-428:
-----------------------------------

Yes, the javadocs specifically mention the empty string case.  So, it is desired behavior (or at least was when the author wrote it).  

Also, there could be code out there that depends on this behavior.  Changing it now would be a regression bug.

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "Artem Sakhnov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592091#action_12592091 ] 

Artem Sakhnov commented on LANG-428:
------------------------------------

ok

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LANG-428) StringUtils.isNumeric

Posted by "Artem Sakhnov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Artem Sakhnov closed LANG-428.
------------------------------


closing, but ill rewrite it for myself, because empty string is not numeric :) cya

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "James Carman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592079#action_12592079 ] 

James Carman commented on LANG-428:
-----------------------------------

Maybe the method could be better named isNotNonNumeric()?  :)


> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LANG-428) StringUtils.isNumeric

Posted by "James Carman (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Carman closed LANG-428.
-----------------------------


> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592120#action_12592120 ] 

Matt Benson commented on LANG-428:
----------------------------------

Actually given that the behavior is documented I would argue that the truly correct resolution would have been INVALID.  But I don't feel strongly enough about it to reopen and re-resolve the issue.

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "Artem Sakhnov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592059#action_12592059 ] 

Artem Sakhnov commented on LANG-428:
------------------------------------

but later in javadoc says

Returns:
    true if only contains digits, and is non-null

so, you shure we can close it?

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "James Carman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592055#action_12592055 ] 

James Carman commented on LANG-428:
-----------------------------------

The javadocs specifically state that 

{panel}
An empty String ("") will return true.
{panel}

So, I think we should close this one.  This is desired behavior apparently.

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "Simon Kitching (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592086#action_12592086 ] 

Simon Kitching commented on LANG-428:
-------------------------------------

The existing behaviour is consistent with the other methods. 
And as James notes, any change would break existing code.

So IMO, WONTFIX is the correct resolution. Sorry Artem but backwards compatibility and consistency are very important in widely-used libs like commons-lang.

I guess that a new method, isNumericValue(String) could be added to implement the requested behaviour. But I'm not sure it is worth it.


> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (LANG-428) StringUtils.isNumeric

Posted by "James Carman (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Carman resolved LANG-428.
-------------------------------

    Resolution: Won't Fix
      Assignee: James Carman

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (LANG-428) StringUtils.isNumeric

Posted by "James Carman (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Carman reopened LANG-428:
-------------------------------


> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "Artem Sakhnov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592078#action_12592078 ] 

Artem Sakhnov commented on LANG-428:
------------------------------------

> If you want to ensure that the String is non-empty, use StringUtils.isNotEmpty().
thats ok

but i need to check GET parameter. and i dont want put it in 2 conditions, i just want call  StringUtils.isNumeric(myGetParameter) and get valid answer. 

so my 	opinion, StringUtils.isNumerric("") should return false. if it so, then we dont need additionall conditions for result 	approve

> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-428) StringUtils.isNumeric

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592072#action_12592072 ] 

Sebb commented on LANG-428:
---------------------------

Note that null is different from the empty string.

Most of the isType() methods in this class work the same way: after checking for null, they check to make sure there are no illegal characters in the String.

An empty String has no characters, so cannot contain an illegal character.

If you want to ensure that the String is non-empty, use StringUtils.isNotEmpty().


> StringUtils.isNumeric
> ---------------------
>
>                 Key: LANG-428
>                 URL: https://issues.apache.org/jira/browse/LANG-428
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Artem Sakhnov
>            Assignee: James Carman
>            Priority: Minor
>
> StringUtils.isNumeric.
> if we put empty string as parameter we got true.
> StringUtils.isNumeric("") return true.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.