tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kao...@apache.org
Subject git commit: FIXED - TAP5-2267: Contributing ExceptionHandlerAssistant instances to RequestExceptionHandler is broken - apply Dragan Sahpaski's patch with test that allows contributing assistant instances to the DefautlRequestExceptionHandler
Date Sun, 29 Dec 2013 07:40:04 GMT
Updated Branches:
  refs/heads/master 549b148f9 -> ae473c840


FIXED - TAP5-2267: Contributing ExceptionHandlerAssistant instances to
RequestExceptionHandler is broken 
- apply Dragan Sahpaski's patch with test that allows contributing
assistant instances to the DefautlRequestExceptionHandler


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

Branch: refs/heads/master
Commit: ae473c840b9f425d8470dd0e8fd44d99e20be1a0
Parents: 549b148
Author: kaosko <kaosko@apache.org>
Authored: Sat Dec 28 23:39:06 2013 -0800
Committer: kaosko <kaosko@apache.org>
Committed: Sat Dec 28 23:39:06 2013 -0800

----------------------------------------------------------------------
 .../internal/services/DefaultRequestExceptionHandler.java    | 2 +-
 .../services/DefaultRequestExceptionHandlerTest.java         | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ae473c84/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
index 897b3b2..62a8708 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
@@ -113,7 +113,7 @@ public class DefaultRequestExceptionHandler implements RequestExceptionHandler
                 throw new IllegalArgumentException(Throwable.class.getName() + " is the only
allowable key type but " + entry.getKey().getName()
                         + " was contributed");
 
-            if (ExceptionHandlerAssistant.class.isAssignableFrom((Class) entry.getValue()))
+            if (entry.getValue() instanceof Class && ExceptionHandlerAssistant.class.isAssignableFrom((Class)
entry.getValue()))
             {
                 @SuppressWarnings("unchecked")
                 Class<ExceptionHandlerAssistant> handlerType = (Class<ExceptionHandlerAssistant>)
entry.getValue();

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ae473c84/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandlerTest.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandlerTest.java
b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandlerTest.java
index b9bf0c9..d458e1c 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandlerTest.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandlerTest.java
@@ -75,6 +75,13 @@ public class DefaultRequestExceptionHandlerTest extends InternalBaseTestCase
{
         componentClassResolver = mockComponentClassResolver();
         linkSource = mockLinkSource();
         serviceResources = mockServiceResources();
+  	    mockConfiguration.put(AccessControlException.class, MyPage.class);
+        mockConfiguration.put(MyContextAwareException.class, new ExceptionHandlerAssistant()
{
+			          public Object handleRequestException(Throwable exception, List<Object>
exceptionContext)
+			              throws IOException {
+			          return null;
+			      }
+			  });
         exceptionHandler = new DefaultRequestExceptionHandler(pageCache, renderer, logger,
"exceptionpage", request, response, componentClassResolver, linkSource, serviceResources,
mockConfiguration);
     }
 	
@@ -117,7 +124,6 @@ public class DefaultRequestExceptionHandlerTest extends InternalBaseTestCase
{
 	
 	@Test
 	public void handleRequestExceptionWithConfiguredPage() throws IOException {
-	    mockConfiguration.put(AccessControlException.class, MyPage.class);
 	    train_resolvePageClassNameToPageName(componentClassResolver, MyPage.class.getName(),
"mypage" );
 	    Link link = mockLink();
         expect(linkSource.createPageRenderLink("mypage", false, new Object[]{"accesscontrol"})).andReturn(link);


Mime
View raw message