Upplication / Amazon-S3-FileSystem-NIO2

An S3 File System Provider for Java 7
MIT License
122 stars 67 forks source link

Patch AmazonS3Exception when invoking `Files.newInputStream` method #35

Closed pditommaso closed 9 years ago

pditommaso commented 9 years ago

When creating a new input stream with the API call Files.newInputStream a AmazonS3Exception is thrown instead of a NoSuchFileException resulting in the following strack trace:

com.amazonaws.services.s3.model.AmazonS3Exception: The specified key does not exist.
    at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:679) ~[aws-java-sdk-1.5.6.jar:na]
    at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:350) ~[aws-java-sdk-1.5.6.jar:na]
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:202) ~[aws-java-sdk-1.5.6.jar:na]
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3037) ~[aws-java-sdk-1.5.6.jar:na]
    at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:955) ~[aws-java-sdk-1.5.6.jar:na]
    at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:845) ~[aws-java-sdk-1.5.6.jar:na]
    at com.upplication.s3fs.AmazonS3Client.getObject(AmazonS3Client.java:80) ~[nxf-s3fs-0.2.8b.jar:na]
    at com.upplication.s3fs.S3FileSystemProvider.newInputStream(S3FileSystemProvider.java:258) ~[nxf-s3fs-0.2.8b.jar:na]
    at java.nio.file.Files.newInputStream(Files.java:108) ~[na:1.7.0_75]

The proposed pull request fix this issue.

jarnaiz commented 9 years ago

Thanks!

I Merged manually in the master branch. If something is wrong please, tell me.