From: SourceForge.net <no...@so...> - 2010-06-28 20:06:54
|
Bugs item #3022501, was opened at 2010-06-28 15:04 Message generated for change (Comment added) made by blaschke-oss You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=712784&aid=3022501&group_id=128809 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Java Client (JSR48) Group: Code Cleanup Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dave Blaschke (blaschke-oss) Assigned to: Dave Blaschke (blaschke-oss) Summary: Possible integer overflow in getTotalUSec Initial Comment: Bug: Result of integer multiplication cast to long Pattern id: ICAST_INTEGER_MULTIPLY_CAST_TO_LONG, type: ICAST, category: STYLE This code performs integer multiply and then converts the result to a long, as in: long convertDaysToMilliseconds(int days) { return 1000*3600*24*days; } If the multiplication is done using long arithmetic, you can avoid the possibility that the result will overflow. For example, you could fix the above code to: long convertDaysToMilliseconds(int days) { return 1000L*3600*24*days; } ---------------------------------------------------------------------- >Comment By: Dave Blaschke (blaschke-oss) Date: 2010-06-28 15:06 Message: Fixing this eliminates 1 FindBugs issue ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=712784&aid=3022501&group_id=128809 |