Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355089 - ManifestLocalization.EmptyResource throws NPE on ResourceBundle#containsKey()
Summary: ManifestLocalization.EmptyResource throws NPE on ResourceBundle#containsKey()
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: Juno M2   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-18 10:11 EDT by Thomas Schindl CLA
Modified: 2011-08-22 13:58 EDT (History)
1 user (show)

See Also:


Attachments
patch to return empty enumeration (1.02 KB, text/plain)
2011-08-18 10:11 EDT, Thomas Schindl CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2011-08-18 10:11:23 EDT
Created attachment 201719 [details]
patch to return empty enumeration

The problem is that ResourceBundle#getKeys() contract is not honored appropriately because the method doesn't spec that a return value of null is allowed.

Here's the exception from my application:

java.lang.NullPointerException
	at java.util.ResourceBundle.handleKeySet(ResourceBundle.java:1715)
	at java.util.ResourceBundle.containsKey(ResourceBundle.java:1669)
	at com.bizerba.retail.validation.model.validation.internal.ModelValidationProvider$1.getMessage(ModelValidationProvider.java:105)
Comment 1 Thomas Watson CLA 2011-08-18 16:51:11 EDT
Thanks for the patch Tom.
Comment 2 Thomas Watson CLA 2011-08-18 16:56:02 EDT
Instead of creating a new inner class I prefer to use:

  return Collections.enumeration(Collections.EMPTY_LIST);
Comment 3 Thomas Watson CLA 2011-08-18 16:57:14 EDT
wrong milestone.  I meant Juno :)
Comment 4 Thomas Schindl CLA 2011-08-18 17:42:41 EDT
(In reply to comment #2)
> Instead of creating a new inner class I prefer to use:
> 
>   return Collections.enumeration(Collections.EMPTY_LIST);

Fine too - it was my first implementation too but this generates a warning and Collections.emptyList() is only available since 1.5 and IIRC 1.5 stuff is not supposed to be used, not?

I could naturally add a suppress warning so if you want me to recreate the patch with the above I'm fine with it.
Comment 5 Thomas Watson CLA 2011-08-22 08:27:02 EDT
(In reply to comment #4)
> (In reply to comment #2)
> > Instead of creating a new inner class I prefer to use:
> > 
> >   return Collections.enumeration(Collections.EMPTY_LIST);
> 
> Fine too - it was my first implementation too but this generates a warning and
> Collections.emptyList() is only available since 1.5 and IIRC 1.5 stuff is not
> supposed to be used, not?
> 
> I could naturally add a suppress warning so if you want me to recreate the
> patch with the above I'm fine with it.

No need to create a patch I will use the above line with a suppress warning flag.  Thanks.