Priority
Normal
Type
Bug 
State
Fixed 
Assignee
Bas Leijdekkers 
Subsystem
Code Analysis. Inspection 
Affected versions
Fixed in
Fixed in build
Next build 
Build
7318
Fixed in build
8148
Severity
0
  • Submitted by   Michael Besosa
    2 years ago (03 Oct 2007 19:02)
  • Updated by   root
    3 weeks ago (17 Jan 2010 19:53)
  • Jira: IDEA-41316
    (history, comments)

IDEA-41316

"Exception immediately rethrown" false positive

1
The "exception immediately rethrown" inspection fires (erroneously) on the following code:

try {
    Thread.sleep(aWhile);
} catch (InterruptedException ex) {
    if (acknowledgeInterruptAndStop()) throw ex;
}


The method {{acknowledgeInterruptAndStop}} implements the thread termination policy. It doesn't seem to me that this inspection should fire if the exception is conditionally rethrown.



Environment: Windows XP SP2.

Issue was resolved
Comments (1)
 
History (1)
 
Links
 
Nicolas Raynaud
  Nicolas Raynaud
13 Jan 2008 18:22
(2 years ago)
#permalink
other sample :
@SuppressWarnings({"CaughtExceptionImmediatelyRethrown"}) protected static Method getActionMethod(final Class<?> actionClass, final String methodName) throws NoSuchMethodException { Method method; try { method = actionClass.getMethod(methodName, NO_PARAMS); } catch (NoSuchMethodException e) { // hmm -- OK, try doXxx instead try { final String altMethodName = "do" + methodName.substring(0, 1).toUpperCase() + methodName.substring(1); method = actionClass.getMethod(altMethodName, NO_PARAMS); } catch (NoSuchMethodException e1) { // throw the original one throw e; } } return method; }

It is far from being immediately rethrown ...