Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Only copy volumes if non-null #604

Merged
merged 2 commits into from
Feb 3, 2017
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@JsonAutoDetect(fieldVisibility = ANY, getterVisibility = NONE, setterVisibility = NONE)
public abstract class VolumeList {

@Nullable
@JsonProperty("Volumes")
public abstract ImmutableList<Volume> volumes();

Expand All @@ -47,8 +48,10 @@ public abstract class VolumeList {
static VolumeList create(
@JsonProperty("Volumes") final List<Volume> volumes,
@JsonProperty("Warnings") final List<String> warnings) {
final ImmutableList<Volume> volumesCopy = volumes == null
? null : ImmutableList.copyOf(volumes);
final ImmutableList<String> warningsCopy = warnings == null
? null : ImmutableList.copyOf(warnings);
return new AutoValue_VolumeList(ImmutableList.copyOf(volumes), warningsCopy);
return new AutoValue_VolumeList(volumesCopy, warningsCopy);
}
}