RFR 8199437 [11]Improve diagnostic system assertion message in com.sun.net.httpserver impl

Daniel Fuchs daniel.fuchs at oracle.com
Wed Mar 14 14:39:10 UTC 2018


Hi Chris,

key.interestOps() might throw CancelledKeyException in
which case you may trade an AssertionError for a
CancelledKeyException when building the assertion
message.

Maybe some of the other methods you call on key need
to be checked as well.

best regards,

-- daniel

On 14/03/2018 14:05, Alan Bateman wrote:
> Looks good.
> 
> On 14/03/2018 13:16, Chris Hegarty wrote:
>> An odd assertion has been observed in the com.sun.net
>> HTTP Server code, that is currently unexplainable. I'd
>> like to add some additional diagnostics information to
>> the assertion so that it may be more helpful if seen
>> again.
>>
>>
>> --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
>> +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
>> @@ -408,7 +408,9 @@
>>                                      }
>>                                      handle (chan, conn);
>>                                  } else {
>> -                                    assert false;
>> +                                    assert false : 
>> String.format("Unexpected non-readable key, where "
>> +                                        + " key's channel:%s, 
>> isValid:%b, interestOps:%d, readyOps:%d",
>> +                                        key.channel(), key.isValid(), 
>> key.interestOps(), key.readyOps());
>>                                  }
>>                              } catch (CancelledKeyException e) {
>>                                  handleException(key, null);
>>
>> -Chris.
> 



More information about the net-dev mailing list