NetworkChannel.getOption(...) throws java.lang.AssertionError: Option not found
Norman Maurer
norman.maurer at googlemail.com
Wed Aug 8 17:43:19 UTC 2018
Just to add some more informations, this also happens on Linux.
To workaround this I opened the following PR in netty:
https://github.com/netty/netty/pull/8183 <https://github.com/netty/netty/pull/8183>
Let me know if you need any more infos or if I should open a bug-report.
Bye
Norman
> On 8. Aug 2018, at 19:18, Norman Maurer <norman.maurer at googlemail.com> wrote:
>
> Hi,
>
> I just wanted to double check that I am not doing something wrong here.
>
> This code will throw an java.lang.AssertionError: Option not found :
>
>
> public static void main(String[] args) throws IOException {
> getAllSupportedOptions(DatagramChannel.open());
> getAllSupportedOptions(SocketChannel.open());
> getAllSupportedOptions(ServerSocketChannel.open());
> }
>
> private static void getAllSupportedOptions(NetworkChannel channel) throws IOException {
> try {
> for (SocketOption<?> option : channel.supportedOptions()) {
> channel.getOption(option);
> }
> } finally {
> channel.close();
> }
> }
>
>
> It throws for ServerSocketChannel. The option that throws here is IP_TOS which is returned by supportedOptions().
>
> We recently got this reported in netty where we make use of such a pattern:
>
> https://github.com/netty/netty/issues/8182 <https://github.com/netty/netty/issues/8182>
>
> If this sounds like a bug (I am very confident it is one) I can create an issue.
>
> This happens on latest java8, 9, 10 and 11 on MacOS. I did not test Linux yet.
>
> As a side-note it would be nice if the AssertionError would have included the option for which it throws.
>
> Thanks,
> Norman
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180808/2c65606a/attachment.html>
More information about the nio-dev
mailing list