<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 05/11/2025 11:10, Pavel Rappo wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAChcVunLQb43mQXdquD+mGj=V792yZKawuukZ_DZFa8f79F6vQ@mail.gmail.com">
<pre wrap="" class="moz-quote-pre">I've seen code that wraps InterruptedException in some other exception
prior to throwing that other exception; for example:
catch (InterruptedException e) {
throw new IOException(e);
}
I wonder if there are any legitimate cases for this, because I cannot
think of any. In my mind, it's always InterruptedException itself that
should be thrown; and if it cannot be done, then the interrupted
status should be set.
</pre>
</blockquote>
Right, if you catch InterruptedException then you should re-throw
it, or reset the interrupted status if continuing or throwing a
different exception. As it happens, I am hoping to adding "Thread
Interruption" section to the Thread class description that includes
guidance on this, and also gives us a place to link to from other
parts of the API docs. Work in progress [1], not a PR as it's ready
for review.<br>
<br>
-Alan<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="https://github.com/openjdk/jdk/compare/master...AlanBateman:jdk:JDK-8371226">https://github.com/openjdk/jdk/compare/master...AlanBateman:jdk:JDK-8371226</a><br>
</body>
</html>