Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-2089

Element Path from Parser inside explanation for ComponentDefinitionException

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Blueprint
    • Our environment is basing upon Apache Felix.

    Description

      We are writing our blueprint XML definitions by hand, which sometimes leads to error messages by org.apache.aries.blueprint.parser.Parser. As these error messages do not show the exact position / path inside the XML, we are required to retrace our modifications and manually search for the real culprit.

      However, this could be made far easier, if we would know the element (and it's path) the Parser is currently working on and for which the ComponentDefinitionExceptions was thrown, i.e. add the getErrorPath(element) in an exception like.

      throw new ComponentDefinitionException(getErrorPath(element) + 
        "One of " + REF_ATTRIBUTE + " attribute, " + VALUE_ATTRIBUTE + " attribute or sub element must be set");

      Locally, I have already created some quick code to create such an error path adding some key blueprint attributes (starting with id, name, key, class) to retrace the position. If this is added to the explanation as show above, the debugging will get way easier.

      So I should be able to create a PR, if you like me to.

      I would prefer a sub-exception like "ComponentDefinitionElementException" of the OSGI-specified ComponentDefinitionException inside org.osgiservice.blueprint.parser which would access the attribute name constants of Parser.java to add the important ones and prefix the explanation.

      The other idea is putting these methods inside Parser.java and concattenating the explanation strings there, which would still throw a ComponentDefinitionException itself, but has more logic inside Parser.

      Or are those explanation strings regarded as carved in stone?

      Regarding the Parser and its messages, the only open issue I saw was from 2013: ARIES-954

      Attachments

        Activity

          People

            Unassigned Unassigned
            HeikoStudt Heiko Studt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: