Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-35324

NullPointerException when setting property of class that doesn't exist in fx namespace

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Apache FalconJX 0.7.0, Apache FalconJX 0.8.0
    • None
    • Falcon
    • None

    Description

      Using the following code:

      src/NullExceptionFX.mxml
      <?xml version="1.0" encoding="utf-8"?>
      <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      	xmlns:js="library://ns.apache.org/flexjs/basic">
      	<fx:Declarations>
      		<fx:Fake test="test"/>
      	</fx:Declarations>
      	<js:initialView>
      		<js:View>
      			<js:Label id="label" text="Hello World" x="100" y="100"/>
      		</js:View>
      	</js:initialView>
      	<js:valuesImpl>
      		<js:SimpleCSSValuesImpl />
      	</js:valuesImpl>
      </js:Application>
      

      Compile with js/bin/mxmlc:

      mxmlc src/NullExceptionFX.mxml
      

      The following error will be included in the output:

      Unexpected exception 'java.lang.NullPointerException'.
      

      There is no stack trace with this exception.

      If you change the namespace from fx to js, you get a proper compiler error instead of an exception.

      <js:Fake test="test"/>
      
      NullExceptionFX.mxml(5): col: 3 This tag is unexpected. It will be ignored.
      
                      <js:Fake test="test"/>
      

      With that in mind, I guess it must be treating the fx namespace as special and it's taking a different path.

      If you leave out the property, you also get a NullPointerException:

      <fx:Fake/>
      

      And this one includes a stack trace:

      java.lang.NullPointerException org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitter.emitInstance(MXMLFlexJSEmitter.java:1751)org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker.visitInstance(MXMLBlockWalker.java:246)org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch.handle(MXMLNodeSwitch.java:96)org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker.walk(MXMLBlockWalker.java:149)org.apache.flex.compiler.internal.codegen.mxml.MXMLEmitter.emitDeclarations(MXMLEmitter.java:105)org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitter.emitDeclarations(MXMLFlexJSEmitter.java:507)org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker.visitDeclarations(MXMLBlockWalker.java:198)org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch.handle(MXMLNodeSwitch.java:78)org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker.walk(MXMLBlockWalker.java:149)org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitter.emitDocument(MXMLFlexJSEmitter.java:546)org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSBlockWalker.visitDocument(MXMLFlexJSBlockWalker.java:69)org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch.handle(MXMLNodeSwitch.java:84)org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker.walk(MXMLBlockWalker.java:149)org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSBlockWalker.visitFile(MXMLFlexJSBlockWalker.java:61)org.apache.flex.compiler.internal.visitor.mxml.MXMLNodeSwitch.handle(MXMLNodeSwitch.java:90)org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker.walk(MXMLBlockWalker.java:149)org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker.visitCompilationUnit(MXMLBlockWalker.java:168)org.apache.flex.compiler.internal.codegen.mxml.MXMLWriter.writeTo(MXMLWriter.java:72)org.apache.flex.compiler.clients.MXMLJSCFlex.compile(MXMLJSCFlex.java:377)org.apache.flex.compiler.clients.MXMLJSCFlex._mainNoExit(MXMLJSCFlex.java:245)org.apache.flex.compiler.clients.MXMLJSCFlex.mainNoExit(MXMLJSCFlex.java:202)org.apache.flex.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:352)org.apache.flex.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:287)org.apache.flex.compiler.clients.MXMLJSC.staticMainNoExit(MXMLJSC.java:247)org.apache.flex.compiler.clients.MXMLJSC.main(MXMLJSC.java:229)
      

      Can reproduce with both FlexJS 0.7.0 and the latest 0.8.0 release branch nightly.

      Attachments

        Activity

          People

            Unassigned Unassigned
            joshtynjala Josh Tynjala
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: