You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Andrew Pimlott (JIRA)" <ji...@apache.org> on 2011/05/20 21:01:48 UTC

[jira] [Created] (FELIX-2962) SCR doesn't detect invalid XML

SCR doesn't detect invalid XML
------------------------------

                 Key: FELIX-2962
                 URL: https://issues.apache.org/jira/browse/FELIX-2962
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
    Affects Versions:  scr-1.6.0
            Reporter: Andrew Pimlott


The XML parser used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041116#comment-13041116 ] 

Felix Meschberger commented on FELIX-2962:
------------------------------------------

Added some checking code to ensure certain situations cause an Exception being thrown in Rev. 1129144:

  <a>  -- new: throws a ParseException now, used to be silently ignored
  </a>  -- already threw an exception
  <a><b></a></b> -- already threw an exception

the new check mechanism particularly should prevent cases like
   <scr:component ....>
      ....
   <scr:component>

Does this work for you ?

> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>              Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-2962.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: scr-1.6.2
         Assignee: Felix Meschberger

Thanks for the feedback. Thus resolving fixed.

> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>            Assignee: Felix Meschberger
>              Labels: xml
>             Fix For: scr-1.6.2
>
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038422#comment-13038422 ] 

Felix Meschberger commented on FELIX-2962:
------------------------------------------

Thanks for the samples. We can see what we can do.

>  I filed this issue because I got a totally misleading error message when I tried to start my bundle, where the root cause was malformed XML

Understandable. But you have to also understand that we cannot fix things if you don't show what is broken.

For example "attached file xxx is broken XML and the message I got logged was yyy."

Thanks for your comprehension.

> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>              Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Andrew Pimlott (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038180#comment-13038180 ] 

Andrew Pimlott commented on FELIX-2962:
---------------------------------------

I can immediately offer (each line a complete example of a malformed XML file accepted by Felix SCR):

<a>
</a>
<a><b></a></b>

The XML 1.1 spec says that XML processors "must report violations of this specification's well-formedness constraints".  I would expect that if any of these were used as a Service-Component, I would get an exception about malformed XML from Bundle.start.

Beyond the correctness issue, quality of diagnostics is a key differentiator between implementations of OSGi, since they all follow the same spec.  I filed this issue because I got a totally misleading error message when I tried to start my bundle, where the root cause was malformed XML.  Worse, I want to write a program on top of Felix that accepts bundles.  If I can't provide accurate diagnostics to users about errors in their bundles, it hurts the quality of my program.

> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>              Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Andrew Pimlott (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038756#comment-13038756 ] 

Andrew Pimlott commented on FELIX-2962:
---------------------------------------

You're right, I should give a real-world example.  The one that tripped me is copy-n-pasted from page 145 of the OSGi 4.2 Enterprise Specification:

  <xml version="1.0" encoding="UTF-8">
  <scr:component name="example.handler"
     xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
     <implementation class="com.acme.HandlerImpl"/>
     <property name="event.topics">some/topic</property>
     <service>
        <provide interface=
           "org.osgi.service.event.EventHandler"/>
     </service>
  <scr:component>

Note the typo where the final tag is an open tag instead of a close.  (I reported this to OSGi: https://www.osgi.org/bugzilla/show_bug.cgi?id=120.)

When I started the service, I got this error:
ERROR: org.example.bundle (3): [null] Cannot register Component
org.osgi.service.component.ComponentException: Component null validation failed: Implementation class name missing
        at org.apache.felix.scr.impl.metadata.ComponentMetadata.validationFailure(ComponentMetadata.java:777)
        at org.apache.felix.scr.impl.metadata.ComponentMetadata.validate(ComponentMetadata.java:645)
        at org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:241)
        at org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147)
        at org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111)
        at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:285)
        at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:203)
        at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)
        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3833)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1803)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:927)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:914)
        at Try.main(Try.java:78)

Actually, my component was successfully registered.  The error is about the empty component started by the second <scr:component> tag.  But due to this message, I went crazy trying to figure out what was wrong with my <implementation> tag.

> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>              Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger closed FELIX-2962.
------------------------------------


Close after release
                
> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>            Assignee: Felix Meschberger
>              Labels: xml
>             Fix For: scr-1.6.2
>
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Andrew Pimlott (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Pimlott updated FELIX-2962:
----------------------------------

    Description: The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.  (was: The XML parser used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.)

> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>              Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Andrew Pimlott (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13044422#comment-13044422 ] 

Andrew Pimlott commented on FELIX-2962:
---------------------------------------

This solves my case, thank you.

> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>              Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041083#comment-13041083 ] 

Felix Meschberger commented on FELIX-2962:
------------------------------------------

Excellent. Thanks, this helps.

> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>              Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (FELIX-2962) SCR doesn't detect invalid XML

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037870#comment-13037870 ] 

Felix Meschberger commented on FELIX-2962:
------------------------------------------

Thanks for reporting.

We use a "real" parser since KXml is a fast, light-weight, real parser. Hence I do not consider replacing the parser at this point in time.

But, I admit, that error reporting my be improved and you could help us do that !

If you could provide invalid XML and state the expected behaviour (in terms of logging, I would assume), this would help use improving error reporting. Thanks alot !



> SCR doesn't detect invalid XML
> ------------------------------
>
>                 Key: FELIX-2962
>                 URL: https://issues.apache.org/jira/browse/FELIX-2962
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions:  scr-1.6.0
>            Reporter: Andrew Pimlott
>              Labels: xml
>
> The XML parser (kxml2) used by SCR doesn't detect many forms of incorrect XML, even basic errors like mismatched start and end tags.  This makes diagnosing component load errors very frustrating.  Please use a real XML parser.  It will save developers a lot of pain.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira