[jira] Created: (CONFIGURATION-422) Configuration.getInt() should define its accepted inputs, and should also accept octal

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (CONFIGURATION-422) Configuration.getInt() should define its accepted inputs, and should also accept octal

JIRA jira@apache.org
Configuration.getInt() should define its accepted inputs, and should also accept octal
--------------------------------------------------------------------------------------

                 Key: CONFIGURATION-422
                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-422
             Project: Commons Configuration
          Issue Type: Improvement
          Components: Type conversion
            Reporter: david cogen
            Priority: Minor


I can find no information about the format of the string that Configuration.getInt(String) accepts. I have determined by experimentation and examining the source that it accepts decimal integers, and hex integers if preceeded by "0x". This should be explained.

Also, it is customary for functions which accept decimal and hex to also accept octal. A string with leading "0" should be parsed as octal.

This should apply to getByte(), getShort(), and getLong() as well.

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CONFIGURATION-422) Configuration.getInt() should define its accepted inputs, and should also accept octal

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/CONFIGURATION-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878933#action_12878933 ]

Sebb commented on CONFIGURATION-422:
------------------------------------

0x seems reasonable.

However allowing a 0-prefix to mean octal could break some existing code that relies on leading zeros being ignored.

> Configuration.getInt() should define its accepted inputs, and should also accept octal
> --------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-422
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-422
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: Type conversion
>            Reporter: david cogen
>            Priority: Minor
>
> I can find no information about the format of the string that Configuration.getInt(String) accepts. I have determined by experimentation and examining the source that it accepts decimal integers, and hex integers if preceeded by "0x". This should be explained.
> Also, it is customary for functions which accept decimal and hex to also accept octal. A string with leading "0" should be parsed as octal.
> This should apply to getByte(), getShort(), and getLong() as well.

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CONFIGURATION-422) Configuration.getInt() should define its accepted inputs, and should also accept octal

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/CONFIGURATION-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878934#action_12878934 ]

Emmanuel Bourg commented on CONFIGURATION-422:
----------------------------------------------

I'm not sure supporting octal values is a good idea. If people have padded their integer values with 0 this will break their configurations.

However it might be interesting to support the updated number syntax to come in Java 7 (binary literals and underscores in numbers)

http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000929.html
http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/001208.html


> Configuration.getInt() should define its accepted inputs, and should also accept octal
> --------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-422
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-422
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: Type conversion
>            Reporter: david cogen
>            Priority: Minor
>
> I can find no information about the format of the string that Configuration.getInt(String) accepts. I have determined by experimentation and examining the source that it accepts decimal integers, and hex integers if preceeded by "0x". This should be explained.
> Also, it is customary for functions which accept decimal and hex to also accept octal. A string with leading "0" should be parsed as octal.
> This should apply to getByte(), getShort(), and getLong() as well.

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