8261472: BasicConstraintsExtension::toString shows "PathLen:2147483647" if there is no pathLenConstraint

Reviewed-by: jnimeh
This commit is contained in:
Weijun Wang 2021-02-10 01:59:41 +00:00
parent 699a3cde74
commit 4619f372ae

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2009, 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
@ -171,10 +171,17 @@ implements CertAttrSet<String> {
* Return user readable form of extension.
*/
public String toString() {
String pathLenAsString;
if (pathLen < 0) {
pathLenAsString = " undefined";
} else if (pathLen == Integer.MAX_VALUE) {
pathLenAsString = " no limit";
} else {
pathLenAsString = String.valueOf(pathLen);
}
return super.toString() +
"BasicConstraints:[\n CA:" + ca +
"\n PathLen:" +
((pathLen >= 0) ? String.valueOf(pathLen) : " undefined") +
"\n PathLen:" + pathLenAsString +
"\n]\n";
}