openjdk-17/8296480-Fix-the-problem-that-the-TestPolicy.j.patch
2023-01-06 09:32:53 +08:00

43 lines
1.6 KiB
Diff

From c40df7ed8cb6d6c0f687c1d68071729fab7c1b2d Mon Sep 17 00:00:00 2001
Date: Wed, 4 Jan 2023 20:42:04 +0800
Subject: 8296480: Fix the problem that the TestPolicy.java
case fails because the certificate expires.
---
.../java/security/cert/pkix/policyChanges/TestPolicy.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/test/jdk/java/security/cert/pkix/policyChanges/TestPolicy.java b/test/jdk/java/security/cert/pkix/policyChanges/TestPolicy.java
index a92eee2c5..de2f94d27 100644
--- a/test/jdk/java/security/cert/pkix/policyChanges/TestPolicy.java
+++ b/test/jdk/java/security/cert/pkix/policyChanges/TestPolicy.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2022, 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
@@ -34,6 +34,7 @@
*/
import java.io.*;
+import java.text.DateFormat;
import java.util.*;
import java.security.Security;
@@ -97,6 +98,10 @@ public class TestPolicy {
params.setRevocationEnabled(false);
params.setInitialPolicies(testCase.initialPolicies);
+ // Certs expired on 7th Nov 2022
+ params.setDate(DateFormat.getDateInstance(DateFormat.MEDIUM,
+ Locale.US).parse("June 01, 2022"));
+
CertPath path = factory.generateCertPath(Arrays.asList(new X509Certificate[] {ee, ca}));
PKIXCertPathValidatorResult result = (PKIXCertPathValidatorResult)validator.validate(path, params);
--
2.37.0