问题
Is it possbile to use other locations besides US-standard for S3 buckets with JGit (ie. through the config file etc.) or am I doing something wrong here?
If I try to use a S3 bucket with JGit that is located in EU, jgit throws an error
-> jgit push origin master
Counting objects: 3
Finding sources: 100% (3/3)
Getting sizes: 100% (2/2)
Compressing objects: 100% (1/1)
Writing objects: 100% (3/3)
java.lang.NullPointerException
at org.eclipse.jgit.transport.AmazonS3.error(AmazonS3.java:518)
at org.eclipse.jgit.transport.AmazonS3.putImpl(AmazonS3.java:505)
...
But when I try to use a bucket that is located in US-Standard, then everything works fine.
-> git push origin master
Counting objects: 3
Finding sources: 100% (3/3)
Getting sizes: 100% (2/2)
Compressing objects: 100% (1/1)
Writing objects: 100% (3/3)
Put pack-132548a..idx: 100% (1/1)
To amazon-s3://.jgit@usreponame/chef-receipes.git
* [new branch] master -> master
回答1:
The NullPointerException
is occurring because of a bug in JGit. The Amazone S3 API is returning a code that is neither a 200 or a 500 and JGit is trying to read the error stream from the connection and is not guarding against a null error stream.
I have pushed a proposed fix for this issue here.
Once this change is applied the actual response code should appear in the exception message which will hopefully make it clear why it is failing.
来源:https://stackoverflow.com/questions/9566354/jgit-s3-support-for-standard-us-buckets-only