8272026: Verify Jar Verification
Reviewed-by: rhalade, valeriep, mschoene
This commit is contained in:
parent
cb7482d5bd
commit
4d3663a6d0
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
package java.util.jar;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
@ -366,7 +367,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
|
||||
|
||||
int read(Manifest.FastInputStream is, byte[] lbuf, String filename, int lineNumber) throws IOException {
|
||||
String name = null, value;
|
||||
byte[] lastline = null;
|
||||
ByteArrayOutputStream fullLine = new ByteArrayOutputStream();
|
||||
|
||||
int len;
|
||||
while ((len = is.readLine(lbuf)) != -1) {
|
||||
@ -392,15 +393,12 @@ public class Attributes implements Map<Object,Object>, Cloneable {
|
||||
+ Manifest.getErrorPosition(filename, lineNumber) + ")");
|
||||
}
|
||||
lineContinued = true;
|
||||
byte[] buf = new byte[lastline.length + len - 1];
|
||||
System.arraycopy(lastline, 0, buf, 0, lastline.length);
|
||||
System.arraycopy(lbuf, 1, buf, lastline.length, len - 1);
|
||||
fullLine.write(lbuf, 1, len - 1);
|
||||
if (is.peek() == ' ') {
|
||||
lastline = buf;
|
||||
continue;
|
||||
}
|
||||
value = new String(buf, 0, buf.length, UTF_8.INSTANCE);
|
||||
lastline = null;
|
||||
value = fullLine.toString(UTF_8.INSTANCE);
|
||||
fullLine.reset();
|
||||
} else {
|
||||
while (lbuf[i++] != ':') {
|
||||
if (i >= len) {
|
||||
@ -414,8 +412,8 @@ public class Attributes implements Map<Object,Object>, Cloneable {
|
||||
}
|
||||
name = new String(lbuf, 0, i - 2, UTF_8.INSTANCE);
|
||||
if (is.peek() == ' ') {
|
||||
lastline = new byte[len - i];
|
||||
System.arraycopy(lbuf, i, lastline, 0, len - i);
|
||||
fullLine.reset();
|
||||
fullLine.write(lbuf, i, len - i);
|
||||
continue;
|
||||
}
|
||||
value = new String(lbuf, i, len - i, UTF_8.INSTANCE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user