Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353814 - ExternalModelManager#extractJar - prove for NPE
Summary: ExternalModelManager#extractJar - prove for NPE
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux
: P3 trivial (vote)
Target Milestone: 3.7.1   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 352196
Blocks:
  Show dependency tree
 
Reported: 2011-08-03 15:08 EDT by Curtis Windatt CLA
Modified: 2011-08-25 17:30 EDT (History)
5 users (show)

See Also:
ankur_sharma: review+
daniel_megert: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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