Skip to content

Commit

Permalink
Sort availability zones in getter and handle the conversion in the co…
Browse files Browse the repository at this point in the history
…pyFrom
  • Loading branch information
Russsnizza committed Sep 27, 2024
1 parent a231214 commit 981af9d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/gyro/aws/rds/DbClusterResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -177,15 +177,14 @@ public void setApplyImmediately(Boolean applyImmediately) {
public List<String> getAvailabilityZones() {
if (availabilityZones == null) {
availabilityZones = new ArrayList<>();
} else {
Collections.sort(availabilityZones);
}

return availabilityZones;
}

public void setAvailabilityZones(List<String> availabilityZones) {
List<String> modifiableList = new ArrayList<>(availabilityZones); // creates a new modifiable list
Collections.sort(modifiableList);
this.availabilityZones = modifiableList;
this.availabilityZones = availabilityZones;
}

/**
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 981af9d

Please sign in to comment.