29 lines
1012 B
Plaintext
29 lines
1012 B
Plaintext
![]() |
=== Related: RSPEC-5754
|
|||
|
|
|||
|
=== On 2014-10-14T21:21:47Z Freddy Mallet Wrote:
|
|||
|
@Ann, could you provide the source of this RSPEC because would like to double-check the main goal of this rule ? For sure here the code snippets are really misleading because we could have the feeling that when the execution of a Runnable class is interrupted, this exception can be caught in the ``++run++`` method which is not at all the case.
|
|||
|
|
|||
|
=== On 2014-10-15T11:59:38Z Ann Campbell Wrote:
|
|||
|
\[~freddy.mallet] \https://twitter.com/aparnachaudhary/status/520952677631807488
|
|||
|
|
|||
|
=== On 2019-09-04T20:33:20Z Réda Housni Alaoui Wrote:
|
|||
|
Hi,
|
|||
|
|
|||
|
|
|||
|
I think the rule derived from this spec is too narrow.
|
|||
|
|
|||
|
Many people write ``++catch (Exception e)++`` in their applications.
|
|||
|
|
|||
|
|
|||
|
Following this spec, IMO, that means that any ``++catch(Exception e)++`` must ALWAYS be preceded by a catch of InterruptedException like this
|
|||
|
|
|||
|
----
|
|||
|
catch (InterruptedException e) {
|
|||
|
Thread.currentThread().interrupt();
|
|||
|
} catch (Exception e) {
|
|||
|
//...
|
|||
|
}{code}
|
|||
|
|
|||
|
----
|
|||
|
|