Rethrow Error during retrieving remoteAddress / localAddress

Motivation:

Besides an error caused by closing socket in Windows a bunch of other errors may happen at this place which won't be somehow logged. For instance any VirtualMachineError as OutOfMemoryError will be simply ignored. The library should at least log the problem.

Modification:

Added logging of the throwable object.

Result:

Fixes #8499.
This commit is contained in:
Andremoniy 2018-11-16 17:20:28 +01:00 committed by Norman Maurer
parent cb0d23923f
commit abc8a08c96

View File

@ -170,6 +170,8 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
if (localAddress == null) {
try {
this.localAddress = localAddress = unsafe().localAddress();
} catch (Error e) {
throw e;
} catch (Throwable t) {
// Sometimes fails on a closed socket in Windows.
return null;
@ -192,6 +194,8 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
if (remoteAddress == null) {
try {
this.remoteAddress = remoteAddress = unsafe().remoteAddress();
} catch (Error e) {
throw e;
} catch (Throwable t) {
// Sometimes fails on a closed socket in Windows.
return null;