You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2016/10/09 14:16:21 UTC
[jira] [Commented] (FELIX-5371) ComponentDescriptorIO.java relies
on XML tags order
[ https://issues.apache.org/jira/browse/FELIX-5371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15560053#comment-15560053 ]
Carsten Ziegeler commented on FELIX-5371:
-----------------------------------------
Thanks for reporting, it's actually slightly worse, the DS XML schema uses a sequence of
property
properties
service
reference
implementation
which means that usually service always comes before implementation - if the generated XML is valid
So I think we should a) fix the generation of the XML to have the correct order and b) make the read independent of any order
> ComponentDescriptorIO.java relies on XML tags order
> ---------------------------------------------------
>
> Key: FELIX-5371
> URL: https://issues.apache.org/jira/browse/FELIX-5371
> Project: Felix
> Issue Type: Bug
> Components: SCR Tooling
> Affects Versions: scr generator 1.14.0
> Reporter: Sergey Bondarenko
> Assignee: Carsten Ziegeler
> Priority: Critical
> Fix For: maven-scr-plugin 1.23.0, scr ant task 1.16.0, scr generator 1.15.0, scr bnd plugin 1.6.0
>
>
> 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
> {code}
> } 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);
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)