You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Christian Hammers (JIRA)" <ji...@apache.org> on 2012/09/01 17:52:07 UTC
[jira] [Created] (CODEC-150) Remove unnecessary call to Math.abs()
Christian Hammers created CODEC-150:
---------------------------------------
Summary: Remove unnecessary call to Math.abs()
Key: CODEC-150
URL: https://issues.apache.org/jira/browse/CODEC-150
Project: Commons Codec
Issue Type: Improvement
Affects Versions: 1.6
Reporter: Christian Hammers
Priority: Minor
Attachments: commons-codec-chammers-20120901-math-abs.diff
As spotted by findbugs. Diff attached and online at
https://github.com/lathspell/commons-codec/commit/ec75321169e624d1a4c44c3ab79d86fbd9e18a01
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CODEC-150) Remove unnecessary call to
Math.abs()
Posted by "Christian Hammers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13446758#comment-13446758 ]
Christian Hammers commented on CODEC-150:
-----------------------------------------
The intend was to get a random index i.e. a random number between 0 and numSaltChars-1.
The old code generated a random number between ca. -2^31 and +2^31, then cuts off the sign and adds modulo numSaltChars to get the intended range. It was actually buggy as abs() does not work for Integer.MIN_VALUE as findbugs explained to me.
The new code just calls Random.nextInt(numSaltChars) which gives exactly the required range and looks less ugly.
> Remove unnecessary call to Math.abs()
> -------------------------------------
>
> Key: CODEC-150
> URL: https://issues.apache.org/jira/browse/CODEC-150
> Project: Commons Codec
> Issue Type: Improvement
> Affects Versions: 1.6
> Reporter: Christian Hammers
> Priority: Minor
> Attachments: commons-codec-chammers-20120901-math-abs.diff
>
>
> As spotted by findbugs. Diff attached and online at
> https://github.com/lathspell/commons-codec/commit/ec75321169e624d1a4c44c3ab79d86fbd9e18a01
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CODEC-150) Remove unnecessary call to Math.abs()
Posted by "Gary D. Gregory (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory resolved CODEC-150.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.7
Thank you Christian.
> Remove unnecessary call to Math.abs()
> -------------------------------------
>
> Key: CODEC-150
> URL: https://issues.apache.org/jira/browse/CODEC-150
> Project: Commons Codec
> Issue Type: Improvement
> Affects Versions: 1.6
> Reporter: Christian Hammers
> Priority: Minor
> Fix For: 1.7
>
> Attachments: commons-codec-chammers-20120901-math-abs.diff
>
>
> As spotted by findbugs. Diff attached and online at
> https://github.com/lathspell/commons-codec/commit/ec75321169e624d1a4c44c3ab79d86fbd9e18a01
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (CODEC-150) Remove unnecessary call to Math.abs()
Posted by "Gary D. Gregory (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory closed CODEC-150.
---------------------------------
Released in 1.7 today.
> Remove unnecessary call to Math.abs()
> -------------------------------------
>
> Key: CODEC-150
> URL: https://issues.apache.org/jira/browse/CODEC-150
> Project: Commons Codec
> Issue Type: Improvement
> Affects Versions: 1.6
> Reporter: Christian Hammers
> Priority: Minor
> Fix For: 1.7
>
> Attachments: commons-codec-chammers-20120901-math-abs.diff
>
>
> As spotted by findbugs. Diff attached and online at
> https://github.com/lathspell/commons-codec/commit/ec75321169e624d1a4c44c3ab79d86fbd9e18a01
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CODEC-150) Remove unnecessary call to Math.abs()
Posted by "Christian Hammers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christian Hammers updated CODEC-150:
------------------------------------
Attachment: commons-codec-chammers-20120901-math-abs.diff
> Remove unnecessary call to Math.abs()
> -------------------------------------
>
> Key: CODEC-150
> URL: https://issues.apache.org/jira/browse/CODEC-150
> Project: Commons Codec
> Issue Type: Improvement
> Affects Versions: 1.6
> Reporter: Christian Hammers
> Priority: Minor
> Attachments: commons-codec-chammers-20120901-math-abs.diff
>
>
> As spotted by findbugs. Diff attached and online at
> https://github.com/lathspell/commons-codec/commit/ec75321169e624d1a4c44c3ab79d86fbd9e18a01
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CODEC-150) Remove unnecessary call to
Math.abs()
Posted by "Gary D. Gregory (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CODEC-150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13446756#comment-13446756 ]
Gary D. Gregory commented on CODEC-150:
---------------------------------------
Why are the calls unnecessary?
Please see the latest from trunk for changes related to the FindBugs reports.
> Remove unnecessary call to Math.abs()
> -------------------------------------
>
> Key: CODEC-150
> URL: https://issues.apache.org/jira/browse/CODEC-150
> Project: Commons Codec
> Issue Type: Improvement
> Affects Versions: 1.6
> Reporter: Christian Hammers
> Priority: Minor
> Attachments: commons-codec-chammers-20120901-math-abs.diff
>
>
> As spotted by findbugs. Diff attached and online at
> https://github.com/lathspell/commons-codec/commit/ec75321169e624d1a4c44c3ab79d86fbd9e18a01
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira