Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-5371

ComponentDescriptorIO.java relies on XML tags order

    XMLWordPrintableJSON

    Details

      Description

      The parser relies implicitly on an order of tags in a component descriptor XML.
      https://github.com/apache/felix/blob/1efe76fff7f4dcc5da5aa450ee8e7a774c874256/tools/org.apache.felix.scr.generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java#L546

                      } else if (localName.equals(IMPLEMENTATION)) {
                          ...
                          this.currentClass = new ClassDescription(cl, "classpath:" + className);
                          ...
                      } else if (localName.equals(SERVICE)) {
      
                          this.currentService = new ServiceDescription(null);
                          this.currentClass.add(this.currentService);
      

      This chunk of code expects <implementation> tag to happen before <service> tag. If the order is reversed, then parsing files with NullPointerException when trying to call "add" on an uninitialized variable.

        Attachments

          Activity

            People

            • Assignee:
              cziegeler Carsten Ziegeler
              Reporter:
              enterit Sergey Bondarenko
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: