Tapestry 5
  1. Tapestry 5
  2. TAP5-573

NullPointerException during AJAX form submit

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.1
    • Fix Version/s: 5.1.0.2
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      To reproduce this bug:

      Relevant part of the stack trace:

      java.lang.NullPointerException
      at org.apache.tapestry5.dom.Element.createNamespaceURIToPrefix(Element.java:676)
      at org.apache.tapestry5.dom.Element.toMarkup(Element.java:333)
      at org.apache.tapestry5.dom.Element.writeChildMarkup(Element.java:870)
      at org.apache.tapestry5.dom.Element.toMarkup(Element.java:386)
      at org.apache.tapestry5.dom.Element.writeChildMarkup(Element.java:870)
      at org.apache.tapestry5.dom.Element.toMarkup(Element.java:386)
      at org.apache.tapestry5.dom.Element.writeChildMarkup(Element.java:870)
      at org.apache.tapestry5.dom.Element.getChildMarkup(Element.java:883)
      at org.apache.tapestry5.internal.services.PageRenderQueueImpl.renderPartial(PageRenderQueueImpl.java:163)

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        Frustrating that the example doesn't build:

        [ERROR] BUILD FAILED
        [ERROR] Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
        org.hibernate:hibernate-commons-annotations:jar:3.3.0.GA

        from the specified remote repositories:
        central (http://repo1.maven.org/maven2),
        ars-machina (http://www.arsmachina.com.br/maven/release),
        maven (http://repo1.maven.org/maven2),
        jboss (http://repository.jboss.org/maven2/),
        localhost.nu (http://www.localhost.nu/java/mvn)
        Path to dependency:
        1) br.com.arsmachina:example:jar:1.0
        2) br.com.arsmachina:generic-dao-hibernate:jar:1.1
        3) org.hibernate:hibernate-commons-annotations:jar:3.3.0.GA

        Trying to patch it ...

        Show
        Howard M. Lewis Ship added a comment - Frustrating that the example doesn't build: [ERROR] BUILD FAILED [ERROR] Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata. org.hibernate:hibernate-commons-annotations:jar:3.3.0.GA from the specified remote repositories: central ( http://repo1.maven.org/maven2 ), ars-machina ( http://www.arsmachina.com.br/maven/release ), maven ( http://repo1.maven.org/maven2 ), jboss ( http://repository.jboss.org/maven2/ ), localhost.nu ( http://www.localhost.nu/java/mvn ) Path to dependency: 1) br.com.arsmachina:example:jar:1.0 2) br.com.arsmachina:generic-dao-hibernate:jar:1.1 3) org.hibernate:hibernate-commons-annotations:jar:3.3.0.GA Trying to patch it ...
        Hide
        Thiago H. de Paula Figueiredo added a comment -

        The dependency should be 3.3.0.ga, not 3.3.0.GA. Changing the example's pom.xml Hibernate Annotations should be enough. Strangely, it works here. Windows case sensitivity maybe?

        Show
        Thiago H. de Paula Figueiredo added a comment - The dependency should be 3.3.0.ga, not 3.3.0.GA. Changing the example's pom.xml Hibernate Annotations should be enough. Strangely, it works here. Windows case sensitivity maybe?
        Hide
        Howard M. Lewis Ship added a comment -

        Not seeing any particular reason for the problem you are seeing.

        You should be returning the zone's body (getFormZone().getBody()) to update the Zone after submission (in Ajax mode).

        The XML namespaces look normal, no different from anything in the Tapestry test suite.

        Slight different with the DOCTYPE; I'm experimenting using

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

        instead of

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

        Interesting that Woodstox seems to supply a default XML namespace seemingly derived from the doctype. Investigating.

        Show
        Howard M. Lewis Ship added a comment - Not seeing any particular reason for the problem you are seeing. You should be returning the zone's body (getFormZone().getBody()) to update the Zone after submission (in Ajax mode). The XML namespaces look normal, no different from anything in the Tapestry test suite. Slight different with the DOCTYPE; I'm experimenting using <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> instead of <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Interesting that Woodstox seems to supply a default XML namespace seemingly derived from the doctype. Investigating.
        Hide
        Howard M. Lewis Ship added a comment -

        Ok, I've managed to reproduce this using a very simple page:

        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
        <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
        <body>

        <h1>Outside of zone</h1>

        <p>Current time is
        <span id="outernow">$

        {now}</span>
        </p>


        <h2>Inside of zone</h2>
        <t:zone t:id="zone">

        <p>Current time is
        <span id="innernow">${now}

        </span>
        </p>

        <t:form zone="zone">
        <input type="submit" value="Update Zone"/>
        </t:form>
        </t:zone>
        </body>

        </html>

        Show
        Howard M. Lewis Ship added a comment - Ok, I've managed to reproduce this using a very simple page: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <body> <h1>Outside of zone</h1> <p>Current time is <span id="outernow">$ {now}</span> </p> <h2>Inside of zone</h2> <t:zone t:id="zone"> <p>Current time is <span id="innernow">${now} </span> </p> <t:form zone="zone"> <input type="submit" value="Update Zone"/> </t:form> </t:zone> </body> </html>
        Hide
        Thiago H. de Paula Figueiredo added a comment -

        "You should be returning the zone's body (getFormZone().getBody()) to update the Zone after submission (in Ajax mode)."

        That's something new to me. The documentation just says that the event handler must return a component, and Zone is a component. I've doing this for a long time (since T5 has Zones, actually) and this exception only ocurrs with 5.1.0.0+, not with 5.0.18 or past versions. Maybe we should update the docs. Anyway, shouldn't Tapestry handle a Zone event handler return?

        Show
        Thiago H. de Paula Figueiredo added a comment - "You should be returning the zone's body (getFormZone().getBody()) to update the Zone after submission (in Ajax mode)." That's something new to me. The documentation just says that the event handler must return a component, and Zone is a component. I've doing this for a long time (since T5 has Zones, actually) and this exception only ocurrs with 5.1.0.0+, not with 5.0.18 or past versions. Maybe we should update the docs. Anyway, shouldn't Tapestry handle a Zone event handler return?
        Hide
        Alfie Kirkpatrick added a comment -

        Hi, I can see this is fixed but right now I am stuck between TAP5-602 and this issue. Is there a workaround in the meantime? I am simply returning a block from my action handler. Thanks.

        Show
        Alfie Kirkpatrick added a comment - Hi, I can see this is fixed but right now I am stuck between TAP5-602 and this issue. Is there a workaround in the meantime? I am simply returning a block from my action handler. Thanks.
        Hide
        Alfie Kirkpatrick added a comment -

        I am also seeing this error when returning a block from an event handler but only when my block contains nested elements. If it contains plain text it works fine.

        Show
        Alfie Kirkpatrick added a comment - I am also seeing this error when returning a block from an event handler but only when my block contains nested elements. If it contains plain text it works fine.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Thiago H. de Paula Figueiredo
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development