Fix to http://jira.diamond.ac.uk/browse/DAWNSCI-890
Changed to Java7 compatible code.