Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2591

BeansXmlStreamParser does not correctly handle namespaces

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.1.1.Final, 3.0.6.Final
    • Fix Version/s: 3.1.2.Final
    • Component/s: None
    • Labels:
      None
    • Environment:

      EAP 7.2 / Red Hat Enterprise Linux Server release 7.6 (Maipo)

    • Steps to Reproduce:
      Hide

      Attempt to use alternatives in the following XML file:

      beans.xml
      <beans
              xmlns="http://java.sun.com/xml/ns/javaee" 
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
              xmlns:weld="http://jboss.org/schema/weld/beans">
          <weld:scan>
              <weld:exclude name="my.package.ExcludeThis"/>
          </weld:scan>
          <alternatives>
              <class&gt;
                  my.package.UseThis
              </class&gt;
          </alternatives>
      </beans>
      
      Show
      Attempt to use alternatives in the following XML file: beans.xml <beans xmlns= "http: //java.sun.com/xml/ns/javaee" xmlns:xsi= "http: //www.w3.org/2001/XMLSchema-instance" xmlns:weld= "http: //jboss.org/schema/weld/beans" > <weld:scan> <weld:exclude name= "my. package .ExcludeThis" /> </weld:scan> <alternatives> < class& gt; my. package .UseThis </ class& gt; </alternatives> </beans>

      Description

      When parsing a beans.xml, and entering /beans/scan, the XML stream parser accepts a number of namespaces defined in org.jboss.weld.xml.BeansXmlStreamParser.SCANNING_URIS.

      When a matching element is found, execution will jump to parseScan. This method in turn will continue until the expression isEnd(event, SCAN) is true. isEnd(XMLEvent, String) will call isEnd(event, name, JAVAEE_URIS).

      SCANNING_URIS is a super set of JAVAEE_URIS with the additional entry http://jboss.org/schema/weld/beans_; it is thus possible to start parsing a scan element, but if using the _weld namespace, parsing will not stop until the end of the stream is reached. Because of the forgiving nature of the parser, no error messages will be generated.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                manovotn Matěj Novotný
                Reporter:
                henpal_truesec Henrik Palmér
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: