8253876: jdk/test/lib/hexdump/ASN1FormatterTest.java fails with "AssertionError: Lines expected [126] but found [202]"
Reviewed-by: shade, lancea
This commit is contained in:
parent
db3053dcd1
commit
38159d52d4
@ -37,6 +37,3 @@
|
||||
# More than one label is allowed but must be on the same line.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
jdk/test/lib/hexdump/ASN1FormatterTest.java 8253876 generic-all
|
||||
|
@ -102,7 +102,7 @@ public class ASN1FormatterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
static void testIndefinate() {
|
||||
static void testIndefinite() {
|
||||
byte[] bytes = {0x24, (byte) 0x80, 4, 2, 'a', 'b', 4, 2, 'c', 'd', 0, 0};
|
||||
HexPrinter p = HexPrinter.simple()
|
||||
.formatter(ASN1Formatter.formatter(), "; ", 100);
|
||||
|
@ -165,8 +165,12 @@ public class ASN1Formatter implements HexPrinter.Formatter {
|
||||
// multi-byte encoded length
|
||||
int nbytes = len & 0x7f;
|
||||
if (nbytes > 4) {
|
||||
out.append("***** Tag: " + tagName(tag) +
|
||||
", Range of length error: " + len + " bytes" + System.lineSeparator());
|
||||
out.append("***** Tag: ")
|
||||
.append(tagName(tag))
|
||||
.append(", Range of length error: ")
|
||||
.append(Integer.toString(len))
|
||||
.append(" bytes");
|
||||
out.append(System.lineSeparator());
|
||||
return available; // return the unread length
|
||||
}
|
||||
len = 0;
|
||||
@ -185,9 +189,10 @@ public class ASN1Formatter implements HexPrinter.Formatter {
|
||||
out.append(prefix); // start with indent
|
||||
switch (tag) {
|
||||
case TAG_EndOfContent: // End-of-contents octets; len == 0
|
||||
out.append("END-OF-CONTENT " + System.lineSeparator());
|
||||
// end of indefinite-length constructed, return any remaining
|
||||
return 0; // unknown, but nothing left
|
||||
out.append("END-OF-CONTENT");
|
||||
out.append(System.lineSeparator());
|
||||
// end of indefinite-length constructed, return zero remaining
|
||||
return 0;
|
||||
case TAG_Integer:
|
||||
case TAG_Enumerated:
|
||||
switch (len) {
|
||||
@ -319,7 +324,7 @@ public class ASN1Formatter implements HexPrinter.Formatter {
|
||||
}
|
||||
}
|
||||
}
|
||||
out.append(System.lineSeparator()); // End with EOL
|
||||
out.append(System.lineSeparator());
|
||||
}
|
||||
return available;
|
||||
}
|
||||
|
@ -1099,7 +1099,9 @@ public final class HexPrinter {
|
||||
dest.append(info);
|
||||
info = "";
|
||||
} else {
|
||||
dest.append(info, 0, nl);
|
||||
// append up to the newline (ignoring \r if present)
|
||||
dest.append(info, 0,
|
||||
(nl > 0 && info.charAt(nl - 1) == '\r') ? nl - 1 : nl);
|
||||
info = info.substring(nl + 1);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user