Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8322141

SequenceInputStream.transferTo should not return as soon as Long.MAX_VALUE bytes have been transferred

XMLWordPrintable

    • b03

      Currently the code in SequenceInputStream.transferTo() contains

                      if (transferred < Long.MAX_VALUE) {
                          try {
                              transferred = Math.addExact(transferred, in.transferTo(out));
                          } catch (ArithmeticException ignore) {
                              return Long.MAX_VALUE;
                          }
                      }

      whereas it should contain the equivalent of what is in InputStream.transferTo

                  if (transferred < Long.MAX_VALUE) {
                      try {
                          transferred = Math.addExact(transferred, read);
                      } catch (ArithmeticException ignore) {
                          transferred = Long.MAX_VALUE;
                      }
                  }

            mkarg Markus Karg
            bpb Brian Burkhalter
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: