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

Bug 369200

Summary: Platform.getResourceBundle should throw exception instead of returning null
Product: [Eclipse Project] Platform Reporter: Nicolas Bros <nicolas.bros>
Component: RuntimeAssignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gdupe, remy.suen, tjwatson
Version: 4.2   
Target Milestone: 4.2 M5   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
stacktrace none

Description Nicolas Bros CLA 2012-01-20 06:05:02 EST
Created attachment 209801 [details]
stacktrace

I got the attached NPE when editing a model with the "plugin.properties" file missing in my metamodel's edit plug-in.

Platform.getResourceBundle(getBundle()) returns null when there is no plugin.properties file. I think the getString method should check for this case and return an appropriate (more informative) exception, or a default "missing" string instead of doing an NPE at the end.
Comment 1 Ed Merks CLA 2012-01-20 06:20:44 EST
But the API we call is documented to throw an exception, so apparently it doesn't. 
	
	 * @param bundle the bundle whose resource bundle is being queried
	 * @return the resource bundle
	 * @exception MissingResourceException if the resource bundle was not found
	 * @since 3.0
	 */
	public static ResourceBundle getResourceBundle(Bundle bundle) throws MissingResourceException {
		return InternalPlatform.getDefault().getResourceBundle(bundle);
	}
Comment 2 John Arthorne CLA 2012-01-20 10:03:05 EST
All of our internal callers are expecting MissingResourceException as well. I'll look at fixing this.
Comment 4 Thomas Watson CLA 2012-02-09 13:04:13 EST
(In reply to comment #2)
> All of our internal callers are expecting MissingResourceException as well.
> I'll look at fixing this.

Hmmm, seems this is causing bug371103.