Hello all.

I have opened JIRA with instructions to replicate. See

https://issues.apache.org/jira/browse/TAP5-438

for more information.

 - Ville

Ps. Can someone please confirm that this replicates, or is it just my
environment? It's hard to believe that this kind of bug would have been
unnoticed for so long.. I'm running the test using production-mode = false.


Ville Virtanen wrote:
> 
> Forgot to mention that I'm using 5.0.18.
> 
>  - Ville
> 
> 
> Ville Virtanen wrote:
>> 
>> Hello,
>> 
>> I have a mixin that takes two Any components as parameters. As long as
>> the Any components are *before* the mixin in the template everything is
>> ok, but if I move the Any component after the mixin (after the component
>> that contains the mixin) it throws nullpointer while trying to access the
>> client id.
>> 
>> Small part from Any.java:
>>      public String getClientId()
>>     {
>>         if (uniqueId == null)
>>         {
>>             uniqueId = renderSupport.allocateClientId(clientId);
>>             anyElement.forceAttributes("id", uniqueId);
>>         }
>> 
>>         return uniqueId;
>>     }
>> 
>> The anyElement is always null if the mixin is before the anyElement in
>> the template. Should the any component do some initialization there if
>> anyElement is null?
>> 
>>  - Ville
>> 
>> The mixin:
>>     @Parameter(allowNull=true,defaultPrefix="component")
>>     private Any sumField;
>> 
>>     @Parameter(allowNull=true,defaultPrefix="component")
>>     private Any priceField;
>> 
>>     /**
>>      * The field component to which this mixin is attached.
>>      */
>>     @InjectContainer
>>     private ClientElement clientElement;
>> 
>>     @Environmental
>>     private RenderSupport renderSupport;
>> 
>>     @Inject
>>     private ComponentResources componentResources;
>> 
>>     void afterRender(MarkupWriter writer) throws Exception
>>     {
>>         String df =
>> JSUtil.commaSeparatedListToJSStringArray(disableFields);
>>         String ccf =
>> JSUtil.commaSeparatedListToJSStringArray(classChangeFields);
>>         String sumFieldString = "";
>>         if(componentResources.isBound("sumField")){
>>             sumFieldString = sumField.getClientId();
>>         }
>>         String priceFieldString = "";
>>         if(componentResources.isBound("priceField")){
>>             priceFieldString = priceField.getClientId();
>>         }
>> 
>>         renderSupport.addScript("disableAndChangeElements('%s', '%s',
>> '%s', %s, %s, '%s', '%s');", clientElement.getClientId(),
>> enabledCssClass, disabledCssClass, ccf, df, sumFieldString,
>> priceFieldString);
>>     }
>> 
>> And the stacktrace:
>>         *
>> org.apache.tapestry5.corelib.components.Any.getClientId(Any.java:75)
>>         *
>> com.orient.web.customer.mixins.DisableAndChangeClass.afterRender(DisableAndChangeClass.java:63)
>>         *
>> com.orient.web.customer.mixins.DisableAndChangeClass.afterRender(DisableAndChangeClass.java)
>>         *
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$6$1.run(ComponentPageElementImpl.java:203)
>>         *
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:925)
>>         *
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$200(ComponentPageElementImpl.java:50)
>>         *
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl$6.render(ComponentPageElementImpl.java:207)
>>         *
>> org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72)
>>         *
>> org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:121)
>>         *
>> org.apache.tapestry5.services.TapestryModule$19.renderMarkup(TapestryModule.java:1200)
>>         *
>> org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:1580)
>>         *
>> org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:1561)
>>         *
>> org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:1543)
>>         *
>> org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.java:1525)
>>         *
>> org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:1495)
>>         *
>> org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:64)
>>         *
>> org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:57)
>>         *
>> org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:59)
>>         *
>> org.apache.tapestry5.services.TapestryModule$35.handle(TapestryModule.java:1779)
>>         *
>> com.orient.framework.tapestry.filter.ProtectedPageFilterImpl.handle(ProtectedPageFilterImpl.java:51)
>>         *
>> org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRenderDispatcher.java:92)
>>         *
>> org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:71)
>>         *
>> org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:1029)
>>         *
>> org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
>>         *
>> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>>         *
>> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:621)
>>         *
>> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:611)
>>         *
>> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
>>         *
>> com.orient.web.customer.services.CustomerclientModule$1.service(CustomerclientModule.java:334)
>>         *
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
>>         *
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
>>         *
>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
>>         *
>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
>>         *
>> org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:1007)
>>         *
>> org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
>>         *
>> com.orient.web.customer.services.CustomerclientModule$3.service(CustomerclientModule.java:393)
>>         *
>> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>>         *
>> org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
>>         *
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
>>         *
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
>>         *
>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>         *
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>         *
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:756)
>>         *
>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
>>         *
>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
>>         *
>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>>         *
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>         * org.mortbay.jetty.Server.handle(Server.java:324)
>>         *
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
>>         *
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:826)
>>         * org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:523)
>>         *
>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>         *
>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:377)
>>         *
>> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
>>         *
>> org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:635)
>>         *
>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:497)
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-T5--Any-component-nullpointer-tp21255662p21275661.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to