Removed unused exception.
Updated code to provide compatibility with Java 1.6.