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 14:42:57 UTC

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

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