Community
Participate
Working Groups
Marking e1 will mark both URLs but the second one is never caught by e1 but by e2. try { URL u1 = new URL("mal://formed"); try { URL u2 = new URL("mal://formed"); } catch( Exception e2 ) { } } catch( Exception e1 ) { }
Not critical for 3.0
Deferred.
*** Bug 222814 has been marked as a duplicate of this bug. ***
In the following snippet select 'Exception' in the throws clause => all three throw statements are marked even though 2 of the exceptions are caught. ---------------------------------------------------------------------------- void foo(String s) throws Exception { try { if (s == null) throw new NullPointerException(); else if (s.length() > 10) throw new IllegalArgumentException(); else throw new Exception(); } catch (NullPointerException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } } ----------------------------------------------------------------------------
Created attachment 201636 [details] fix+tests The fix is on the lines of the functionality/code already there in MethodExitsFinder. (Also I have added the tests to MarkOccurrenceTest17 and not to MarkOccurrenceTest because MarkOccurrenceTest is set up differently and it is just simpler to add new tests to MarkOccurrenceTest17)
Raksha, Markus can you please review the changes ? Note that I created the patch against HEAD.
(In reply to comment #6) > Raksha, Markus can you please review the changes ? Note that I created the > patch against HEAD. Looks good. +1. You could may be replace '*Catched*' by '*Caught*' everywhere? , sounds better :)
Strictly speaking this is not a 3.7.1 candidate. It made it on the 3.7.1 list while working on Java 7 support, see bug 351441 comment3. >Note that I created the patch against HEAD. I see that. Restructuring code should not happen for maintenance fixes. The changes should be as minimal as possible to fix the problem at hand. In that sense, the given patch is too big to fix a 3.4 problem. If you attach a new patch with only the relevant changes and fix the typo that Raksha mentioned, then it might get the +1.
Created attachment 201727 [details] final fix + tests (In reply to comment #7) > You could may be replace '*Catched*' by '*Caught*' everywhere? > , sounds better :) Also fixed in MethodExitsFinder.
(In reply to comment #8) > Strictly speaking this is not a 3.7.1 candidate. Moving it to 3.8. Fixed in HEAD.
Verified in 3.8 (I20110912-2126) and 4.2 (I20110912-0200).