Re: Resource Bundle Problem (sometimes)

Kris Schneider <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
Quoting Marius Botha <[email protected]>:

> Hi there,
> 
> I have my own tag (extending BodyTagSupport) in which I do the following:
> 
> <code>
> ResourceBundle resources = ResourceBundle.getBundle("application");
> out.print(resources.getString("key"));
> </code>
> 
> This works great ... most of the time. However, the moment I put this tag
> into another tag that I wrote (a Data Table Tag - extending LoopTagSupport)
> I get the following exception(below). For some reason it seems to find the "
> application.properties" resource file when my tag is on its own somewhere on
> the JSP, but when I try to use it in another tag, it doesn't work. Any
> ideas?
> 
> Much appreciated.
> 
> Marius Botha
> 
> Exception:
> java.util.MissingResourceException: Can't find resource for bundle
> java.util.PropertyResourceBundle, key
> java.util.ResourceBundle.getObject(ResourceBundle.java:326)
> java.util.ResourceBundle.getString(ResourceBundle.java:286)
> com.workpool.struts.component.html.MessageTag.doEndTag(MessageTag.java:32)

The stack trace seems to indicate that the property file is located just fine,
but that the file does not contain a key called "key". If the property file
could not be located, ResourceBundle.getBundle() should be throwning the
exception, not ResourceBundle.getString().

-- 
Kris Schneider <mailto:[email protected]>
D.O.Tech       <http://www.dotech.com/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.