Serialization changes - AWS SDK for Java 2.x

Serialization changes

The SDK for Java v1.x and v2.x differ in how they serialize List objects to request parameters.

The SDK for Java 1.x does not serialize an empty list, whereas the SDK for Java 2.x serializes an empty list as an empty parameter.

For example, consider a service with a SampleOperation that takes a SampleRequest. The SampleRequest accepts two parameters—a String type str1 and List type listParam—as shown in the following examples.

Example of SampleOperation in 1.x
SampleRequest v1Request = new SampleRequest() .withStr1("TestName"); sampleServiceV1Client.sampleOperation(v1Request);

Wire-level logging shows that the listParam parameter is not serialized.

Action=SampleOperation&Version=2011-01-01&str1=TestName
Example of SampleOperation in 2.x
sampleServiceV2Client.sampleOperation(b -> b .str1("TestName"));

Wire-level logging shows that the listParam parameter is serialized with no value.

Action=SampleOperation&Version=2011-01-01&str1=TestName&listParam=