Skip to content
Permalink
Browse files
8261472: BasicConstraintsExtension::toString shows "PathLen:214748364…
…7" if there is no pathLenConstraint

Reviewed-by: jnimeh
  • Loading branch information
wangweij committed Feb 10, 2021
1 parent 699a3cd commit 4619f372ae5934091b0d40621a1dbcd9e4b0f80c
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/java.base/share/classes/sun/security/x509/BasicConstraintsExtension.java
@@ -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 @@ public BasicConstraintsExtension(Boolean critical, Object value)
* 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";
}

0 comments on commit 4619f37

Please sign in to comment.