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

put key requests against moto server fail using Java AWS SDK #854

Closed
MChamberlin opened this issue Mar 3, 2017 · 2 comments
Closed

put key requests against moto server fail using Java AWS SDK #854

MChamberlin opened this issue Mar 3, 2017 · 2 comments

Comments

@MChamberlin
Copy link
Contributor

MChamberlin commented Mar 3, 2017

An Exception is raised when writing keys to the moto S3 server using the Java AWS SDK:

com.amazonaws.AmazonClientException: Unable to complete transfer: null
	at com.amazonaws.services.s3.transfer.internal.AbstractTransfer.unwrapExecutionException(AbstractTransfer.java:277)
	at com.amazonaws.services.s3.transfer.internal.AbstractTransfer.rethrowExecutionException(AbstractTransfer.java:261)
	at com.amazonaws.services.s3.transfer.internal.AbstractTransfer.waitForCompletion(AbstractTransfer.java:103)
Caused by: java.lang.NullPointerException: null
	at com.amazonaws.util.BinaryUtils.fromHex(BinaryUtils.java:61)
	at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1441)
	at com.amazonaws.services.s3.transfer.internal.UploadCallable.uploadInOneChunk(UploadCallable.java:135)
	at com.amazonaws.services.s3.transfer.internal.UploadCallable.call(UploadCallable.java:127)
	at com.amazonaws.services.s3.transfer.internal.UploadMonitor.call(UploadMonitor.java:129)
	at com.amazonaws.services.s3.transfer.internal.UploadMonitor.call(UploadMonitor.java:50)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

The key is actually written correctly and I can access it using the python boto client. I've identified the issue as a mis-labeled field in the HTTP response for key PUT requests. The problem (and solution) are basically identical to that described in this Stack Overflow post. One of the returned metadata fields is named etag in moto, while the correct field name expected by the Java AWS SDK client is ETag.

@MChamberlin
Copy link
Contributor Author

I've submitted a PR for the fix here.

@spulec
Copy link
Collaborator

spulec commented Mar 5, 2017

Fixed with #855

@spulec spulec closed this as completed Mar 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants