Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.3
    • Fix Version/s: 4.1.5
    • Component/s: None
    • Labels:
      None

      Description

      When i prepared to hack asset "clientValidationScript" in form.jwc from "classpath:/dojo-0.4.3/dojo3.js" to "/mypath/dojo-0.4.3/dojo3.js" for some reasons (main is that i hate private assets,)))

      error happend:

      java.lang.NullPointerException
      Stack Trace:

      • $AssetFactory_1178ab8d243._getStrategy(Ljava/lang/Object;)Lorg/apache/tapestry/asset/AssetFactory;($AssetFactory_1178ab8d243.java:???)
      • $AssetFactory_1178ab8d243.createAsset(Lorg/apache/hivemind/Resource;Lorg/apache/hivemind/Location;)Lorg/apache/tapestry/IAsset;($AssetFactory_1178ab8d243.java:???)
      • $AssetFactory_1178ab8d094.createAsset(Lorg/apache/hivemind/Resource;Lorg/apache/hivemind/Location;)Lorg/apache/tapestry/IAsset;($AssetFactory_1178ab8d094.java:???)
      • org.apache.tapestry.util.PageRenderSupportImpl.writeExternalScripts(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(PageRenderSupportImpl.java:291)
      • org.apache.tapestry.util.PageRenderSupportImpl.writeBodyScript(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(PageRenderSupportImpl.java:320)
      • org.apache.tapestry.services.impl.DefaultResponseBuilder.writeBodyScript(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(DefaultResponseBuilder.java:349)
      • $ResponseBuilder_1178ab8d204.writeBodyScript(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V($ResponseBuilder_1178ab8d204.java:???)
      • $ResponseBuilder_1178ab8d0a6.writeBodyScript(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V($ResponseBuilder_1178ab8d0a6.java:???)
      • org.apache.tapestry.html.Body.renderComponent(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(Body.java:62)
      • org.apache.tapestry.AbstractComponent.render(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(AbstractComponent.java:725)
      • org.apache.tapestry.services.impl.DefaultResponseBuilder.render(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRender;Lorg/apache/tapestry/IRequestCycle;)V(DefaultResponseBuilder.java:179)
      • org.apache.tapestry.AbstractComponent.renderBody(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(AbstractComponent.java:539)
      • org.apache.tapestry.html.Shell.renderComponent(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(Shell.java:124)
      • org.apache.tapestry.AbstractComponent.render(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(AbstractComponent.java:725)
      • org.apache.tapestry.services.impl.DefaultResponseBuilder.render(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRender;Lorg/apache/tapestry/IRequestCycle;)V(DefaultResponseBuilder.java:179)
      • org.apache.tapestry.BaseComponent.renderComponent(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(BaseComponent.java:107)
      • org.apache.tapestry.AbstractComponent.render(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(AbstractComponent.java:725)
      • org.apache.tapestry.services.impl.DefaultResponseBuilder.render(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRender;Lorg/apache/tapestry/IRequestCycle;)V(DefaultResponseBuilder.java:179)
      • org.apache.tapestry.BaseComponent.renderComponent(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(BaseComponent.java:107)
      • org.apache.tapestry.AbstractComponent.render(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRequestCycle;)V(AbstractComponent.java:725)
      • org.apache.tapestry.services.impl.DefaultResponseBuilder.render(Lorg/apache/tapestry/IMarkupWriter;Lorg/apache/tapestry/IRender;Lorg/apache/tapestry/IRequestCycle;)V(DefaultResponseBuilder.java:177)
      • org.apache.tapestry.AbstractPage.renderPage(Lorg/apache/tapestry/services/ResponseBuilder;Lorg/apache/tapestry/IRequestCycle;)V(AbstractPage.java:249)
        .....

      In org.apache.tapestry.form.FormSupportImpl.java , line 568-573
      IAsset clientScript = _form.getAsset("clientValidationScript");

      if (clientScript != null)

      { _pageRenderSupport.addExternalScript(_form, clientScript.getResourceLocation()); }

      before hacking, clientScript is PrivateAsset. now in my case, is an ExternalAsset instance.

      here clientScript.getResourceLocation() returns always null, because ExternalAsset 's constructor: (ExternalAsset .java line 36-41)

      public ExternalAsset(String URL, Location location)

      { super(null, location); _url = URL; }

      So _pageRenderSupport.addExternalScript(_form, null), and so, in org.apache.tapestry.util.PageRenderSupportImpl.java line 289-291:
      Resource scriptLocation = (Resource) _externalScripts.get;

      IAsset asset = _assetFactory.createAsset(scriptLocation, null);

      will throw a NPE in enhanced AssetFactory because null scriptLocationResource can't match a strategy.

      I think in constructor of ExternalAsset , let resourceLocation null is arbitrary. should change to :
      super(new ExternalResource(URL, null), location);

      And add another construtor to corresponse creation in org.apache.tapestry.asset.DefaultAssetFactory (line 55-58):
      public IAsset createAsset(Resource resource, Location location)

      { return new ExternalAsset(resource.getPath(), location); // can change to new ExternalAsset(resource, location) if that. }

      After all, let me pass a user defind asset to Form.jwc like as Shell.jwc is a better way. )

        Activity

        Hide
        Andreas Andreou added a comment -

        This can be done easily in 4.1.4-SNAPSHOT, see:
        http://tapestry.apache.org/tapestry4.1/ajax/beyonddojo.html

        You can replace all js files tapestry uses from that simple configuration point.

        Show
        Andreas Andreou added a comment - This can be done easily in 4.1.4-SNAPSHOT, see: http://tapestry.apache.org/tapestry4.1/ajax/beyonddojo.html You can replace all js files tapestry uses from that simple configuration point.
        Hide
        Andreas Andreou added a comment -

        Yep, verified that this works for 4.1.4

        Show
        Andreas Andreou added a comment - Yep, verified that this works for 4.1.4

          People

          • Assignee:
            Andreas Andreou
            Reporter:
            sorphi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development