Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/java/gyro/aws/rds/DbClusterResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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 @@ -182,7 +183,9 @@ public List<String> getAvailabilityZones() {
}

public void setAvailabilityZones(List<String> availabilityZones) {
this.availabilityZones = availabilityZones;
List<String> modifiableList = new ArrayList<>(availabilityZones); // creates a new modifiable list
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably shouldn't blindly create a new list every time.
We should handle the conversion in the copyFrom.

    @Override
    public void copyFrom(DBCluster cluster) {
        setAvailabilityZones(new ArrayList<>(cluster.availabilityZones()));

Collections.sort(modifiableList);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sort should take place on the getter instead.

this.availabilityZones = modifiableList;
}

/**
Expand Down
Loading