amazonwebservices/aws-sdk-for-java — pull request #25 by lgfischer (2012-09-15 01:28:35+00:00)
Title: NullPointerException in case of permission denied errors

There are cases that the instantiation of the JobStatusMonitor class will fail, for example, if the credentials used don't have permissions to access the required resources.

If the instantiation of the JobStatusMonitor fail (lines 320 or 322 of the ArchiveTransferManager.java file), an exception describing the error will be thrown. But the finally clause at the end of the method will call shutdown() on an null object, resulting in a new NullPointerException. This new exception makes hard to the user to know what failed during the API execution.

This change checks if the jobStatusMonitor variable is not null before calling shutdown(). This way, if an error occurs, the exception with a clear message can be caught by the user.