SCLContext sclContext = SCLContext.getCurrent();
Object oldPrinter = sclContext.put(SCLReportingHandler.REPORTING_HANDLER, printer);
Object oldGraph = sclContext.put("graph", graph);
- fn.apply(Tuple0.INSTANCE);
- sclContext.put(SCLReportingHandler.REPORTING_HANDLER, oldPrinter);
- sclContext.put("graph", oldGraph);
+ try {
+ fn.apply(Tuple0.INSTANCE);
+ } finally {
+ sclContext.put(SCLReportingHandler.REPORTING_HANDLER, oldPrinter);
+ sclContext.put("graph", oldGraph);
+ }
}
});