Take advantage of Java 7 constructs

Try with resource, and diamond-notation.
Fix broken calls to String.format()