You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/02/23 00:43:12 UTC
svn commit: r630356 - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry/internal/services/ test/app1/ test/app1/css/
test/java/org/apache/tapestry/integration/
test/java/org/apache/tapestry/integration/app1/pages/
Author: hlship
Date: Fri Feb 22 15:43:04 2008
New Revision: 630356
URL: http://svn.apache.org/viewvc?rev=630356&view=rev
Log:
TAPESTRY-2184: Null pointer exception when creating an action link during a component event request
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ActionViaLinkDemo.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ActionViaLinkDemo.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java?rev=630356&r1=630355&r2=630356&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java Fri Feb 22 15:43:04 2008
@@ -131,6 +131,9 @@
Page activePage = _pageRenderQueue.getRenderingPage();
+ // See TAPESTRY-2184
+ if (activePage == null) activePage = page;
+
String[] activationContext = collectActivationContextForPage(activePage);
ComponentInvocation invocation = new ComponentInvocationImpl(target, contextStrings, activationContext);
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ActionViaLinkDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ActionViaLinkDemo.tml?rev=630356&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ActionViaLinkDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ActionViaLinkDemo.tml Fri Feb 22 15:43:04 2008
@@ -0,0 +1,22 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+
+
+ <t:if test="message">
+ <p>
+ <strong>
+ <span id="message">${message}</span>
+ </strong>
+ </p>
+ </t:if>
+
+ <p>
+ Update the message:
+
+ <ul>
+ <li>
+ <a href="${actionURL}">via explicit Link creation</a>
+ </li>
+ </ul>
+ </p>
+
+</html>
\ No newline at end of file
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css?rev=630356&r1=630355&r2=630356&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/css/app.css Fri Feb 22 15:43:04 2008
@@ -18,7 +18,7 @@
/** Copy of "#right h3" */
DIV#left H3 {
- background: #4A1605 url( images/rightbig.gif ) no-repeat;
+ background: #4A1605 url( ../layout/images/rightbig.gif ) no-repeat;
height: 30px;
line-height: 30px;
color: #fff;
@@ -29,7 +29,7 @@
/* Copy of ".menu h4" */
DIV.t-env-data-section {
- background: #4A1605 url( images/rightsmall.gif ) no-repeat;
+ background: #4A1605 url( ../layout/images/rightsmall.gif ) no-repeat;
height: 20px;
line-height: 20px;
color: #fff;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=630356&r1=630355&r2=630356&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Fri Feb 22 15:43:04 2008
@@ -1718,4 +1718,15 @@
assertText("//h1", "Tapestry 5 Integration Application 1");
}
+
+ /**
+ * TAPESTRY-2184
+ */
+ @Test
+ public void create_action_link_while_not_rendering()
+ {
+ start("Action via Link Demo", "via explicit Link creation");
+
+ assertText("message", "from getActionURL()");
+ }
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ActionViaLinkDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ActionViaLinkDemo.java?rev=630356&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ActionViaLinkDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/ActionViaLinkDemo.java Fri Feb 22 15:43:04 2008
@@ -0,0 +1,54 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.integration.app1.pages;
+
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.Link;
+import org.apache.tapestry.annotations.Persist;
+import org.apache.tapestry.ioc.annotations.Inject;
+
+public class ActionViaLinkDemo
+{
+ @Persist("flash")
+ private String _message;
+
+ @Inject
+ private ComponentResources _resources;
+
+ Object[]
+ onPassivate()
+ {
+ return new Object[] { };
+ }
+
+ public String getMessage()
+ {
+ return _message;
+ }
+
+ void onUpdateMessage(String message)
+ {
+ getActionURL();
+
+ _message = message;
+ }
+
+ public String getActionURL()
+ {
+ Link link = _resources.createActionLink("UpdateMessage", false, "from getActionURL()");
+
+ return link.toURI();
+ }
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java?rev=630356&r1=630355&r2=630356&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java Fri Feb 22 15:43:04 2008
@@ -62,6 +62,8 @@
private static final List<Item> ITEMS = CollectionFactory.newList(
new Item("actionpage", "Action Page", "tests fixture for ActionLink component"),
+ new Item("ActionViaLinkDemo", "Action via Link Demo", "tests creating an action link explicitly"),
+
new Item("FormFragmentDemo", "Form Fragment Demo", "page with dynamic form sections"),
new Item("BooleanDemo", "Boolean Property Demo", "demo boolean properties using both is and get prefixes"),