Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-1465

org.apache.openejb.util.PropertyPlaceHolderHelper.PropertiesLookup caches properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.1
    • 7.0.0-M1
    • 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.

      Attachments

        Activity

          People

            andyg Andy Gumbrecht
            andyg Andy Gumbrecht
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: