Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.7.1
-
None
-
None
Description
org.apache.openejb.util.PropertyPlaceHolderHelper.PropertiesLookup should not cache SystemInstance.get().getProperties() as this leads to race conditions and rare test failures where test order is not guaranteed. The following illustrates the issue.
SystemInstance.get().setProperty("PropertyPlaceHolderTest1", "bob");
final String bob = PropertyPlaceHolderHelper.simpleValue("j${PropertyPlaceHolderTest1}");
SystemInstance.get().setProperty("PropertyPlaceHolderTest1", "sally");
final String sally = PropertyPlaceHolderHelper.simpleValue("j${PropertyPlaceHolderTest1}");
sally == "bob" <-- As PropertiesLookup is using cached properties from first call.
Calling PropertyPlaceHolderHelper .reset() on SystemInstance.get().setProperty() calls could be an option, but would force a loader dep on core, or moving PropertyPlaceHolderHelper to loader could be an option if it does not break anything.