Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete S3Exception in S3Client.getBucketPolicy() #1088

Closed
LukeHornibrookHaventec opened this issue Feb 21, 2019 · 1 comment · Fixed by #1089
Closed

Incomplete S3Exception in S3Client.getBucketPolicy() #1088

LukeHornibrookHaventec opened this issue Feb 21, 2019 · 1 comment · Fixed by #1089
Labels
bug This issue is a bug.

Comments

@LukeHornibrookHaventec
Copy link

When calling S3Client.getBucketPolicy() on an S3 bucket that does not have a bucket policy, the resulting S3Exception and AwsErrorDetails have null values for the request id, error code and error message.

Expected Behavior

The S3Exception should capture error details from the response body. For reference, a partially redacted response body is as follows:

<?xml version="1.0" encoding="UTF-8"?><Policy><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchBucketPolicy</Code><Message>The bucket policy does not exist</Message><BucketName>xxxx</BucketName><RequestId>xxxx</RequestId><HostId>xxxx</HostId></Error>]]></Policy>

Current Behavior

The request id, error code and error message are null.

Steps to Reproduce (for bugs)

try {
	S3Client.create().getBucketPolicy(x -> x.bucket("my-bucket"));
}
catch (S3Exception e) {
	// prints "null" instead of the x-amz-request-id header value
	log.info(e.requestId());

	// prints "null" instead of "The bucket policy does not exist"
	log.info(e.awsErrorDetails().errorMessage());

	// prints "null" instead of "NoSuchBucketPolicy"
	log.info(e.awsErrorDetails().errorCode());
}

Your Environment

  • AWS Java SDK version used: 2.4.6
@zoewangg
Copy link
Contributor

Thank you for reporting! The fix has been merged and will be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants