Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369200 - Platform.getResourceBundle should throw exception instead of returning null
Summary: Platform.getResourceBundle should throw exception instead of returning null
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.2 M5   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-20 06:05 EST by Nicolas Bros CLA
Modified: 2012-02-09 13:04 EST (History)
3 users (show)

See Also:


Attachments
stacktrace (5.02 KB, text/plain)
2012-01-20 06:05 EST, Nicolas Bros CLA
no flags Details

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