MCPcopy Create free account
hub / github.com/antlr/codebuff / close

Method close

corpus/java/training/guava/io/Closer.java:210–232  ·  view source on GitHub ↗

Closes all Closeable instances that have been added to this Closer. If an exception was thrown in the try block and passed to one of the exceptionThrown methods, any exceptions thrown when attempting to close a closeable will be suppressed. Otherwise, the first excepti

()

Source from the content-addressed store, hash-verified

208 * additional exceptions that are thrown after that will be suppressed.
209 */
210 @Override
211 public void close() throws IOException {
212 Throwable throwable = thrown;
213
214 // close closeables in LIFO order
215 while (!stack.isEmpty()) {
216 Closeable closeable = stack.removeFirst();
217 try {
218 closeable.close();
219 } catch (Throwable e) {
220 if (throwable == null) {
221 throwable = e;
222 } else {
223 suppressor.suppress(closeable, throwable, e);
224 }
225 }
226 }
227
228 if (thrown == null && throwable != null) {
229 Throwables.propagateIfPossible(throwable, IOException.class);
230 throw new AssertionError(throwable); // not possible
231 }
232 }
233
234 /**
235 * Suppression strategy interface.

Callers 15

writeMethod · 0.95
writeFromMethod · 0.95
isEmptyMethod · 0.95
sizeMethod · 0.95
copyToMethod · 0.95
readMethod · 0.95
contentEqualsMethod · 0.95
sliceStreamMethod · 0.95
readMethod · 0.95
mapMethod · 0.95
writeMethod · 0.95
writeLinesMethod · 0.95

Calls 4

propagateIfPossibleMethod · 0.95
isEmptyMethod · 0.65
suppressMethod · 0.65
removeFirstMethod · 0.45

Tested by

no test coverage detected