Welcome to JavaPorn, a blog dedicated to horrible java code
Here is the first piece of code ; it is used in a project to circumvent a parsing issue that throws OutOfMemoryError. Yes OutOfMemoryError !! (see
SANSELAN-3 on ASF Jira)
try {
IImageMetadata metadata = Sanselan.getMetadata(new File(sourcePath));
// process stuff here 
} catch (OutOfMemoryError oome) {
// do nothing here. see https://issues.apache.org/jira/browse/SANSELAN-3 for an explanation
log.warn("Please resolve cleanly ASF SANSELAN-3, catching an OOME is so crappy");
}