tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r617717 [1/2] - in /tapestry/tapestry5/trunk: tapestry-core/src/main/java/org/apache/tapestry/ tapestry-core/src/main/java/org/apache/tapestry/corelib/base/ tapestry-core/src/main/java/org/apache/tapestry/corelib/mixins/ tapestry-core/src/m...
Date Sat, 02 Feb 2008 00:08:30 GMT
Author: hlship
Date: Fri Feb  1 16:07:33 2008
New Revision: 617717

URL: http://svn.apache.org/viewvc?rev=617717&view=rev
Log:
TAPESTRY-2085: When a user submit a form with a TextField and the value is missing or blank, the value null is passed through the component to the model property

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderPhaseMethodExceptionDemo.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentEventCallback.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/FieldValidationSupport.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/NullFieldStrategy.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/mixins/Autocomplete.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/ZeroNullFieldStrategy.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentEventRequestHandler.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClassResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentResultProcessorWrapper.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EventImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/JSONObjectEventResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/OnEventWorker.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RenderCommandComponentEventResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StreamResponseResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StringResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StructureMessages.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/NotificationEventCallback.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/UtilMessages.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/runtime/Event.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentEventResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties
    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
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessorTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorkerTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/FieldValidationSupportImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/NullFieldStrategySourceImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessorTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/util/NotificationEventCallbackTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/test/TestBase.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentEventCallback.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentEventCallback.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentEventCallback.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentEventCallback.java Fri Feb  1 16:07:33 2008
@@ -14,8 +14,6 @@
 
 package org.apache.tapestry;
 
-import org.apache.tapestry.runtime.Component;
-
 /**
  * Callback interface for a {@linkplain org.apache.tapestry.runtime.Event render phase event) or {@link
  * org.apache.tapestry.runtime.ComponentEvent}, notified when a non-null value is returned from some event handler
@@ -25,16 +23,15 @@
 {
     /**
      * Invoked to handle a non-null event handler method result. The handler should determine whether the value is
-     * acceptible, and throw an exception if not.
+     * acceptible, and throw an exception if not.  Any thrown exception will be wrapped to identify the component
+     * and method from which the value was returned.
      * <p/>
      * Boolean values are <em>not</em> passed to the handler.  Booleans are used to indicate that the event has been
      * handled (true) or that a further search for handlers should continue (true).  If a component event method returns
      * true, then {@link org.apache.tapestry.runtime.Event#isAborted()} will return true.
      *
-     * @param result            the result value provided by a method
-     * @param component         the component from which the result was obtained
-     * @param methodDescription a string description of the class and method name (used when errors occur).
+     * @param result the result value return from the event handler method
      * @return true if the event is aborted, false if the event may continue
      */
-    boolean handleResult(T result, Component component, String methodDescription);
+    boolean handleResult(T result);
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/FieldValidationSupport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/FieldValidationSupport.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/FieldValidationSupport.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/FieldValidationSupport.java Fri Feb  1 16:07:33 2008
@@ -26,30 +26,32 @@
      * the component to see if it can perform the conversion. If the value is null, then no event is fired and the
      * translator is <em>not</em> invoked, the return value is simply null.
      *
-     * @param value              to be converted to a client-side string
+     * @param value              to be converted to a client-side string, which may be null
      * @param componentResources used to fire events on the component
      * @param translator         used if the component does not provide a non-null value
+     * @param nullFieldStrategy  used to convert a null server side value to an appropriate client side value
      * @return the translated value  or null if the value is null
      * @see org.apache.tapestry.Translator#toClient(Object)
      */
-    String toClient(Object value, ComponentResources componentResources, Translator translator);
+    String toClient(Object value, ComponentResources componentResources, Translator translator,
+                    NullFieldStrategy nullFieldStrategy);
 
     /**
      * A wrapper around {@link org.apache.tapestry.Translator#parseClient(String, org.apache.tapestry.ioc.Messages)}.
-     * First a "parseclient" event is fired; the translator is only invoked if that returns null.
-     * <p/>
-     * If the client value is null or blank, then no event is fired and the translator is not invoked.  Instead, the
-     * return value is null.
+     * First a "parseclient" event is fired; the translator is only invoked if that returns null (typically
+     * because there is not handler for the event).
      *
-     * @param clientValue        the value provided by the client (not null or blank)
+     * @param clientValue        the value provided by the client (not null)
      * @param componentResources used to trigger events
      * @param translator         translator that will do the work if the component event returns null
+     * @param nullFieldStrategy  used to convert null/blank values from client into non-null server side values
      * @return the input parsed to an object
      * @throws org.apache.tapestry.ValidationException
      *          if the value can't be parsed
      * @see org.apache.tapestry.Translator#parseClient(String, org.apache.tapestry.ioc.Messages)
      */
-    Object parseClient(String clientValue, ComponentResources componentResources, Translator translator)
+    Object parseClient(String clientValue, ComponentResources componentResources, Translator translator,
+                       NullFieldStrategy nullFieldStrategy)
             throws ValidationException;
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/NullFieldStrategy.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/NullFieldStrategy.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/NullFieldStrategy.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/NullFieldStrategy.java Fri Feb  1 16:07:33 2008
@@ -1,4 +1,4 @@
-// Copyright  2008 The Apache Software Foundation
+// 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.
@@ -14,7 +14,6 @@
 
 package org.apache.tapestry;
 
-
 /**
  * Defines a strategy, used by {@link Field} components such as {@link org.apache.tapestry.corelib.components.TextField},
  * to handle the case where either the server-side value to be sent (as a string) to the client, or the client-side
@@ -26,15 +25,16 @@
 {
     /**
      * Provides a replacement value for null, when converting the server-side object to a client-side string. The
-     * replacement value will be passed to {@link FieldValidationSupport#toClient(Object, ComponentResources,
-     * Translator)}.
+     * replacement value, if non-null, will be passed to {@link org.apache.tapestry.Translator#toClient(Object)}.
      */
     Object replaceToClient();
 
     /**
      * Provides a replacement value for a null or blank string passed from the client to the server as part of a form
-     * submission. This replacement value will be passed to {@link FieldValidationSupport#parseClient(String,
-     * ComponentResources, Translator)} as if it were the value supplied by the user.
+     * submission. This replacement value will be passed to
+     * {@link org.apache.tapestry.Translator#parseClient(String, org.apache.tapestry.ioc.Messages)}  as if it were the value supplied by the user.
+     *
+     * @return replacement value (this must not be null)
      */
     String replaceFromClient();
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Translator.java Fri Feb  1 16:07:33 2008
@@ -39,7 +39,7 @@
     /**
      * Converts a submitted request value into an appropriate server side value.
      *
-     * @param clientValue to convert to a server value; this will not be the empty string or null
+     * @param clientValue to convert to a server value; this will not be null, but may be blank
      * @param messages    validator messages assembled by {@link ValidationMessagesSource}
      * @return equivalent server-side value (possibly null)
      * @throws ValidationException if the value can not be parsed

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java Fri Feb  1 16:07:33 2008
@@ -18,7 +18,6 @@
 import org.apache.tapestry.annotations.*;
 import org.apache.tapestry.corelib.mixins.RenderDisabled;
 import org.apache.tapestry.ioc.annotations.Inject;
-import org.apache.tapestry.ioc.internal.util.InternalUtils;
 import org.apache.tapestry.services.FieldValidatorDefaultSource;
 import org.apache.tapestry.services.Request;
 import org.apache.tapestry.services.TranslatorDefaultSource;
@@ -65,7 +64,7 @@
      */
     @Parameter(defaultPrefix = "validate")
     @SuppressWarnings("unchecked")
-    private FieldValidator<Object> _validate = NOOP_VALIDATOR;
+    private FieldValidator<Object> _validate;
 
     /**
      * Defines how nulls on the server side, or sent from the client side, are treated. The selected strategy may
@@ -122,7 +121,7 @@
     {
         Class type = _resources.getBoundType("value");
 
-        if (type == null) return null;
+        if (type == null) return NOOP_VALIDATOR;
 
         return _fieldValidatorDefaultSource.createDefaultValidator(this, _resources.getId(),
                                                                    _resources.getContainerMessages(), _locale, type,
@@ -150,18 +149,10 @@
         if (value == null)
         {
             // Otherwise, get the value from the parameter ...
-
-            Object untranslated = _value;
-
-            // Substitute an alternative for null values.
-            // TODO: May want to coerce untranslated to the bound parameter type, to ensure it is compatible with the translator.
-
-            if (untranslated == null) untranslated = _nulls.replaceToClient();
-
             // Then let the translator and or various triggered events get it into
             // a format ready to be sent to the client.
 
-            value = _fieldValidationSupport.toClient(untranslated, _resources, _translate);
+            value = _fieldValidationSupport.toClient(_value, _resources, _translate, _nulls);
         }
 
         writeFieldTag(writer, value);
@@ -196,9 +187,7 @@
 
         try
         {
-            if (InternalUtils.isBlank(rawValue)) rawValue = _nulls.replaceFromClient();
-
-            Object translated = _fieldValidationSupport.parseClient(rawValue, _resources, _translate);
+            Object translated = _fieldValidationSupport.parseClient(rawValue, _resources, _translate, _nulls);
 
             _fieldValidationSupport.validate(translated, _resources, _validate);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/mixins/Autocomplete.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/mixins/Autocomplete.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/mixins/Autocomplete.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/mixins/Autocomplete.java Fri Feb  1 16:07:33 2008
@@ -24,7 +24,6 @@
 import org.apache.tapestry.ioc.annotations.Inject;
 import org.apache.tapestry.ioc.services.TypeCoercer;
 import org.apache.tapestry.json.JSONObject;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.MarkupWriterFactory;
 import org.apache.tapestry.services.Request;
 import org.apache.tapestry.util.TextStreamResponse;
@@ -186,7 +185,7 @@
 
         ComponentEventCallback callback = new ComponentEventCallback()
         {
-            public boolean handleResult(Object result, Component component, String methodDescription)
+            public boolean handleResult(Object result)
             {
                 List matches = _coercer.coerce(result, List.class);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java Fri Feb  1 16:07:33 2008
@@ -40,12 +40,15 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 /**
  * Shared utility methods used by various implementation classes.
  */
 public class TapestryInternalUtils
 {
+    private static final Pattern NON_WORD_PATTERN = Pattern.compile("[^\\w]");
+
     private static final URLCodec CODEC = new URLCodec()
     {
 
@@ -301,17 +304,18 @@
         return new KeyValue(key.trim(), value.trim());
     }
 
+
     /**
      * Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages,
      * etc.). Strips out any punctuation characters, leaving just words characters (letters, number and the
      * underscore).
      *
-     * @param expression
-     * @return
+     * @param expression a property expression
+     * @return the expression with punctuation removed
      */
     public static String extractIdFromPropertyExpression(String expression)
     {
-        return expression.replaceAll("[^\\w]", "");
+        return replace(expression, NON_WORD_PATTERN, "");
     }
 
     /**
@@ -503,8 +507,17 @@
         return getLabelForEnum(messages, prefix, value);
     }
 
+    /**
+     * Encodes a string for inclusion in a URL.  Slashes and percents are converted
+     * to "%25" and "%2F" respectively, then the entire string is  URL encoded.
+     *
+     * @param input string to include, may not be blank
+     * @return encoded input
+     */
     public static String encodeContext(String input)
     {
+        Defense.notBlank(input, "input");
+
         try
         {
             return CODEC.encode(escapePercentAndSlash(input));
@@ -515,14 +528,36 @@
         }
     }
 
-    public static String escapePercentAndSlash(String input)
+    private static final String PERCENT = "%";
+    private static final Pattern PERCENT_PATTERN = Pattern.compile(PERCENT);
+    private static final String ENCODED_PERCENT = "%25";
+    private static final Pattern ENCODED_PERCENT_PATTERN = Pattern.compile(ENCODED_PERCENT);
+
+    private static final String SLASH = "/";
+    private static final Pattern SLASH_PATTERN = Pattern.compile(SLASH);
+    private static final String ENCODED_SLASH = "%2F";
+    private static final Pattern ENCODED_SLASH_PATTERN = Pattern.compile(ENCODED_SLASH, Pattern.CASE_INSENSITIVE);
+
+    static String escapePercentAndSlash(String input)
     {
-        return input.replaceAll("%", "%25").replaceAll("/", "%2F");
+        return replace(replace(input, PERCENT_PATTERN, ENCODED_PERCENT), SLASH_PATTERN, ENCODED_SLASH);
     }
 
+    /**
+     * Used to decode certain escaped characters that are replaced
+     * when using {@link #encodeContext(String)}}.
+     *
+     * @param input a previously encoded string
+     * @return the string with slash and percent characters restored
+     */
     public static String unescapePercentAndSlash(String input)
     {
-        return input.replaceAll("%2[Ff]", "/").replaceAll("%25", "%");
+        return replace(replace(input, ENCODED_SLASH_PATTERN, SLASH), ENCODED_PERCENT_PATTERN, PERCENT);
+    }
+
+    private static String replace(String input, Pattern pattern, String replacement)
+    {
+        return pattern.matcher(input).replaceAll(replacement);
     }
 
     /**
@@ -530,9 +565,9 @@
      * both null). Otherwise standard equals() comparison is used.
      *
      * @param <T>
-     * @param left
-     * @param right
-     * @return
+     * @param left  value to compare, possibly null
+     * @param right value to compare, possibly null
+     * @return true if same value, both null, or equal
      */
     public static <T> boolean isEqual(T left, T right)
     {

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/ZeroNullFieldStrategy.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/ZeroNullFieldStrategy.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/ZeroNullFieldStrategy.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/ZeroNullFieldStrategy.java Fri Feb  1 16:07:33 2008
@@ -1,4 +1,4 @@
-// Copyright  2008 The Apache Software Foundation
+// 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.
@@ -26,7 +26,7 @@
      */
     public Object replaceToClient()
     {
-        return 0l;
+        return 0L;
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentEventRequestHandler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentEventRequestHandler.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentEventRequestHandler.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentEventRequestHandler.java Fri Feb  1 16:07:33 2008
@@ -81,7 +81,7 @@
 
         JSONObject reply = new JSONObject();
 
-        _resultProcessor.processResultValue(reply, null, null);
+        _resultProcessor.processResultValue(reply);
 
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -36,7 +36,7 @@
         _cache = cache;
     }
 
-    public void processResultValue(Component value, Component component, String methodDescripion) throws IOException
+    public void processResultValue(Component value) throws IOException
     {
         ComponentResources resources = value.getComponentResources();
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClassResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClassResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClassResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClassResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -15,7 +15,6 @@
 package org.apache.tapestry.internal.services;
 
 import org.apache.tapestry.internal.structure.Page;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ComponentClassResolver;
 import org.apache.tapestry.services.ComponentEventResultProcessor;
 
@@ -41,7 +40,7 @@
         _generator = generator;
     }
 
-    public void processResultValue(Class value, Component component, String methodDescripion) throws IOException
+    public void processResultValue(Class value) throws IOException
     {
         String className = value.getName();
         String pageName = _resolver.resolvePageClassNameToPageName(className);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -38,12 +38,12 @@
         _generator = generator;
     }
 
-    public void processResultValue(Component value, Component component, String methodDescription) throws IOException
+    public void processResultValue(Component value) throws IOException
     {
         ComponentResources resources = value.getComponentResources();
 
         if (resources.getContainer() != null)
-            _logger.warn(ServicesMessages.componentInstanceIsNotAPage(methodDescription, component, value));
+            _logger.warn(ServicesMessages.componentInstanceIsNotAPage(value));
 
         // We have all these layers and layers between us and the page instance, but its easy to
         // extract the page class name and quickly re-resolve that to the page instance.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentLifecycleMethodWorker.java Fri Feb  1 16:07:33 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 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.
@@ -118,6 +118,9 @@
         Iterator<TransformMethodSignature> i = _reverse ? InternalUtils.reverseIterator(methods) : methods
                 .iterator();
 
+        builder.addln("try");
+        builder.begin();
+
         while (i.hasNext())
             addMethodCallToBody(builder, i.next(), transformation);
 
@@ -125,6 +128,15 @@
 
         if (_reverse && !model.isRootClass()) builder.addln("super.%s($$);", _lifecycleMethodName);
 
+
+        builder.end(); // try
+
+        // Let runtime exceptions work up (they'll be caught at a higher level.
+        // Wrap checked exceptions for later reporting.
+
+        builder.addln("catch (RuntimeException ex) { throw ex; }");
+        builder.addln("catch (Exception ex) { throw new RuntimeException(ex); }");
+
         builder.end();
 
         // Let's see if this works; for base classes, we are adding an empty method the adding a
@@ -139,12 +151,13 @@
     {
         boolean isVoid = sig.getReturnType().equals("void");
 
+        builder.addln("$2.setMethodDescription(\"%s\");", transformation.getMethodIdentifier(sig));
+
         if (!isVoid)
         {
             // If we're not going to invoke storeResult(), then there's no reason to invoke
-            // setSource().
+            // setMethodDescription().
 
-            builder.addln("$2.setSource(this, \"%s\");", transformation.getMethodIdentifier(sig));
             builder.add("if ($2.storeResult(($w) ");
         }
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentResultProcessorWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentResultProcessorWrapper.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentResultProcessorWrapper.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentResultProcessorWrapper.java Fri Feb  1 16:07:33 2008
@@ -15,7 +15,6 @@
 package org.apache.tapestry.internal.services;
 
 import org.apache.tapestry.ComponentEventCallback;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ComponentEventResultProcessor;
 
 import java.io.IOException;
@@ -36,11 +35,11 @@
         _processor = processor;
     }
 
-    public boolean handleResult(Object result, Component component, String methodDescription)
+    public boolean handleResult(Object result)
     {
         try
         {
-            _processor.processResultValue(result, component, methodDescription);
+            _processor.processResultValue(result);
         }
         catch (IOException ex)
         {
@@ -53,12 +52,11 @@
     }
 
     /**
-     * Returns true if {@link #handleResult(Object, org.apache.tapestry.runtime.Component, String)} was invoked, false
+     * Returns true if {@link org.apache.tapestry.ComponentEventCallback#handleResult(Object)} was invoked, false
      * otherwise.
      *
      * @return true if the event was aborted
-     * @throws IOException if {@link ComponentEventResultProcessor#processResultValue(Object,
-     *                     org.apache.tapestry.runtime.Component, String)} threw an IOException
+     * @throws IOException if {@link ComponentEventResultProcessor#processResultValue(Object)} threw an IOException
      */
     public boolean isAborted() throws IOException
     {

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EventImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EventImpl.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EventImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EventImpl.java Fri Feb  1 16:07:33 2008
@@ -16,15 +16,12 @@
 
 import org.apache.tapestry.ComponentEventCallback;
 import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.runtime.Event;
 
 public class EventImpl implements Event
 {
     private boolean _aborted;
 
-    private Component _component;
-
     private String _methodDescription;
 
     private final ComponentEventCallback _handler;
@@ -39,9 +36,8 @@
         return _aborted;
     }
 
-    public void setSource(Component component, String methodDescription)
+    public void setMethodDescription(String methodDescription)
     {
-        _component = component;
         _methodDescription = methodDescription;
     }
 
@@ -57,7 +53,7 @@
                 .componentEventIsAborted(_methodDescription));
 
 
-        if (result != null) _aborted |= _handler.handleResult(result, _component, _methodDescription);
+        if (result != null) _aborted |= _handler.handleResult(result);
 
         return _aborted;
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/FieldValidationSupportImpl.java Fri Feb  1 16:07:33 2008
@@ -18,9 +18,9 @@
 import org.apache.tapestry.corelib.internal.InternalMessages;
 import org.apache.tapestry.internal.util.Holder;
 import org.apache.tapestry.ioc.Messages;
+import org.apache.tapestry.ioc.internal.util.Defense;
 import org.apache.tapestry.ioc.internal.util.InternalUtils;
 import org.apache.tapestry.ioc.util.ExceptionUtils;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ValidationMessagesSource;
 
 public class FieldValidationSupportImpl implements FieldValidationSupport
@@ -37,15 +37,18 @@
     }
 
     @SuppressWarnings({"unchecked"})
-    public String toClient(Object value, ComponentResources componentResources, Translator translator)
+    public String toClient(Object value, ComponentResources componentResources, Translator translator,
+                           NullFieldStrategy nullFieldStrategy)
     {
-        if (value == null) return null;
+        Defense.notNull(componentResources, "componentResources");
+        Defense.notNull(translator, "translator");
+        Defense.notNull(nullFieldStrategy, "nullFieldStrategy");
 
         final Holder<String> resultHolder = Holder.create();
 
         ComponentEventCallback callback = new ComponentEventCallback()
         {
-            public boolean handleResult(Object result, Component component, String methodDescription)
+            public boolean handleResult(Object result)
             {
                 // What's nice is that the ComponentEventException will automatically identify
                 // the method description.
@@ -63,21 +66,45 @@
 
         if (resultHolder.hasValue()) return resultHolder.get();
 
+        Object effectiveValue = value;
 
-        return translator.toClient(value);
+        if (effectiveValue == null)
+            effectiveValue = nullFieldStrategy.replaceToClient();
+
+        // We don't translate null.
+
+        if (effectiveValue == null)
+            return null;
+
+        return translator.toClient(effectiveValue);
 
     }
 
-    public Object parseClient(String clientValue, ComponentResources componentResources, Translator translator)
+    public Object parseClient(String clientValue, ComponentResources componentResources, Translator translator,
+                              NullFieldStrategy nullFieldStrategy)
             throws ValidationException
     {
-        if (InternalUtils.isBlank(clientValue)) return null;
+        Defense.notNull(componentResources, "componentResources");
+        Defense.notNull(translator, "translator");
+        Defense.notNull(nullFieldStrategy, "nullFieldStrategy");
+
+        String effectiveValue = clientValue;
+
+        if (InternalUtils.isBlank(effectiveValue))
+        {
+
+            effectiveValue = nullFieldStrategy.replaceFromClient();
+
+            if (effectiveValue == null)
+                throw new NullPointerException(
+                        String.format("Client value provided by %s is null.", nullFieldStrategy));
+        }
 
         final Holder<Object> resultHolder = Holder.create();
 
         ComponentEventCallback callback = new ComponentEventCallback()
         {
-            public boolean handleResult(Object result, Component component, String methodDescription)
+            public boolean handleResult(Object result)
             {
                 resultHolder.put(result);
                 return true;
@@ -86,15 +113,11 @@
 
         try
         {
-            componentResources.triggerEvent(PARSE_CLIENT_EVENT, new Object[]{clientValue}, callback);
+            componentResources.triggerEvent(PARSE_CLIENT_EVENT, new Object[]{effectiveValue}, callback);
         }
         catch (RuntimeException ex)
         {
-            ValidationException ve = ExceptionUtils.findCause(ex, ValidationException.class);
-
-            if (ve != null) throw ve;
-
-            throw ex;
+            rethrowValidationException(ex);
         }
 
         if (resultHolder.hasValue()) return resultHolder.get();
@@ -103,12 +126,31 @@
 
         Messages messages = _messagesSource.getValidationMessages(componentResources.getLocale());
 
-        return translator.parseClient(clientValue, messages);
+        return translator.parseClient(effectiveValue, messages);
+    }
+
+    /**
+     * Checks for a {@link org.apache.tapestry.ValidationException} inside the outer exception and
+     * throws that, otherwise rethrows the runtime exception.
+     *
+     * @param outerException initially caught exception
+     * @throws ValidationException if found
+     */
+    private void rethrowValidationException(RuntimeException outerException) throws ValidationException
+    {
+        ValidationException ve = ExceptionUtils.findCause(outerException, ValidationException.class);
+
+        if (ve != null) throw ve;
+
+        throw outerException;
     }
 
     public void validate(Object value, ComponentResources componentResources, FieldValidator validator)
             throws ValidationException
     {
+        Defense.notNull(componentResources, "componentResources");
+        Defense.notNull(validator, "validator");
+
         validator.validate(value);
 
         try
@@ -117,11 +159,7 @@
         }
         catch (RuntimeException ex)
         {
-            ValidationException ve = ExceptionUtils.findCause(ex, ValidationException.class);
-
-            if (ve != null) throw ve;
-
-            throw ex;
+            rethrowValidationException(ex);
         }
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/JSONObjectEventResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/JSONObjectEventResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/JSONObjectEventResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/JSONObjectEventResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -15,7 +15,6 @@
 package org.apache.tapestry.internal.services;
 
 import org.apache.tapestry.json.JSONObject;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ComponentEventResultProcessor;
 import org.apache.tapestry.services.Response;
 
@@ -37,7 +36,7 @@
         _response = response;
     }
 
-    public void processResultValue(JSONObject value, Component component, String methodDescripion) throws IOException
+    public void processResultValue(JSONObject value) throws IOException
     {
         PrintWriter pw = _response.getPrintWriter("text/javascript");
 

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=617717&r1=617716&r2=617717&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  1 16:07:33 2008
@@ -26,7 +26,6 @@
 import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
 import org.apache.tapestry.ioc.services.TypeCoercer;
 import org.apache.tapestry.ioc.util.StrategyRegistry;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.Request;
 import org.apache.tapestry.services.Response;
 
@@ -210,7 +209,7 @@
         ComponentEventCallback callback = new ComponentEventCallback()
         {
             @SuppressWarnings("unchecked")
-            public boolean handleResult(Object result, Component component, String methodDescription)
+            public boolean handleResult(Object result)
             {
                 PassivateContextHandler contextHandler = _registry.getByInstance(result);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ObjectComponentEventResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -14,8 +14,6 @@
 
 package org.apache.tapestry.internal.services;
 
-import org.apache.tapestry.ioc.internal.util.TapestryException;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ComponentEventResultProcessor;
 
 import java.io.IOException;
@@ -33,12 +31,12 @@
         _configuredClasses = configuredClasses;
     }
 
-    public void processResultValue(Object value, Component component, String methodDescripion) throws IOException
+    public void processResultValue(Object value) throws IOException
     {
-        String message = ServicesMessages.invalidComponentEventResult(component, value, methodDescripion,
+        String message = ServicesMessages.invalidComponentEventResult(value,
                                                                       _configuredClasses);
 
-        throw new TapestryException(message, component, null);
+        throw new RuntimeException(message);
     }
 
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/OnEventWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/OnEventWorker.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/OnEventWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/OnEventWorker.java Fri Feb  1 16:07:33 2008
@@ -97,7 +97,7 @@
 
         builder.addln("$_ = true;");
 
-        builder.addln("$1.setSource(this, \"%s\");", transformation.getMethodIdentifier(method));
+        builder.addln("$1.setMethodDescription(\"%s\");", transformation.getMethodIdentifier(method));
 
         boolean isNonVoid = !method.getReturnType().equals("void");
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RenderCommandComponentEventResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RenderCommandComponentEventResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RenderCommandComponentEventResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RenderCommandComponentEventResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -14,7 +14,6 @@
 
 package org.apache.tapestry.internal.services;
 
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.runtime.RenderCommand;
 import org.apache.tapestry.services.ComponentEventResultProcessor;
 
@@ -34,7 +33,7 @@
         _renderer = renderer;
     }
 
-    public void processResultValue(RenderCommand value, Component component, String methodDescripion) throws IOException
+    public void processResultValue(RenderCommand value) throws IOException
     {
         _renderer.renderPartialPageMarkup(value);
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java Fri Feb  1 16:07:33 2008
@@ -202,10 +202,9 @@
         return MESSAGES.format("page-is-dirty", page);
     }
 
-    static String componentInstanceIsNotAPage(String methodDescription, Component component, Component result)
+    static String componentInstanceIsNotAPage(Component result)
     {
-        return MESSAGES.format("component-instance-is-not-a-page", methodDescription, component
-                .getComponentResources().getCompleteId(), result.getComponentResources()
+        return MESSAGES.format("component-instance-is-not-a-page", result.getComponentResources()
                 .getCompleteId());
     }
 
@@ -270,7 +269,7 @@
 
     }
 
-    static String invalidComponentEventResult(Component component, Object result, String methodDescription,
+    static String invalidComponentEventResult(Object result,
                                               Collection<Class> configuredResultTypes)
     {
         List<String> classNames = CollectionFactory.newList();
@@ -278,8 +277,7 @@
         for (Class c : configuredResultTypes)
             classNames.add(c.getName());
 
-        return MESSAGES.format("invalid-component-event-result", component.getComponentResources()
-                .getCompleteId(), result, methodDescription, ClassFabUtils.toJavaClassName(result
+        return MESSAGES.format("invalid-component-event-result", result, ClassFabUtils.toJavaClassName(result
                 .getClass()), InternalUtils.joinSorted(classNames));
     }
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StreamResponseResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StreamResponseResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StreamResponseResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StreamResponseResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -16,7 +16,6 @@
 
 import org.apache.tapestry.StreamResponse;
 import org.apache.tapestry.internal.TapestryInternalUtils;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ComponentEventResultProcessor;
 import org.apache.tapestry.services.Response;
 
@@ -36,7 +35,7 @@
         _response = response;
     }
 
-    public void processResultValue(StreamResponse streamResponse, Component component, String methodDescripion)
+    public void processResultValue(StreamResponse streamResponse)
             throws IOException
     {
         OutputStream os = null;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StringResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StringResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StringResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/StringResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -15,7 +15,6 @@
 package org.apache.tapestry.internal.services;
 
 import org.apache.tapestry.internal.structure.Page;
-import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ComponentEventResultProcessor;
 
 import java.io.IOException;
@@ -36,7 +35,7 @@
         _generator = generator;
     }
 
-    public void processResultValue(String value, Component component, String methodDescripion) throws IOException
+    public void processResultValue(String value) throws IOException
     {
         Page page = _requestPageCache.get(value);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java Fri Feb  1 16:07:33 2008
@@ -121,7 +121,7 @@
             return _result;
         }
 
-        public boolean handleResult(Object result, Component component, String methodDescription)
+        public boolean handleResult(Object result)
         {
             if (result instanceof Boolean)
             {
@@ -155,8 +155,7 @@
                 return false;
             }
 
-            throw new TapestryException(StructureMessages.wrongEventResultType(methodDescription, Boolean.class),
-                                        component, null);
+            throw new RuntimeException(StructureMessages.wrongPhaseResultType(Boolean.class));
         }
 
         private void add(RenderCommand command)
@@ -942,14 +941,14 @@
 
         ComponentEventCallback wrapped = new ComponentEventCallback()
         {
-            public boolean handleResult(Object result, Component component, String methodDescription)
+            public boolean handleResult(Object result)
             {
                 // Boolean value is not passed to the handler; it will be true (abort event)
                 // or false (continue looking for event handlers).
 
                 if (result instanceof Boolean) return (Boolean) result;
 
-                return providedHandler.handleResult(result, component, methodDescription);
+                return providedHandler.handleResult(result);
             }
         };
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StructureMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StructureMessages.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StructureMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StructureMessages.java Fri Feb  1 16:07:33 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 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.
@@ -66,9 +66,9 @@
         return MESSAGES.format("detach-failure", listener, cause);
     }
 
-    static String wrongEventResultType(String method, Class expectedType)
+    static String wrongPhaseResultType(Class expectedType)
     {
-        return MESSAGES.format("wrong-event-result-type", method, expectedType.getName());
+        return MESSAGES.format("wrong-phase-result-type", expectedType.getName());
     }
 
     static String blockNotFound(String componentId, String blockId)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/NotificationEventCallback.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/NotificationEventCallback.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/NotificationEventCallback.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/NotificationEventCallback.java Fri Feb  1 16:07:33 2008
@@ -15,7 +15,6 @@
 package org.apache.tapestry.internal.util;
 
 import org.apache.tapestry.ComponentEventCallback;
-import org.apache.tapestry.runtime.Component;
 
 /**
  * A {@link org.apache.tapestry.ComponentEventCallback} used for notification events. Event handler methods may return
@@ -33,12 +32,12 @@
         _completeId = completeId;
     }
 
-    public boolean handleResult(Object result, Component component, String methodDescription)
+    public boolean handleResult(Object result)
     {
         if (result instanceof Boolean) return ((Boolean) result);
 
         throw new IllegalArgumentException(
-                UtilMessages.noReturnValueAccepted(_eventType, _completeId, result, methodDescription));
+                UtilMessages.noReturnValueAccepted(_eventType, _completeId, result));
     }
 
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/UtilMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/UtilMessages.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/UtilMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/util/UtilMessages.java Fri Feb  1 16:07:33 2008
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -25,10 +25,9 @@
     {
     }
 
-    static String noReturnValueAccepted(String eventType, String componentId, Object returnValue,
-                                        String methodDescription)
+    static String noReturnValueAccepted(String eventType, String componentId, Object returnValue)
     {
         return MESSAGES.format("no-return-value-accepted", eventType, componentId, String
-                .valueOf(returnValue), methodDescription);
+                .valueOf(returnValue));
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/runtime/Event.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/runtime/Event.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/runtime/Event.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/runtime/Event.java Fri Feb  1 16:07:33 2008
@@ -35,10 +35,9 @@
      * Invoke to identify, to the event, what component and method is being acted upon (used for some kinds of exception
      * reporting).
      *
-     * @param component         the component instance from which the result was obtained
      * @param methodDescription describes the location (i.e. file name, method name and line number) of the method
      */
-    void setSource(Component component, String methodDescription);
+    void setMethodDescription(String methodDescription);
 
     /**
      * Stores a result for the event. Storing a non-null result value may abort the event (at the discretion of the

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentEventResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentEventResultProcessor.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentEventResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentEventResultProcessor.java Fri Feb  1 16:07:33 2008
@@ -14,8 +14,6 @@
 
 package org.apache.tapestry.services;
 
-import org.apache.tapestry.runtime.Component;
-
 import java.io.IOException;
 
 /**
@@ -28,10 +26,8 @@
     /**
      * For a given, non-null return value from a component event method, construct and send a response.
      *
-     * @param value            the value returned from a method
-     * @param component        the component on which a method was invoked
-     * @param methodDescripion a description of method which provided the value
+     * @param value the value returned from a method
      * @throws RuntimeException if the value can not handled
      */
-    void processResultValue(T value, Component component, String methodDescripion) throws IOException;
+    void processResultValue(T value) throws IOException;
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java Fri Feb  1 16:07:33 2008
@@ -1138,7 +1138,7 @@
     {
         configuration.add(Link.class, new ComponentEventResultProcessor<Link>()
         {
-            public void processResultValue(Link value, Component component, String methodDescripion) throws IOException
+            public void processResultValue(Link value) throws IOException
             {
                 _response.sendRedirect(value);
             }
@@ -1146,7 +1146,7 @@
 
         configuration.add(URL.class, new ComponentEventResultProcessor<URL>()
         {
-            public void processResultValue(URL value, Component component, String methodDescripion) throws IOException
+            public void processResultValue(URL value) throws IOException
             {
                 _response.sendRedirect(value.toExternalForm());
             }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java Fri Feb  1 16:07:33 2008
@@ -60,8 +60,6 @@
      * Creates a new markup writer instance (not a markup writer mock). Output can be directed at the writer, which uses
      * the default (HTML) markup model. The writer's toString() value represents all the collected markup in the
      * writer.
-     *
-     * @return
      */
     protected final MarkupWriter createMarkupWriter()
     {
@@ -712,7 +710,7 @@
     protected final void train_handleResult(ComponentEventCallback handler, Object result, Component component,
                                             String methodDescription, boolean abort)
     {
-        expect(handler.handleResult(result, component, methodDescription)).andReturn(abort);
+        expect(handler.handleResult(result)).andReturn(abort);
     }
 
     protected final void train_inError(ValidationTracker tracker, Field field, boolean inError)
@@ -1004,5 +1002,10 @@
     protected final HttpServletRequestHandler mockHttpServletRequestHandler()
     {
         return newMock(HttpServletRequestHandler.class);
+    }
+
+    protected final NullFieldStrategy mockNullFieldStrategy()
+    {
+        return newMock(NullFieldStrategy.class);
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties Fri Feb  1 16:07:33 2008
@@ -50,7 +50,7 @@
 could-not-resolve-mixin-type=Unable to resolve '%s' to a mixin class name.  Available mixin types: %s.
 parameter-name-must-be-unique=Parameter names are required to be unique.  Parameter '%s' already has the value '%s'.
 page-is-dirty=Page %s is dirty, and will be discarded (rather than returned to the page pool).
-component-instance-is-not-a-page=Method %s (for component %s) returned component %s, which is not a page component. The page containing the component will render the client response.
+component-instance-is-not-a-page=Component %s was returned from an event handler method, but is not a page component. The page containing the component will render the client response.
 failure-reading-messages=Unable to read message catalog from %s: %s
 unknown-asset-prefix=Unknown prefix for asset path '%s'.
 asset-does-not-exist=Unable to locate asset '%s' (the file does not exist).
@@ -60,7 +60,7 @@
 validator-specification-parse-error=Unexpected character '%s' at position %d of input string: %s
 unknown-translator-type=Unknown translator type '%s'.  Configured translators are %s.
 missing-from-environment=No object of type %s is available from the Environment.  Available types are %s.
-invalid-component-event-result=An event handler for component %s returned the value %s (from method %s).  Return type %s can not be handled.  Configured return types are %s.
+invalid-component-event-result=A component event handler method returned the value %s. Return type %s can not be handled.  Configured return types are %s.
 undefined-tapestry-attribute=Element <%s> does not support an attribute named '%s'. The only allowed attribute name is '%s'.
 attribute-not-allowed=Element <%s> does not support any attributes.
 parameter-element-name-required=The name attribute of the <parameter> element must be specified.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/structure/StructureStrings.properties Fri Feb  1 16:07:33 2008
@@ -19,9 +19,7 @@
 missing-mixin-for-parameter=Component %s does not contain a mixin named '%s' (setting parameter '%s').
 unknown-mixin=Component %s does not contain a mixin of type %s.
 detach-failure=Listener %s failed during page detach: %s
-wrong-event-result-type=Return value of method %s is not compatible with the expected return type of %s. \
-  The value has been ignored. \
-  Further lifecycle methods may be invoked, which is likely to cause incorrect application behavior. \
+wrong-phase-result-type=The return value from a render phase event method was not compatible the expected return type of %s. \
   You should change the method to return the correct type. 
 block-not-found=Template for component %s does not contain a block with identifier '%s'.
 unbalanced-elements=Component %s has rendered unbalanced elements; \

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/util/UtilStrings.properties Fri Feb  1 16:07:33 2008
@@ -1,16 +1,16 @@
-# Copyright 2006 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.
-
-no-return-value-accepted=Event '%s' from %s received an event handler method return value of %s from %s. \
+# Copyright 2006, 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.
+
+no-return-value-accepted=Event '%s' from %s received an event handler method return value of %s. \
   This type of event does not support return values from event handler methods.

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=617717&r1=617716&r2=617717&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  1 16:07:33 2008
@@ -1550,4 +1550,16 @@
 
         assertTextPresent("HTTP ERROR: 404");
     }
+
+    /**
+     * TAPESTRY-2085
+     */
+    @Test
+    public void render_phase_methods_may_throw_checked_exceptions()
+    {
+        start("Render Phase Method Exception Demo");
+
+        assertTextPresent(
+                "Render queue error in BeginRender[RenderPhaseMethodExceptionDemo]: java.sql.SQLException: Simulated JDBC exception while rendering.");
+    }
 }

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderPhaseMethodExceptionDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderPhaseMethodExceptionDemo.java?rev=617717&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderPhaseMethodExceptionDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/RenderPhaseMethodExceptionDemo.java Fri Feb  1 16:07:33 2008
@@ -0,0 +1,25 @@
+// 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 java.sql.SQLException;
+
+public class RenderPhaseMethodExceptionDemo
+{
+    void beginRender() throws SQLException
+    {
+        throw new SQLException("Simulated JDBC exception while rendering.");
+    }
+}

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=617717&r1=617716&r2=617717&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  1 16:07:33 2008
@@ -216,6 +216,10 @@
             new Item("PrimitiveArrayParameterDemo", "Primitive Array Parameter Demo",
                      "use primitive array as parameter type"),
 
+            new Item("RenderPhaseMethodExceptionDemo", "Render Phase Method Exception Demo",
+                     "render phase methods may throw checked exceptions"),
+
+
             new Item("TrackEditor", "Generic Page Class Demo",
                      "demo use of generics with component classes and, particularily, with property types"));
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessorTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessorTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/AjaxComponentInstanceEventResultProcessorTest.java Fri Feb  1 16:07:33 2008
@@ -53,7 +53,7 @@
         ComponentEventResultProcessor<Component> processor = new AjaxComponentInstanceEventResultProcessor(renderer,
                                                                                                            cache);
 
-        processor.processResultValue(component, null, null);
+        processor.processResultValue(component);
 
         verify();
     }
@@ -84,7 +84,7 @@
         ComponentEventResultProcessor<Component> processor = new AjaxComponentInstanceEventResultProcessor(renderer,
                                                                                                            cache);
 
-        processor.processResultValue(component, null, null);
+        processor.processResultValue(component);
 
         verify();
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java Fri Feb  1 16:07:33 2008
@@ -126,7 +126,7 @@
 
         ComponentEvent event = new ComponentEventImpl("eventType", "someId", new String[]{"27"}, handler, null);
 
-        event.setSource(component, "foo.Bar.baz()");
+        event.setMethodDescription("foo.Bar.baz()");
 
         try
         {
@@ -151,7 +151,7 @@
 
         ComponentEvent event = new ComponentEventImpl("eventType", "someId", new String[]{"abc"}, handler, null);
 
-        event.setSource(component, "foo.Bar.baz()");
+        event.setMethodDescription("foo.Bar.baz()");
 
         try
         {
@@ -184,7 +184,7 @@
 
         ComponentEvent event = new ComponentEventImpl("eventType", "someId", null, handler, null);
 
-        event.setSource(component, methodDescription);
+        event.setMethodDescription(methodDescription);
 
         assertFalse(event.isAborted());
 
@@ -209,7 +209,7 @@
 
         ComponentEvent event = new ComponentEventImpl("eventType", "someId", null, handler, null);
 
-        event.setSource(component, methodDescription);
+        event.setMethodDescription(methodDescription);
 
         assertFalse(event.storeResult(result));
 
@@ -228,7 +228,7 @@
 
         ComponentEvent event = new ComponentEventImpl("eventType", "someId", null, handler, null);
 
-        event.setSource(component, "foo.Bar.baz()");
+        event.setMethodDescription("foo.Bar.baz()");
 
         assertFalse(event.storeResult(null));
 
@@ -245,18 +245,18 @@
         ComponentEventCallback handler = mockComponentEventHandler();
         Component component = mockComponent();
 
-        expect(handler.handleResult(result, component, "foo.Bar.baz()")).andReturn(true);
+        expect(handler.handleResult(result)).andReturn(true);
 
         replay();
 
         ComponentEvent event = new ComponentEventImpl("eventType", "someId", null, handler, null);
 
-        event.setSource(component, "foo.Bar.baz()");
+        event.setMethodDescription("foo.Bar.baz()");
         event.storeResult(result);
 
         try
         {
-            event.setSource(component, "foo.Bar.biff()");
+            event.setMethodDescription("foo.Bar.biff()");
             event.storeResult(null);
             unreachable();
         }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java?rev=617717&r1=617716&r2=617717&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java Fri Feb  1 16:07:33 2008
@@ -52,7 +52,7 @@
         ComponentEventResultProcessor<Component> processor = new ComponentInstanceResultProcessor(logger, cache,
                                                                                                   generator);
 
-        processor.processResultValue(result, source, METHOD_DESCRIPTION);
+        processor.processResultValue(result);
 
         verify();
     }
@@ -61,10 +61,8 @@
     public void warning_for_component_is_not_root_component() throws Exception
     {
         Component value = mockComponent();
-        Component source = mockComponent();
         Component containerResources = mockComponent();
         ComponentResources valueResources = mockComponentResources();
-        ComponentResources sourceResources = mockComponentResources();
         Logger logger = mockLogger();
         RequestPageCache cache = mockRequestPageCache();
         Page page = mockPage();
@@ -74,13 +72,11 @@
         train_getComponentResources(value, valueResources);
 
         train_getContainer(valueResources, containerResources);
-        train_getComponentResources(source, sourceResources);
 
-        train_getCompleteId(sourceResources, PAGE_NAME + ":source");
         train_getCompleteId(valueResources, PAGE_NAME + ":child");
 
         logger
-                .warn("Method foo.bar.Baz.biff() (for component Zoop:source) returned component Zoop:child, which is not a page component. The page containing the component will render the client response.");
+                .warn("Component Zoop:child was returned from an event handler method, but is not a page component. The page containing the component will render the client response.");
 
         train_getPageName(valueResources, PAGE_NAME);
         train_get(cache, PAGE_NAME, page);
@@ -92,7 +88,7 @@
         ComponentEventResultProcessor<Component> processor = new ComponentInstanceResultProcessor(logger, cache,
                                                                                                   generator);
 
-        processor.processResultValue(value, source, METHOD_DESCRIPTION);
+        processor.processResultValue(value);
 
         verify();
     }



Mime
View raw message