You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2019/04/28 16:16:17 UTC

[GitHub] [activemq-artemis] jdanekrh commented on a change in pull request #2650: ARTEMIS-2320 Multiple math-related fixes

jdanekrh commented on a change in pull request #2650:  ARTEMIS-2320 Multiple math-related fixes
URL: https://github.com/apache/activemq-artemis/pull/2650#discussion_r279201353
 
 

 ##########
 File path: artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/mapped/MappedSequentialFile.java
 ##########
 @@ -110,7 +110,7 @@ public void open(int maxIO, boolean useExecutor) throws IOException {
    @Override
    public boolean fits(int size) {
       checkIsOpen();
-      final long newPosition = this.mappedFile.position() + size;
+      final long newPosition = (long) this.mappedFile.position() + size;
       final boolean hasRemaining = newPosition <= this.mappedFile.length();
 
 Review comment:
   It may change semantics, depending on how large the variables are. You are adding together two ints, then assigning to long. Without the cast, you can get overflow on the int range, before you assign to that long. (Which is what the IntLongMath warning is about).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services