8165103: Update to "denyAfter constraint check" exception message
Reviewed-by: valeriep
--- a/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java Mon Oct 10 22:42:45 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java Mon Oct 10 14:20:16 2016 -0700
@@ -543,7 +543,7 @@
private static class DenyAfterConstraint extends Constraint {
private Date denyAfterDate;
private static final SimpleDateFormat dateFormat =
- new SimpleDateFormat("EEE, MMM d HH:mm:ss z YYYY");
+ new SimpleDateFormat("EEE, MMM d HH:mm:ss z yyyy");
DenyAfterConstraint(String algo, int year, int month, int day) {
Calendar c;
@@ -593,13 +593,17 @@
public void permits(CertConstraintParameters cp)
throws CertPathValidatorException {
Date currentDate;
+ String errmsg;
if (cp.getJARTimestamp() != null) {
currentDate = cp.getJARTimestamp().getTimestamp();
+ errmsg = "JAR Timestamp date: ";
} else if (cp.getPKIXParamDate() != null) {
currentDate = cp.getPKIXParamDate();
+ errmsg = "PKIXParameter date: ";
} else {
currentDate = new Date();
+ errmsg = "Certificate date: ";
}
if (!denyAfterDate.after(currentDate)) {
@@ -609,10 +613,9 @@
throw new CertPathValidatorException(
"denyAfter constraint check failed. " +
"Constraint date: " +
- dateFormat.format(denyAfterDate) +
- "; Cert date: " +
- dateFormat.format(currentDate),
- null, null, -1, BasicReason.ALGORITHM_CONSTRAINED);
+ dateFormat.format(denyAfterDate) + "; "
+ + errmsg + dateFormat.format(currentDate),
+ null, null, -1, BasicReason.ALGORITHM_CONSTRAINED);
}
}