Serialization changes - Amazon SDK for Java 2.x
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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.

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.