Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353814

Summary: ExternalModelManager#extractJar - prove for NPE
Product: [Eclipse Project] PDE Reporter: Curtis Windatt <curtis.windatt.public>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: VERIFIED FIXED QA Contact:
Severity: trivial    
Priority: P3 CC: ankur_sharma, curtis.windatt.public, daniel_megert, ed, karsten.thoms
Version: 3.7Flags: ankur_sharma: review+
daniel_megert: review+
Target Milestone: 3.7.1   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 352196    
Bug Blocks:    

Description Curtis Windatt CLA 2011-08-03 15:08:10 EDT
+++ This bug was initially created as a clone of Bug #352196 +++

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) {
Comment 1 Curtis Windatt CLA 2011-08-03 15:08:29 EDT
Cloned for backport to 3.7.1
Comment 2 Curtis Windatt CLA 2011-08-11 17:24:49 EDT
Released to 3.7.1
Comment 3 Curtis Windatt CLA 2011-08-17 09:42:03 EDT
As per http://www.eclipse.org/eclipse/development/plans/freeze_plan_3_7_1.php
this bug needs a review+ on the patch from another committer and a review+ from
a component lead to be committed into 3.7.1.

Ankur and Dani, please review.
Comment 4 Ankur Sharma CLA 2011-08-17 14:28:15 EDT
+1
Comment 5 Curtis Windatt CLA 2011-08-18 17:16:24 EDT
Fix is released for 3.7.1.  Ankur's review satisfies the SR1 freeze requirements.
Comment 6 Curtis Windatt CLA 2011-08-25 17:30:03 EDT
Verified