Skip to content

Instantly share code, notes, and snippets.

@kana
Created June 8, 2011 09:28
Show Gist options
  • Save kana/1014094 to your computer and use it in GitHub Desktop.
Save kana/1014094 to your computer and use it in GitHub Desktop.
try ResourceSpecification
Block
{
final VariableModifiers_minus_final R #resource = Expression;
Throwable #primaryException = null;
try ResourceSpecificationtail
Block
catch (final Throwable #t) {
#primaryException = t;
throw #t;
} finally {
if (#primaryException != null) {
try {
#resource.close();
} catch(Exception #suppressedException) {
#primaryException.addSuppressedException(#suppressedException);
}
} else {
#resource.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment