[jira] Created: (LANG-365) BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException

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

[jira] Created: (LANG-365) BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException

JIRA jira@apache.org
BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException
-----------------------------------------------------------------------------------------------------

                 Key: LANG-365
                 URL: https://issues.apache.org/jira/browse/LANG-365
             Project: Commons Lang
          Issue Type: Bug
            Reporter: Sebb


The method BooleanUtils.toBoolean() has a case statement; case 3 drops through to case 4; this can cause StringIndexOutOfBoundsException, for example with the test:

assertEquals(false, BooleanUtils.toBoolean("tru"));

The end of case 3 should return false.

Patch to follow for source and unit test.

--
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] Updated: (LANG-365) BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/LANG-365?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated LANG-365:
----------------------

    Attachment: BooleanUtilsTest.patch

Update Unit test to expose bug

> BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-365
>                 URL: https://issues.apache.org/jira/browse/LANG-365
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: BooleanUtilsTest.patch
>
>
> The method BooleanUtils.toBoolean() has a case statement; case 3 drops through to case 4; this can cause StringIndexOutOfBoundsException, for example with the test:
> assertEquals(false, BooleanUtils.toBoolean("tru"));
> The end of case 3 should return false.
> Patch to follow for source and unit test.

--
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] Updated: (LANG-365) BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException

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

     [ https://issues.apache.org/jira/browse/LANG-365?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated LANG-365:
----------------------

    Attachment: BooleanUtils.patch

Patch to fix bug

> BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-365
>                 URL: https://issues.apache.org/jira/browse/LANG-365
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: BooleanUtils.patch, BooleanUtilsTest.patch
>
>
> The method BooleanUtils.toBoolean() has a case statement; case 3 drops through to case 4; this can cause StringIndexOutOfBoundsException, for example with the test:
> assertEquals(false, BooleanUtils.toBoolean("tru"));
> The end of case 3 should return false.
> Patch to follow for source and unit test.

--
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] Closed: (LANG-365) BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException

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

     [ https://issues.apache.org/jira/browse/LANG-365?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed LANG-365.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4

svn ci -m "Applying Sebb's test and fix for LANG-365" src
Sending        src/java/org/apache/commons/lang/BooleanUtils.java
Sending        src/test/org/apache/commons/lang/BooleanUtilsTest.java
Transmitting file data ..
Committed revision 589050.

> BooleanUtils.toBoolean() - invalid drop-thru in case statement causes StringIndexOutOfBoundsException
> -----------------------------------------------------------------------------------------------------
>
>                 Key: LANG-365
>                 URL: https://issues.apache.org/jira/browse/LANG-365
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 2.4
>
>         Attachments: BooleanUtils.patch, BooleanUtilsTest.patch
>
>
> The method BooleanUtils.toBoolean() has a case statement; case 3 drops through to case 4; this can cause StringIndexOutOfBoundsException, for example with the test:
> assertEquals(false, BooleanUtils.toBoolean("tru"));
> The end of case 3 should return false.
> Patch to follow for source and unit test.

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