From 6d1c5b1ee82b2b2481a16f3510078fdc7ddc08f9 Mon Sep 17 00:00:00 2001
From: eapen <zhangyipeng7@huawei.com>
Date: Tue, 15 Nov 2022 11:26:33 +0800
Subject: [PATCH 04/33] 8296480: Fix the problem that the TestPolicy.java case
 fails because the certificate expires.
---
 jdk/test/java/security/cert/pkix/policyChanges/TestPolicy.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/jdk/test/java/security/cert/pkix/policyChanges/TestPolicy.java b/jdk/test/java/security/cert/pkix/policyChanges/TestPolicy.java
index a92eee2..b37debf 100644
--- a/jdk/test/java/security/cert/pkix/policyChanges/TestPolicy.java
+++ b/jdk/test/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);
-- 
1.8.3.1

