You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2015/06/13 01:41:00 UTC
[jira] [Resolved] (LANG-1147) EnumUtils *BitVector issue with more
than 32 values Enum
[ https://issues.apache.org/jira/browse/LANG-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb resolved LANG-1147.
------------------------
Resolution: Fixed
Fix Version/s: 3.5
Thanks for the report and thorough patch.
Applied:
Repository: commons-lang
Updated Branches:
refs/heads/master 529964961 -> 06b7cd3a3
LANG-1147 EnumUtils *BitVector issue with more than 32 values Enum
This closes #97
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/06b7cd3a
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/06b7cd3a
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/06b7cd3a
Branch: refs/heads/master
Commit: 06b7cd3a31c4565ceb0a127273ef800a3d084caf
Parents: 5299649
Author: Sebb <se...@apache.org>
Authored: Sat Jun 13 00:38:27 2015 +0100
Committer: Sebb <se...@apache.org>
Committed: Sat Jun 13 00:38:27 2015 +0100
----------------------------------------------------------------------
src/changes/changes.xml | 1 +
.../org/apache/commons/lang3/EnumUtils.java | 8 +--
.../org/apache/commons/lang3/EnumUtilsTest.java | 51 ++++++++++++++++++++
3 files changed, 56 insertions(+), 4 deletions(-)
> EnumUtils *BitVector issue with more than 32 values Enum
> --------------------------------------------------------
>
> Key: LANG-1147
> URL: https://issues.apache.org/jira/browse/LANG-1147
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 3.4
> Reporter: Loic Guibert
> Priority: Critical
> Fix For: 3.5
>
>
> In *EnumUtils* all _BitVector_ related methods fail in handling Enums with more than 32 values.
> This is due to a implicit _int_ -> _long_ conversion in generating the Enum value _long_ mask.
> *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
> {code}
> long mask = 1 << 32; // -> mask = 1 and not 4294967296 (0x100000000)
> {code}
> *Good code :* here *1L* is a _long_ value so the *<<* operation is done into an _long_ context
> {code}
> long mask = 1L << 32; // -> mask = 4294967296 (0x100000000)
> {code}
> See PR#97 : https://github.com/apache/commons-lang/pull/97
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)