Updated Branches:
  refs/heads/master b8627d043 -> 12cb5670a

TAP5-2073: AbstractEventContext always emits "null" regardless of what values 
are defined by subclass


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

Branch: refs/heads/master
Commit: 12cb5670a762c025b5932efac77fc49683bbc382
Parents: b8627d0
Author: Howard M. Lewis Ship <[email protected]>
Authored: Thu Jul 25 12:53:12 2013 -0700
Committer: Howard M. Lewis Ship <[email protected]>
Committed: Thu Jul 25 12:53:12 2013 -0700

----------------------------------------------------------------------
 .../internal/AbstractEventContext.java          | 21 ++++++++------------
 .../internal/services/EventContextTests.java    | 10 +++++++++-
 2 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/12cb5670/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractEventContext.java
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractEventContext.java
 
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractEventContext.java
index a8feab1..443a01a 100644
--- 
a/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractEventContext.java
+++ 
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/AbstractEventContext.java
@@ -1,4 +1,4 @@
-// Copyright 2010 The Apache Software Foundation
+// Copyright 2010, 2013 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.
@@ -18,8 +18,6 @@ import org.apache.tapestry5.EventContext;
 
 public abstract class AbstractEventContext implements EventContext
 {
-    private String[] values;
-
     public String[] toStrings()
     {
         int count = getCount();
@@ -37,21 +35,18 @@ public abstract class AbstractEventContext implements 
EventContext
     @Override
     public String toString()
     {
-        StringBuilder builder = new StringBuilder("EventContext:");
+        StringBuilder builder = new StringBuilder("<EventContext");
+
+        String[] values = toStrings();
 
-        if (values == null)
-            return builder.append(" null").toString();
+        String sep = ": ";
 
         for (int i = 0; i < values.length; i++)
         {
-            if (i == 0)
-                builder.append(" ");
-            else
-                builder.append(",");
-
-            builder.append(values[i]);
+            builder.append(sep).append(values[i]);
+            sep = ", ";
         }
 
-        return builder.toString();
+        return builder.append(">").toString();
     }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/12cb5670/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EventContextTests.java
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EventContextTests.java
 
b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EventContextTests.java
index 78e77ff..8e8b2d8 100644
--- 
a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EventContextTests.java
+++ 
b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EventContextTests.java
@@ -1,4 +1,4 @@
-// Copyright 2010 The Apache Software Foundation
+// Copyright 2010, 2013 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.
@@ -45,4 +45,12 @@ public class EventContextTests extends InternalBaseTestCase
     {
         assertEquals(new EmptyEventContext().toStrings(), new String[0]);
     }
+
+    @Test
+    public void to_string_of_event_context() {
+
+        EventContext ec = new ArrayEventContext(typeCoercer, 1, 2.3);
+
+        assertEquals(ec.toString(), "<EventContext: 1, 2.3>");
+    }
 }

Reply via email to