Skip to content

Commit

Permalink
chore: cleanup method checking for whether a parameter is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
rhusar committed Oct 24, 2024
1 parent 4b323f9 commit bcb7b2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/org/jgroups/protocols/aws/S3_PING.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class S3_PING extends FILE_PING {

static {
short magicNumber=JGROUPS_PROTOCOL_DEFAULT_MAGIC_NUMBER;
if(!isNullOrEmpty(System.getProperty(MAGIC_NUMBER_SYSTEM_PROPERTY))) {
if(isDefined(System.getProperty(MAGIC_NUMBER_SYSTEM_PROPERTY))) {
try {
magicNumber=Short.parseShort(System.getProperty(MAGIC_NUMBER_SYSTEM_PROPERTY));
}
Expand Down Expand Up @@ -107,7 +107,7 @@ public void init() throws Exception {
Region region = Region.of(region_name);
builder.region(region);

if (!isNullOrEmpty(endpoint)) {
if (isDefined(endpoint)) {
builder.endpointOverride(new URI(endpoint));
log.info("Set Amazon S3 endpoint to %s", endpoint);
}
Expand Down Expand Up @@ -229,7 +229,7 @@ protected void write(final List<PingData> list, final String clustername) {
putRequestBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL);
}

if (!isNullOrEmpty(kms_key_id)) {
if (isDefined(kms_key_id)) {
putRequestBuilder.serverSideEncryption(ServerSideEncryption.AWS_KMS);
putRequestBuilder.ssekmsKeyId(kms_key_id);
}
Expand Down Expand Up @@ -293,7 +293,7 @@ protected void removeAll(String clustername) {
}
}

private static boolean isNullOrEmpty(String s) {
return s == null || s.trim().length() == 0;
private static boolean isDefined(String s) {
return (s != null && !s.trim().isEmpty());
}
}

0 comments on commit bcb7b2d

Please sign in to comment.