8231921: (se) SelectorImpl.register does not need to set the attachment when it is null

Reviewed-by: bpb
This commit is contained in:
Alan Bateman 2019-10-08 10:58:36 +01:00
parent f8f7cdcbe3
commit 51e94d8dac
2 changed files with 15 additions and 9 deletions

View file

@ -208,7 +208,8 @@ public abstract class SelectorImpl
if (!(ch instanceof SelChImpl))
throw new IllegalSelectorException();
SelectionKeyImpl k = new SelectionKeyImpl((SelChImpl)ch, this);
k.attach(attachment);
if (attachment != null)
k.attach(attachment);
// register (if needed) before adding to key set
implRegister(k);