diff --git a/src/main/java/io/jenkins/plugins/cdevents/CDEventsGlobalConfig.java b/src/main/java/io/jenkins/plugins/cdevents/CDEventsGlobalConfig.java index 8b5b241..e587c38 100644 --- a/src/main/java/io/jenkins/plugins/cdevents/CDEventsGlobalConfig.java +++ b/src/main/java/io/jenkins/plugins/cdevents/CDEventsGlobalConfig.java @@ -37,7 +37,7 @@ public static CDEventsGlobalConfig get() { } private static boolean isNullOrEmpty(String str) { - return str == null || str.trim().isEmpty(); + return str.isBlank(); } public String getSinkType() { diff --git a/src/main/java/io/jenkins/plugins/cdevents/sinks/KinesisSink.java b/src/main/java/io/jenkins/plugins/cdevents/sinks/KinesisSink.java index 9d6368a..9147051 100644 --- a/src/main/java/io/jenkins/plugins/cdevents/sinks/KinesisSink.java +++ b/src/main/java/io/jenkins/plugins/cdevents/sinks/KinesisSink.java @@ -57,15 +57,15 @@ public static synchronized void rebuildKinesisClient() { String roleSessionName = "cdevents-plugin"; AmazonKinesisClientBuilder kinesisBuilder = AmazonKinesisClientBuilder.standard(); - if (region != null && !region.isEmpty()) { + if (!region.isBlank()) { kinesisBuilder.withRegion(region); } - if (endpoint != null && !endpoint.isEmpty()) { + if (!endpoint.isBlank()) { AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration( endpoint, region); kinesisBuilder.withEndpointConfiguration(endpointConfiguration); } - if (iamRole != null && !iamRole.isEmpty()) { + if (!iamRole.isBlank()) { STSAssumeRoleSessionCredentialsProvider credentialsProvider = new STSAssumeRoleSessionCredentialsProvider.Builder( iamRole, roleSessionName).build(); kinesisBuilder.withCredentials(credentialsProvider);