8168069: X509TrustManagerImpl causes ClassLoader leaks with unparseable extensions

Reviewed-by: mullan
This commit is contained in:
Xue-Lei Andrew Fan 2019-02-20 18:46:30 -08:00
parent e2054e3c5d
commit e6f6863cbc
4 changed files with 56 additions and 36 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, 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
@ -355,7 +355,7 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
class UnparseableExtension extends Extension {
private String name;
private Throwable why;
private String exceptionDescription;
public UnparseableExtension(Extension ext, Throwable why) {
super(ext);
@ -371,12 +371,13 @@ class UnparseableExtension extends Extension {
// If we cannot find the name, just ignore it
}
this.why = why;
this.exceptionDescription = why.toString();
}
@Override public String toString() {
return super.toString() +
"Unparseable " + name + "extension due to\n" + why + "\n\n" +
"Unparseable " + name + "extension due to\n" +
exceptionDescription + "\n\n" +
new HexDumpEncoder().encodeBuffer(getExtensionValue());
}
}