PlatformDependent#getClassLoader fails in restrictive classloader environment

Motivation:
https://github.com/netty/netty/pull/6042 only addressed PlatformDependent#getSystemClassLoader but getClassLoader is also called in an optional manner in some common code paths but fails to catch a general enough exception to continue working.

Modifications:
- Calls to getClassLoader which can continue if results fail should catch Throwable

Result:
More resilient code in the presense of restrictive class loaders.
Fixes https://github.com/netty/netty/issues/6246.
This commit is contained in:
Scott Mitchell 2017-01-18 15:53:20 -08:00
parent afd493362d
commit 7528f1188e
2 changed files with 4 additions and 3 deletions

View File

@ -135,7 +135,7 @@ public class ReferenceCountedOpenSslEngine extends SSLEngine implements Referenc
@SuppressWarnings({ "rawtypes", "unused" })
List serverNames = (List) getServerNamesMethod.invoke(parameters);
setServerNamesMethod.invoke(parameters, Collections.emptyList());
} catch (Throwable ingore) {
} catch (Throwable ignore) {
sniHostNameClass = null;
getAsciiNameMethod = null;
getServerNamesMethod = null;

View File

@ -854,8 +854,9 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH
&& "com.sun.nio.sctp.SctpChannel".equals(clazz.getSuperclass().getName())) {
return true;
}
} catch (ClassNotFoundException e) {
// This should not happen just ignore
} catch (Throwable cause) {
logger.debug("Unexpected exception while loading class {} classname {}",
getClass(), classname, cause);
}
}
}