History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-23763
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Bas Leijdekkers
Reporter: Michael Besosa
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

"Exception immediately rethrown" false positive

Created: 03 Oct 07 19:02   Updated: 05 Feb 08 17:48
Component/s: Code Analysis. Inspection
Fix Version/s: Diana 8243, Selena 7.0.3

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Windows XP SP2.
Issue Links:
Duplicate
 
This issue is duplicated by:
IDEA-16793 Inspection incorrectly flags code Closed

Build: 7,318
Fixed in build: 8,148
Severity: Medium


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order:
Nicolas Raynaud - 13 Jan 08 18:22
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 ...