You are viewing a plain text version of this content. The canonical link for it is here.
Posted to proton@qpid.apache.org by "Robbie Gemmell (JIRA)" <ji...@apache.org> on 2014/01/31 14:26:10 UTC
[jira] [Assigned] (PROTON-501) [proton-j]
UnsignedLong.valueOf(String) can permit values outside the allowed range
[ https://issues.apache.org/jira/browse/PROTON-501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robbie Gemmell reassigned PROTON-501:
-------------------------------------
Assignee: Robbie Gemmell
> [proton-j] UnsignedLong.valueOf(String) can permit values outside the allowed range
> -----------------------------------------------------------------------------------
>
> Key: PROTON-501
> URL: https://issues.apache.org/jira/browse/PROTON-501
> Project: Qpid Proton
> Issue Type: Bug
> Components: proton-j
> Affects Versions: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6
> Reporter: Robbie Gemmell
> Assignee: Robbie Gemmell
> Fix For: 0.7
>
>
> UnsignedLong#valueOf(String) attempts to ensure the provided value is in the range [0L- 2^64) but is likely to fail in doing.
> The method uses BigInteger#bitCount() as part of the process, which despite the name will not give the behaviour that might be expected:
> http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#bitCount()
> "Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit. This method is useful when implementing bit-vector style sets atop BigIntegers."
> The range check should probably be using:
> http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#bitLength()
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)