How to close AWS connection if there is no such key in the query
问题 I'm using AWS java SDK to upload file on AWS Management Console's Bucket. However, if there is no such file online at first time when I try to get access to it, my code will catch the exception (NoSuchKey). Then I want to close the connection. The problem is I don't have any reference to close that connection because of the exception(The original reference will be null). Here is my code: S3Object object = null; GetObjectRequest req = new GetObjectRequest(bucketName, fileName); try{ logconfig(