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

Details

    • b03

    Description

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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: