From 4ae6ca8e0bef9c00a5d3870930347a9c3a792497 Mon Sep 17 00:00:00 2001 From: Junfu Chen Date: Fri, 29 Sep 2023 16:59:11 -0700 Subject: [PATCH] fix: clean-up --- .../clientdevices/auth/CertificateManager.java | 10 +++++----- .../auth/api/CustomGeneratorCertificateRequest.java | 2 +- .../clientdevices/auth/CertificateManagerTest.java | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/aws/greengrass/clientdevices/auth/CertificateManager.java b/src/main/java/com/aws/greengrass/clientdevices/auth/CertificateManager.java index a604780c0..f38a286e3 100644 --- a/src/main/java/com/aws/greengrass/clientdevices/auth/CertificateManager.java +++ b/src/main/java/com/aws/greengrass/clientdevices/auth/CertificateManager.java @@ -63,6 +63,8 @@ import javax.inject.Inject; public class CertificateManager { + private static final Logger logger = LogManager.getLogger(CertificateManager.class); + private static final String pkcs11Scheme = "pkcs11"; private final CertificateStore certificateStore; private final ConnectivityInformation connectivityInformation; private final CertificateExpiryMonitor certExpiryMonitor; @@ -74,9 +76,8 @@ public class CertificateManager { private final GreengrassServiceClientFactory clientFactory; private final SecurityService securityService; private final DomainEvents domainEvent; + @Getter private CertificatesConfig certificatesConfig; - private static final Logger logger = LogManager.getLogger(CertificateManager.class); - private static final String pkcs11Scheme = "pkcs11"; /** * Construct a new CertificateManager. @@ -268,7 +269,6 @@ public void unsubscribeFromCertificateUpdates(GetCertificateRequest getCertifica } } - private void removeCGFromMonitors(CertificateGenerator gen) { certExpiryMonitor.removeFromMonitor(gen); cisShadowMonitor.removeFromMonitor(gen); @@ -276,8 +276,8 @@ private void removeCGFromMonitors(CertificateGenerator gen) { } @SuppressWarnings("PMD.AvoidCatchingGenericException") - private X509Certificate[] getCertificateChainFromConfiguration(CAConfiguration configuration) throws - CertificateChainLoadingException { + private X509Certificate[] getCertificateChainFromConfiguration(CAConfiguration configuration) + throws CertificateChainLoadingException { try { Optional certificateChainUri = configuration.getCertificateChainUri(); diff --git a/src/main/java/com/aws/greengrass/clientdevices/auth/api/CustomGeneratorCertificateRequest.java b/src/main/java/com/aws/greengrass/clientdevices/auth/api/CustomGeneratorCertificateRequest.java index 3af308592..a432b9c39 100644 --- a/src/main/java/com/aws/greengrass/clientdevices/auth/api/CustomGeneratorCertificateRequest.java +++ b/src/main/java/com/aws/greengrass/clientdevices/auth/api/CustomGeneratorCertificateRequest.java @@ -22,4 +22,4 @@ public CustomGeneratorCertificateRequest(String serviceName, super(serviceName, certificateRequestOptions, certificateUpdateConsumer); this.certificateGenerator = certificateGenerator; } -} \ No newline at end of file +} diff --git a/src/test/java/com/aws/greengrass/clientdevices/auth/CertificateManagerTest.java b/src/test/java/com/aws/greengrass/clientdevices/auth/CertificateManagerTest.java index 6712945da..6d16ab593 100644 --- a/src/test/java/com/aws/greengrass/clientdevices/auth/CertificateManagerTest.java +++ b/src/test/java/com/aws/greengrass/clientdevices/auth/CertificateManagerTest.java @@ -66,7 +66,6 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; -import java.util.function.Supplier; import java.util.stream.Stream; import static com.aws.greengrass.clientdevices.auth.ClientDevicesAuthService.CLIENT_DEVICES_AUTH_SERVICE_NAME;