You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2014/05/02 10:01:11 UTC

[1/2] git commit: fix a NullPointerException when the conduit is null, e.g. when BeanModel.addEmpty(String) is used

Repository: tapestry-5
Updated Branches:
  refs/heads/master b97d9aa36 -> 7294f9bcb


fix a NullPointerException when the conduit is null, e.g. when BeanModel.addEmpty(String) is used


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a7b45565
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a7b45565
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a7b45565

Branch: refs/heads/master
Commit: a7b455651f22aa7cf82c20e2bdb6ef145bfd1ca6
Parents: b97d9aa
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Fri May 2 09:59:34 2014 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Fri May 2 09:59:34 2014 +0200

----------------------------------------------------------------------
 .../internal/beaneditor/PropertyModelImpl.java  | 23 +++++++++++---------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a7b45565/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/PropertyModelImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/PropertyModelImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/PropertyModelImpl.java
index 3edfaff..703ce44 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/PropertyModelImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/PropertyModelImpl.java
@@ -53,17 +53,20 @@ public class PropertyModelImpl implements PropertyModel
         label = TapestryInternalUtils.defaultLabel(id, messages, name);
 
         // TAP5-2305
-        Sortable sortableAnnotation = conduit.getAnnotation(Sortable.class);
-        if (sortableAnnotation != null) 
+        if (conduit != null)
         {
-            sortable = sortableAnnotation.value();
-        }
-        else
-        {
-            // Primitive types need to be converted to wrapper types before checking to see
-            // if they are sortable.
-            Class wrapperType = PlasticUtils.toWrapperType(getPropertyType());
-            sortable = Comparable.class.isAssignableFrom(wrapperType);
+            Sortable sortableAnnotation = conduit.getAnnotation(Sortable.class);
+            if (sortableAnnotation != null)
+            {
+                sortable = sortableAnnotation.value();
+            }
+            else
+            {
+                // Primitive types need to be converted to wrapper types before checking to see
+                // if they are sortable.
+                Class wrapperType = PlasticUtils.toWrapperType(getPropertyType());
+                sortable = Comparable.class.isAssignableFrom(wrapperType);
+            }
         }
     }
 


[2/2] git commit: TAP5-2311: URL-decode the loadPage parameter to fix reloading of nested pages

Posted by jk...@apache.org.
TAP5-2311: URL-decode the loadPage parameter to fix reloading of nested pages


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7294f9bc
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7294f9bc
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7294f9bc

Branch: refs/heads/master
Commit: 7294f9bcbf15a677cf8ec27a9db2c647d4115d4c
Parents: a7b4556
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Fri May 2 09:46:37 2014 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Fri May 2 10:00:35 2014 +0200

----------------------------------------------------------------------
 .../corelib/pages/ExceptionReport.java          |  5 ++++-
 .../integration/app1/CoreBehaviorsTests.java    | 15 +++++++++++++
 .../tapestry5/integration/app1/pages/Index.java |  4 +++-
 .../pages/nested/PageThatThrowsException.java   | 23 ++++++++++++++++++++
 4 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
index 3676c20..e6db1ed 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
@@ -99,6 +99,9 @@ public class ExceptionReport implements ExceptionReporter
 
     @Inject
     private ReloadHelper reloadHelper;
+    
+    @Inject
+    private URLEncoder urlEncoder;
 
     @Property
     private String rootURL;
@@ -129,7 +132,7 @@ public class ExceptionReport implements ExceptionReporter
     {
         reloadHelper.forceReload();
 
-        return linkSource.createPageRenderLinkWithContext(request.getParameter("loadPage"), reloadContext);
+        return linkSource.createPageRenderLinkWithContext(urlEncoder.decode(request.getParameter("loadPage")), reloadContext);
     }
 
     Object onActionFromReloadRoot() throws MalformedURLException

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
index 1655716..2179b98 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
@@ -1705,4 +1705,19 @@ public class CoreBehaviorsTests extends App1TestCase
         assertTextPresent("Page called with correct activation context",
                 "You should never see me if use an erroneous activation context");
     }
+    
+    /**
+     * TAP5-2311
+     */
+    @Test
+    public void reload_from_nested_page()
+    {
+        openLinks("Reload on nested page");
+
+        assertTextPresent("This page throws an exception");
+        
+        clickAndWait("css=a:contains('Go to page'):contains('with reload')");
+        
+        assertTextPresent("This page throws an exception");
+    }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index fcd8647..bfd68f3 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -559,7 +559,9 @@ public class Index
 
                     new Item("ModuleConfigurationCallbackDemo", "ModuleConfigurationCallback Demo", "Shows an example of changing the Require.js configuration using JavaScriptSupport.addModuleConfigurationDemo()"),
 
-                    new Item("PartialTemplateRendererDemo", "PartialTemplateRenderer Demo", "Shows some examples of rendering blocks and components to a String using PartialTemplateRenderer")
+                    new Item("PartialTemplateRendererDemo", "PartialTemplateRenderer Demo", "Shows some examples of rendering blocks and components to a String using PartialTemplateRenderer"),
+
+                    new Item("nested/PageThatThrowsException", "Reload on nested page", "Tests a page reload from a nested page's exception report")
 
             );
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
new file mode 100644
index 0000000..7af9849
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
@@ -0,0 +1,23 @@
+// Copyright 2006, 2007 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.tapestry5.integration.app1.pages.nested;
+
+public class PageThatThrowsException
+{
+    void beginRender(){
+      throw new RuntimeException("This page throws an exception");
+      
+    }
+}


[2/2] git commit: TAP5-2311: URL-decode the loadPage parameter to fix reloading of nested pages

Posted by jk...@apache.org.
TAP5-2311: URL-decode the loadPage parameter to fix reloading of nested pages


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7294f9bc
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7294f9bc
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7294f9bc

Branch: refs/heads/master
Commit: 7294f9bcbf15a677cf8ec27a9db2c647d4115d4c
Parents: a7b4556
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Fri May 2 09:46:37 2014 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Fri May 2 10:00:35 2014 +0200

----------------------------------------------------------------------
 .../corelib/pages/ExceptionReport.java          |  5 ++++-
 .../integration/app1/CoreBehaviorsTests.java    | 15 +++++++++++++
 .../tapestry5/integration/app1/pages/Index.java |  4 +++-
 .../pages/nested/PageThatThrowsException.java   | 23 ++++++++++++++++++++
 4 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
index 3676c20..e6db1ed 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
@@ -99,6 +99,9 @@ public class ExceptionReport implements ExceptionReporter
 
     @Inject
     private ReloadHelper reloadHelper;
+    
+    @Inject
+    private URLEncoder urlEncoder;
 
     @Property
     private String rootURL;
@@ -129,7 +132,7 @@ public class ExceptionReport implements ExceptionReporter
     {
         reloadHelper.forceReload();
 
-        return linkSource.createPageRenderLinkWithContext(request.getParameter("loadPage"), reloadContext);
+        return linkSource.createPageRenderLinkWithContext(urlEncoder.decode(request.getParameter("loadPage")), reloadContext);
     }
 
     Object onActionFromReloadRoot() throws MalformedURLException

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
index 1655716..2179b98 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
@@ -1705,4 +1705,19 @@ public class CoreBehaviorsTests extends App1TestCase
         assertTextPresent("Page called with correct activation context",
                 "You should never see me if use an erroneous activation context");
     }
+    
+    /**
+     * TAP5-2311
+     */
+    @Test
+    public void reload_from_nested_page()
+    {
+        openLinks("Reload on nested page");
+
+        assertTextPresent("This page throws an exception");
+        
+        clickAndWait("css=a:contains('Go to page'):contains('with reload')");
+        
+        assertTextPresent("This page throws an exception");
+    }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index fcd8647..bfd68f3 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -559,7 +559,9 @@ public class Index
 
                     new Item("ModuleConfigurationCallbackDemo", "ModuleConfigurationCallback Demo", "Shows an example of changing the Require.js configuration using JavaScriptSupport.addModuleConfigurationDemo()"),
 
-                    new Item("PartialTemplateRendererDemo", "PartialTemplateRenderer Demo", "Shows some examples of rendering blocks and components to a String using PartialTemplateRenderer")
+                    new Item("PartialTemplateRendererDemo", "PartialTemplateRenderer Demo", "Shows some examples of rendering blocks and components to a String using PartialTemplateRenderer"),
+
+                    new Item("nested/PageThatThrowsException", "Reload on nested page", "Tests a page reload from a nested page's exception report")
 
             );
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
new file mode 100644
index 0000000..7af9849
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
@@ -0,0 +1,23 @@
+// Copyright 2006, 2007 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.tapestry5.integration.app1.pages.nested;
+
+public class PageThatThrowsException
+{
+    void beginRender(){
+      throw new RuntimeException("This page throws an exception");
+      
+    }
+}