Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8261938: ASN1Formatter.annotate should not return in the finally block #2620

wants to merge 3 commits into from
Changes from 1 commit
File filter
Filter file types
Jump to
Jump to file
Failed to load files.


Just for now

@@ -110,11 +110,23 @@ private ASN1Formatter() {
* A single well formed tagged-value is read and annotated.
* @param in a DataInputStream
* @throws IOException if an I/O error occurs
public String annotate(DataInputStream in) throws IOException {
public String annotate(DataInputStream in) {
StringBuilder sb = new StringBuilder();
this.annotate(in, sb);
try {
this.annotate(in, sb);
} catch (IOException e) {
* Formatters are designed to be nested, where one formatter can call another and the valuable output
* is the formatted string that has been accumulated from the beginning of the stream.
* The choice of DataInputStream was chosen for the convenience of the methods to read different types.
* and (declared) exceptions are an unwelcome artifact.
* If an exception was percolated up and the formatted output discarded, it would defeat the purpose.
* So we just catch it here and still return useful information about the stream to this point.
return sb.toString();

ProTip! Use n and p to navigate between commits in a pull request.