Skip to content

Commit 6236ffb

Browse files
Satyen SubramaniamPaul Hohensee
authored andcommitted
8327370: (ch) sun.nio.ch.Poller.register throws AssertionError
Backport-of: d2bebffb1fd26fae4526afd33a818ee776b7102e
1 parent 7141b97 commit 6236ffb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/java.base/share/classes/sun/nio/ch/Poller.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -151,7 +151,12 @@ private void pollIndirect(int fdVal, long nanos, BooleanSupplier supplier) {
151151
private void register(int fdVal) throws IOException {
152152
Thread previous = map.putIfAbsent(fdVal, Thread.currentThread());
153153
assert previous == null;
154-
implRegister(fdVal);
154+
try {
155+
implRegister(fdVal);
156+
} catch (Throwable t) {
157+
map.remove(fdVal);
158+
throw t;
159+
}
155160
}
156161

157162
/**

0 commit comments

Comments
 (0)