Inner class ResourceMap loading by ResourceManager

  2 posts   Feedicon  
Replies: 1 - Last Post: February 11, 2010 09:27
by: Anonymous User
showing 1 - 2 of 2
 
Posted: December 07, 2009 10:08 by Craig Ringer

... is evil.

ResourceManager "helpfully" strips the class name down to just the simple, unqualified inner class name and tries to load a properties map for that. So, for MyClass$InnerClass, rather than the obvious and expected:

MyClass$InnerClass.properties

you must provide:

InnerClass.properties

To top it off, this behavior appears to be basically undocumented. It's mentioned on the javadoc of the private method ResourceManager.classBundleBaseName(Class cls), but that won't help most users. I wasted a bit of time tracking it down as I wondered why my private inner Task subclasses weren't getting their resources properly...

I've added a note to the public method ResourceManager.getResourceMap() but I still think this behaviour, documented or not, is unintuitive and painful.

I'd like to look for the inner class's resource bundle by fully-qualified name first, as for any other class. If no properties file is found for the fully qualified name it should fall back on the current behaviour and check for a properties file by "simple name".

Opinions?

(Oh, and speaking of evil, BBCode is argh especially as implemented on Kenai.)

 
Posted: February 11, 2010 09:27 by Anonymous User
I definitely agree! Thank you for ur tip!
Replies: 1 - Last Post: February 11, 2010 09:27
by: Anonymous User
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close