You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If multiple threads attempt to close a collection at the same time, there's a chance that a NoSuchElementException will be raised:
@Override
public void close()
throws E
{
E e = null;
while (!this.stack.isEmpty()) {
final AutoCloseable resource = this.stack.pop();
try {
resource.close();
} catch (final Exception re) {
if (e == null) {
e = this.exceptions.get();
}
e.addSuppressed(re);
}
}
if (e != null) {
throw e;
}
}
The this.stack.isEmpty() and this.stack.pop() lines result in a time-of-check-time-of-use issue. The stack could have been popped in between the two calls.
The text was updated successfully, but these errors were encountered:
If multiple threads attempt to close a collection at the same time, there's a chance that a
NoSuchElementException
will be raised:The
this.stack.isEmpty()
andthis.stack.pop()
lines result in a time-of-check-time-of-use issue. The stack could have been popped in between the two calls.The text was updated successfully, but these errors were encountered: