You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by rikles <gi...@git.apache.org> on 2015/06/12 10:25:02 UTC

[GitHub] commons-lang pull request: LANG-1147 : Fix EnumUtils *BitVector is...

GitHub user rikles opened a pull request:

    https://github.com/apache/commons-lang/pull/97

    LANG-1147 : Fix EnumUtils *BitVector issue with more than 32 values Enums

    In `EnumUtils` all _BitVector_ related methods fail in handling Enum with more than 32 values.
    This is due to a implicit `int` -> `long` conversion in generating the Enum value `long` mask.
    
    ```java
    // Bad code : here `1` is an `int` value so the `<<` operation is done into an `int` context and then, the result is converted to a `long` value
    long mask = 1 << 32;    // -> mask = 1 and not 4294967296 (0x100000000)
    
    // Good code : here `1L` is a `long` value so the `<<` operation is done into an `long` context
    long mask = 1L << 32;    // -> mask = 4294967296 (0x100000000)
    ```
    
    I fixed this and add some tests into `EnumUtilsTest` with a 64 values Enum.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rikles/commons-lang fix-LANG-1147

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/97.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #97
    
----
commit 1c9e5139f2b515f8741fbcb9c9b0f398d22d73ca
Author: Loic Guibert <lf...@yahoo.fr>
Date:   2015-06-12T08:19:37Z

    LANG-1147 : Fix EnumUtils *BitVector issue with more than 32 values Enums

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang pull request: LANG-1147 : Fix EnumUtils *BitVector is...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/commons-lang/pull/97


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---