You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by GitBox <gi...@apache.org> on 2020/08/29 09:07:00 UTC

[GitHub] [tika] PeterAlfredLee opened a new pull request #348: Refactor some code use method Math.max

PeterAlfredLee opened a new pull request #348:
URL: https://github.com/apache/tika/pull/348


   


----------------------------------------------------------------
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



[GitHub] [tika] kkrugler commented on pull request #348: Refactor some code use method Math.max

Posted by GitBox <gi...@apache.org>.
kkrugler commented on pull request #348:
URL: https://github.com/apache/tika/pull/348#issuecomment-683516522


   Thanks Peter!


----------------------------------------------------------------
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



[GitHub] [tika] kkrugler commented on a change in pull request #348: Refactor some code use method Math.max

Posted by GitBox <gi...@apache.org>.
kkrugler commented on a change in pull request #348:
URL: https://github.com/apache/tika/pull/348#discussion_r479656172



##########
File path: tika-core/src/main/java/org/apache/tika/io/CountingInputStream.java
##########
@@ -56,7 +56,7 @@ public CountingInputStream(InputStream in) {
     @Override
     public int read(byte[] b) throws IOException {
         int found = super.read(b);
-        this.count += (found >= 0) ? found : 0;

Review comment:
       For this read(), and the following one, I wouldn't use `Math.max()`. It's really a test to see if the `super.read()` returned -1 or an actual read amount, so better would be something like `if (found != -1) { this.count += found; }`




----------------------------------------------------------------
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



[GitHub] [tika] kkrugler merged pull request #348: Refactor some code use method Math.max

Posted by GitBox <gi...@apache.org>.
kkrugler merged pull request #348:
URL: https://github.com/apache/tika/pull/348


   


----------------------------------------------------------------
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



[GitHub] [tika] PeterAlfredLee commented on a change in pull request #348: Refactor some code use method Math.max

Posted by GitBox <gi...@apache.org>.
PeterAlfredLee commented on a change in pull request #348:
URL: https://github.com/apache/tika/pull/348#discussion_r479852298



##########
File path: tika-core/src/main/java/org/apache/tika/io/CountingInputStream.java
##########
@@ -56,7 +56,7 @@ public CountingInputStream(InputStream in) {
     @Override
     public int read(byte[] b) throws IOException {
         int found = super.read(b);
-        this.count += (found >= 0) ? found : 0;

Review comment:
       Good point. Just pushed a new commit. :)




----------------------------------------------------------------
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