Skip to content
Draft
Show file tree
Hide file tree
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 @@ -523,4 +523,12 @@
<Class name="software.amazon.awssdk.http.urlconnection.UrlConnectionSdkHttpService"/>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Match>

<!-- Intentionally passing null to marshallField for non-PAYLOAD fields
(PATH, HEADER, QUERY) whose NULL marshallers handle null validation. -->
<Match>
<Class name="software.amazon.awssdk.protocols.json.internal.marshall.JsonProtocolMarshaller"/>
<Method name="doMarshall"/>
<Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.PayloadTrait;
import software.amazon.awssdk.core.traits.RequiredTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.core.traits.TraitType;
import software.amazon.awssdk.http.SdkHttpFullRequest;
Expand Down Expand Up @@ -212,8 +213,15 @@ void doMarshall(SdkPojo pojo) {
}
} else if (isExplicitPayloadMember(field)) {
marshallExplicitJsonPayload(field, val);
} else {
} else if (val != null) {
marshallField(field, val);
} else if (field.location() != MarshallLocation.PAYLOAD) {
marshallField(field, val);
} else if (field.containsTrait(RequiredTrait.class,
TraitType.REQUIRED_TRAIT)) {
throw new IllegalArgumentException(
String.format("Parameter '%s' must not be null",
field.locationName()));
}
}
}
Expand Down
Loading