Skip to content
Permalink
Browse files

Merge pull request #133 from jenkinsci/jtnord-patch-1

[JENKINS-39835] - Be extra defensive about Errors and Exceptions
  • Loading branch information
oleg-nenashev committed Dec 22, 2016
2 parents b50beca + ec9b5c1 commit 32674f6221cb93c7b5217231afc1b5fbec554d77
Showing with 11 additions and 7 deletions.
  1. +11 −7 src/main/java/org/jenkinsci/remoting/protocol/impl/NIONetworkLayer.java
@@ -177,15 +177,19 @@ public void ready(boolean accept, boolean connect, boolean read, boolean write)
}
recvKey.cancel();
onRecvClosed();
} catch (RuntimeException e) {
} catch (Throwable t) {
// this should *never* happen... but just in case it does we will log & close connection
if (LOGGER.isLoggable(Level.WARNING)) {
LogRecord record = new LogRecord(Level.WARNING, "[{0}] Uncaught {1}");
record.setThrown(e);
record.setParameters(new Object[]{stack().name(), e.getClass().getSimpleName()});
try {
if (LOGGER.isLoggable(Level.SEVERE)) {
LogRecord record = new LogRecord(Level.SEVERE, "[{0}] Uncaught {1}");
record.setThrown(t);
record.setParameters(new Object[]{stack().name(), t.getClass().getSimpleName()});
}
} finally {
// incase this was an OOMErr and logging caused another OOMErr
recvKey.cancel();
onRecvClosed();
}
recvKey.cancel();
onRecvClosed();
} finally {
release(recv);
}

0 comments on commit 32674f6

Please sign in to comment.