Skip to content
Permalink
Browse files
8253876: jdk/test/lib/hexdump/ASN1FormatterTest.java fails with "Asse…
…rtionError: Lines expected [126] but found [202]"

Reviewed-by: shade, lancea
  • Loading branch information
Roger Riggs committed Oct 7, 2020
1 parent db3053d commit 38159d52d48dee54554e2a9fc404f3703d39f785
Showing 4 changed files with 15 additions and 11 deletions.
@@ -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 @@ static void dumpPEM() throws IOException {
}

@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 @@ private int annotate(DataInputStream in, Appendable out, int available, String p
// 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 @@ private int annotate(DataInputStream in, Appendable out, int available, String p
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 @@ private int annotate(DataInputStream in, Appendable out, int available, String p
}
}
}
out.append(System.lineSeparator()); // End with EOL
out.append(System.lineSeparator());
}
return available;
}
@@ -1099,7 +1099,9 @@ private void process() {
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);
}
}

1 comment on commit 38159d5

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 38159d5 Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.