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

StyleManager should use a BufferedInputStream

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      com.sun.javafx.css.StyleManager.calculateCheckSum uses a raw InputStream as the input to a DigestInputStream. The InputStream should be wrapped in a BufferedInputStream to improve performance. Thus:

      try (final InputStream stream = url.openStream();
             final BufferedInputStream bstream = new BufferedInputStream(stream);
                          final DigestInputStream dis = new DigestInputStream(bstream, MessageDigest.getInstance("MD5")); ) {
                          dis.getMessageDigest().reset();
                          while (dis.read() != -1) { /* empty loop body is intentional */ }
                          return dis.getMessageDigest().digest();
                      }

      Alternatively (preferably) move the IO to java.nio.file.


        Attachments

          Activity

            People

            • Assignee:
              aghaisas Ajit Ghaisas
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: