Skip to content

Commit 4fb3f4b

Browse files
Dhriti07Dhriti Chopra
andauthored
fix(storage): correctly insert explicit nulls for json patch updates (#13716)
Fix integration test issue in JSON Patch Updates Co-authored-by: Dhriti Chopra <dhritichopra@google.com>
1 parent e3e9d0b commit 4fb3f4b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage

java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,9 @@ public Bucket update(BucketInfo bucketInfo, BucketTargetOption... options) {
492492
.forEach(
493493
field -> {
494494
String jsonName = field.getApiaryName();
495-
if (tmp.containsKey(jsonName)) {
496-
bucketPb.put(jsonName, tmp.get(jsonName));
495+
Object value = tmp.get(jsonName);
496+
if (value != null) {
497+
bucketPb.put(jsonName, value);
497498
} else {
498499
BucketField lookup = BucketField.lookup(field);
499500
if (lookup != null) {
@@ -577,8 +578,9 @@ public Blob update(BlobInfo blobInfo, BlobTargetOption... options) {
577578
} else {
578579
checkState(subFields.size() <= 1, "unexpected nested field(s) %s", subFields);
579580
String jsonName = topLevelField.getApiaryName();
580-
if (tmp.containsKey(jsonName)) {
581-
pb.put(jsonName, tmp.get(jsonName));
581+
Object value = tmp.get(jsonName);
582+
if (value != null) {
583+
pb.put(jsonName, value);
582584
} else {
583585
BlobField lookup = BlobField.lookup(topLevelField);
584586
if (lookup != null) {

0 commit comments

Comments
 (0)