From 981af9de205fe1ad02508b381b33661537fdfc86 Mon Sep 17 00:00:00 2001 From: Russsnizza <134000942+Russsnizza@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:03:59 -0600 Subject: [PATCH] Sort availability zones in getter and handle the conversion in the copyFrom --- src/main/java/gyro/aws/rds/DbClusterResource.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/gyro/aws/rds/DbClusterResource.java b/src/main/java/gyro/aws/rds/DbClusterResource.java index b8e4b4ed8..535e00b8f 100644 --- a/src/main/java/gyro/aws/rds/DbClusterResource.java +++ b/src/main/java/gyro/aws/rds/DbClusterResource.java @@ -17,12 +17,12 @@ package gyro.aws.rds; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import java.util.Collections; import com.psddev.dari.util.ObjectUtils; import gyro.aws.Copyable; @@ -177,15 +177,14 @@ public void setApplyImmediately(Boolean applyImmediately) { public List getAvailabilityZones() { if (availabilityZones == null) { availabilityZones = new ArrayList<>(); + } else { + Collections.sort(availabilityZones); } - return availabilityZones; } public void setAvailabilityZones(List availabilityZones) { - List modifiableList = new ArrayList<>(availabilityZones); // creates a new modifiable list - Collections.sort(modifiableList); - this.availabilityZones = modifiableList; + this.availabilityZones = availabilityZones; } /** @@ -713,7 +712,8 @@ public void setReaderEndpointAddress(String readerEndpointAddress) { @Override public void copyFrom(DBCluster cluster) { - setAvailabilityZones(cluster.availabilityZones()); + setAvailabilityZones(new ArrayList<>(cluster.availabilityZones())); + setBackTrackWindow(cluster.backtrackWindow()); setBackupRetentionPeriod(cluster.backupRetentionPeriod()); setCharacterSetName(cluster.characterSetName());