Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-7943

[Java Broker] The result of the interpolation this: differs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • Future
    • Broker-J
    • None

    Description

      The Broker's string resolution system org.apache.qpid.server.util.Strings#expand()} uses an OwnAttributeResolver to allow an object's attributes to be interpolated into string values. This is provided by the this:<attribute name> syntax.

      I have noticed that the value yielded by the expansion this:<attribute name> within a context variable varies depending on where the context variable is defined.

      Imagine a context variable foo set with the value "${this:bar}".

      1. If the context variable comes from the environment or from a managed context default, the this: resolves at the target object. (i.e. targetObject.getContextValue(String.class, "foo") yields a value equivalent to targetObject.getAttribute("bar")).
      2. If the context variable is set on a ancestor object, the resolution takes place at the ancestor ie. (i.e. targetObject.getContextValue(String.class, "foo") yields a value equivalent to targetObject.getParent()...getAttribute("bar"})

      This behaviour surprises me. I don't think it leads to a current functional issue. I think all our existing usages of this: are within managed context defaults (fall into category 1).

      Attachments

        Activity

          People

            Unassigned Unassigned
            kwall Keith Wall
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: