You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by ri...@peoplesoft.com on 2004/11/03 22:52:06 UTC
Possible problem with wsrp4j exception messages...
I've been noticing that when exceptions occur while using the runtime I
never see the explanation message. I started to dig around and noticed that
the messages.properties file in the org/apache/wsrp4j/exception package
(controlled by Messages.java in the same directory) seems to never be
loaded into memory. I looked closer at the Messages.java and saw only two
methods, a private constructor that loads the properties file into a
private member, and a get method that never calls the private constructor
and only does a get on the private member...
Can someone tell me what I'm missing?
Thanks for your time...
Re: Possible problem with wsrp4j exception messages...
Posted by Diego Louzán <di...@metalicana.org>.
Ok, I've checked it and in fact it's a bug. The problem is that the
constructor actually never gets called and so the properties attribute is
empty. If you replace the private constructor with a static block and change
the getClass method call for a reference to Messages.class (as in a static
context you can't call getClass method) everything works. Replacing getClass()
with Messages.class could introduce some minor issues with the classpath at
runtime, but since this is a class used only with a static method, that should
be no problem. I've attached a patch below and created an issue on Jira.
Diego.
64a65
>
66,70c67
< /**
< Private constructor loads messages from
<code>messages.properties</code> file in
< <code>org.apache.wsrp4j.exception</code>
< */
< private Messages()
---
> static
72d68
<
76c72
< InputStream in =
getClass().getClassLoader().getResourceAsStream(FILE_MSG_PROPERTIES);
---
> InputStream in =
Messages.class.getClassLoader().getResourceAsStream(FILE_MSG_PROPERTIES);