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

StyleManager should use a BufferedInputStream

XMLWordPrintable

    • x86_64
    • generic

      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.


            arapte Ambarish Rapte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: