void (Closeable closeable, Processor<? super Exception> exceptionProcessor) { //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (closeable) { try { closeable.close(); } catch (IOException e) { exceptionProcessor.process(new BuildDataCorruptedException(e)); } catch (Exception e) { exceptionProcessor.process(e); } } }