| Summary: | ExternalModelManager#extractJar - prove for NPE | ||
|---|---|---|---|
| Product: | [Eclipse Project] PDE | Reporter: | Karsten Thoms <karsten.thoms> |
| Component: | UI | Assignee: | Curtis Windatt <curtis.windatt.public> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | trivial | ||
| Priority: | P3 | CC: | curtis.windatt.public, ed |
| Version: | 3.7 | ||
| Target Milestone: | 3.8 M1 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 353814 | ||
In this case, 'f' will never be null. However, 'in' could end up being null, so I have added the null check. Thanks for reporting this. Fixed in HEAD. See ExternalModelManager.java Surely this should be in SR1? See bug 353814 for 3.7.1 inclusion Verified code is in I20110802-2000 |
In the mentioned method the input stream 'in' is closed in the finally block, and any exceptions catched. It can be that 'in' is null, which raises a NullPointerException. Of course this one is catched by the empty catch block, but I think this situation should be proven explicitly. I have usually an exception breakpoint on NullPointerException on when debugging code, and I usually expect NPEs only in the code that I want to debug. So please make this a bit more safer: =============================== try { f.close(); } catch (Exception e) { } try { in.close(); } catch (Exception e) { =============================== Replace by: try { if (f!=null) f.close(); } catch (Exception e) { } try { if (in!=null) in.close(); } catch (Exception e) {