[jsword-devel] MsgBase bug

DM Smith jsword-devel@crosswire.org
Wed, 07 Apr 2004 12:43:14 -0400


The init method in MsgBase is static and initializes a static resources 
(ResourceBundle).

Each call to init from a different package replaces the one shared global 
resources object with another.

At this time there are no implementations of ResourceBundles for MsgBase and 
its Msg derivatives so it has not impacted the program.

I am changing MsgBase so that resources is a local member variable of a 
MsgBase object. This exposes a weakness in it being implemented as an Enum. 
Each MsgBase object represents a single entry in the ResourceBundle and each 
MsgBase object calls ResourceBundle.getResource(...).

The details of how ResourceBundle.getResource works is implementation 
dependant, but an implementation is free to cache the resource bundle or get 
it for each invocation. I have heard that the SunVM gets it once. I think 
that we will ultimately need to redesign it so that it gets the resource 
once for all Msgs using that resource.

I'll do that when I get back after vacation. For now I will just fix the 
immediate problem and rely on the implementation dependant behavior. I'll 
send a patch later today.

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963