Monday, 19 January 2015

AWS Tip of the day: Working around the S3 "Failed to parse XML document" exception

If you have S3 objects with Unicode characters that aren't supported by XML 1.0 you are likely to see an exception when calling listObjects in the AWS Java SDK:

Failed to parse XML document with handler class com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser$ListBucketHandler

The quick and simple solution to fix this is to set the encoding type to "url". Example code stolen from here: