Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P3
-
Resolution: Duplicate
-
Affects Version/s: 8, openjfx11, openjfx16
-
Fix Version/s: None
-
Component/s: javafx
-
Labels:
-
Subcomponent:
Description
The StyleManager::calculateCheckSum method calculates a checksum using a MessageDigest read from an InputStream obtained from the URL of the stylesheet. The problem is that it reads bytes from the stream one byte at a time without wrapping the InputStream in a BufferedStream:
try (final InputStream stream = url.openStream();
final DigestInputStream dis = new DigestInputStream(stream, MessageDigest.getInstance("MD5")); ) {
dis.getMessageDigest().reset();
while (dis.read() != -1) { /* empty loop body is intentional */ }
return dis.getMessageDigest().digest();
}
It should either wrap the original stream in a BufferedInputStream or else read an array of, say 4K, bytes using the read(byte[]) method. The latter approach is used by the NativeLibLoader::cacheLibrary method.
try (final InputStream stream = url.openStream();
final DigestInputStream dis = new DigestInputStream(stream, MessageDigest.getInstance("MD5")); ) {
dis.getMessageDigest().reset();
while (dis.read() != -1) { /* empty loop body is intentional */ }
return dis.getMessageDigest().digest();
}
It should either wrap the original stream in a BufferedInputStream or else read an array of, say 4K, bytes using the read(byte[]) method. The latter approach is used by the NativeLibLoader::cacheLibrary method.
Attachments
Issue Links
- duplicates
-
JDK-8239138 StyleManager should use a BufferedInputStream
-
- Resolved
-
- relates to
-
JDK-8263886 CSS stylesheet processing could skip rereading when headers or timestamps are unchanged
-
- Open
-