Tapestry
  1. Tapestry
  2. TAPESTRY-560

Poor reporting of missing specification file

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      winxp, Java5, Jboss 4.0.2/Tomcat

      Description

      stacktrace

      • org.apache.tapestry.util.xml.DocumentParseException.<init>(DocumentParseException.java:45)
      • org.apache.tapestry.parse.SpecificationParser.parseDocument(SpecificationParser.java:1676)
      • org.apache.tapestry.parse.SpecificationParser.parsePageSpecification(SpecificationParser.java:1736

      Looking at the code (and running it through the debugger), I found out that the url was null even though the resouce is not.

      URL resourceURL = resource.getResourceURL();
      if (resourceURL == null)
      throw new DocumentParseException(ParseMessages.missingResource(resource), resource,null);

      I'm using Tap 4.0, my application file contains the following :
      <page name="Home" specification-path="/test/web/pages/Home.page"/>

      and the Home.page looks like

      <?xml version="1.0"?>

      <page-specification class="org.apache.tapestry.html.BasePage"/>

      the problem is .

      according to the DTD the specification-path attribute in the page element is the "resource classpath". So this should be something like /my/package/name, alas the ContextResource class of Hivemind obtains the URL of the Resource via the ServletContext, which is NOT by classpath but by path in the servletcontext so like /WEB-INF/classes/my/package/name. Prefixing it with classpath or context don't seem to work.

      <!-- =======================================================
      Element: page
      Contained by: application, library-specification

      Defines a single page within the application. Each application will contain
      at least one of these, to define the Home page.

      Attributes:
      name: A unique name for the application.
      specification-path: The resource classpath of the component specification for the page.
      -->

        Issue Links

          Activity

          Koen Serry created issue -
          Howard M. Lewis Ship made changes -
          Field Original Value New Value
          Assignee Howard M. Lewis Ship [ hlship ]
          Hide
          Howard M. Lewis Ship added a comment -

          An NPE inside the constructor for DocumentParseException makes it really hard to figure out what went wrong.

          In addition, should be possible to use a classpath: or context: prefix on the specification-path attribute of the <page> element.

          Show
          Howard M. Lewis Ship added a comment - An NPE inside the constructor for DocumentParseException makes it really hard to figure out what went wrong. In addition, should be possible to use a classpath: or context: prefix on the specification-path attribute of the <page> element.
          Howard M. Lewis Ship made changes -
          Summary NullPointerException while parsing page spec. Poor reporting of missing specificaiton file
          Description stacktrace

             * org.apache.tapestry.util.xml.DocumentParseException.<init>(DocumentParseException.java:45)
             * org.apache.tapestry.parse.SpecificationParser.parseDocument(SpecificationParser.java:1676)
             * org.apache.tapestry.parse.SpecificationParser.parsePageSpecification(SpecificationParser.java:1736

          Looking at the code (and running it through the debugger), I found out that the url was null even though the resouce is not.

              URL resourceURL = resource.getResourceURL();
                 if (resourceURL == null)
                      throw new DocumentParseException(ParseMessages.missingResource(resource), resource,null);


          I'm using Tap 4.0, my application file contains the following :
          <page name="Home" specification-path="/test/web/pages/Home.page"/>

          and the Home.page looks like

          <?xml version="1.0"?>
          <!DOCTYPE page-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 4.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
          <page-specification class="org.apache.tapestry.html.BasePage"/>


          the problem is .

          according to the DTD the specification-path attribute in the page element is the "resource classpath". So this should be something like /my/package/name, alas the ContextResource class of Hivemind obtains the URL of the Resource via the ServletContext, which is NOT by classpath but by path in the servletcontext so like /WEB-INF/classes/my/package/name. Prefixing it with classpath or context don't seem to work.

          <!-- =======================================================
          Element: page
          Contained by: application, library-specification

          Defines a single page within the application. Each application will contain
          at least one of these, to define the Home page.

          Attributes:
           name: A unique name for the application.
           specification-path: The resource classpath of the component specification for the page.
          -->
          stacktrace

             * org.apache.tapestry.util.xml.DocumentParseException.<init>(DocumentParseException.java:45)
             * org.apache.tapestry.parse.SpecificationParser.parseDocument(SpecificationParser.java:1676)
             * org.apache.tapestry.parse.SpecificationParser.parsePageSpecification(SpecificationParser.java:1736

          Looking at the code (and running it through the debugger), I found out that the url was null even though the resouce is not.

              URL resourceURL = resource.getResourceURL();
                 if (resourceURL == null)
                      throw new DocumentParseException(ParseMessages.missingResource(resource), resource,null);


          I'm using Tap 4.0, my application file contains the following :
          <page name="Home" specification-path="/test/web/pages/Home.page"/>

          and the Home.page looks like

          <?xml version="1.0"?>

          <page-specification class="org.apache.tapestry.html.BasePage"/>


          the problem is .

          according to the DTD the specification-path attribute in the page element is the "resource classpath". So this should be something like /my/package/name, alas the ContextResource class of Hivemind obtains the URL of the Resource via the ServletContext, which is NOT by classpath but by path in the servletcontext so like /WEB-INF/classes/my/package/name. Prefixing it with classpath or context don't seem to work.

          <!-- =======================================================
          Element: page
          Contained by: application, library-specification

          Defines a single page within the application. Each application will contain
          at least one of these, to define the Home page.

          Attributes:
           name: A unique name for the application.
           specification-path: The resource classpath of the component specification for the page.
          -->
          Howard M. Lewis Ship made changes -
          Link This issue is cloned as TAPESTRY-595 [ TAPESTRY-595 ]
          Howard M. Lewis Ship made changes -
          Summary Poor reporting of missing specificaiton file Poor reporting of missing specification file
          Howard M. Lewis Ship made changes -
          Priority Critical [ 2 ] Major [ 3 ]
          Howard M. Lewis Ship made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Fix Version/s 4.0 [ 10794 ]
          Resolution Fixed [ 1 ]
          Hide
          Koen Serry added a comment -

          Just tracked down the error a bit further.
          Since the rootCause is null, the constructor of DocumentParseException throws a NPE itself as well.
          The check for resource should probably be the one for rootCause.

          Show
          Koen Serry added a comment - Just tracked down the error a bit further. Since the rootCause is null, the constructor of DocumentParseException throws a NPE itself as well. The check for resource should probably be the one for rootCause.
          Howard M. Lewis Ship made changes -
          Link This issue is duplicated by TAPESTRY-548 [ TAPESTRY-548 ]
          Mark Thomas made changes -
          Workflow jira [ 12323401 ] Default workflow, editable Closed status [ 12569073 ]
          Mark Thomas made changes -
          Workflow Default workflow, editable Closed status [ 12569073 ] jira [ 12590359 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          11d 11h 38m 1 Howard M. Lewis Ship 26/Aug/05 07:34

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Koen Serry
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development