Author: hlship
Date: Fri Apr  1 00:33:31 2011
New Revision: 1087522

URL: http://svn.apache.org/viewvc?rev=1087522&view=rev
Log:
TAP5-998: Exception when a form element component is not enclosed by a Form is 
odd: uses the form's label to identify the component in question

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/InternalMessages.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/internal/InternalStrings.properties
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java?rev=1087522&r1=1087521&r2=1087522&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractField.java
 Fri Apr  1 00:33:31 2011
@@ -153,7 +153,8 @@ public abstract class AbstractField impl
         // that is used multiple times.
 
         if (formSupport == null)
-            throw new 
RuntimeException(InternalMessages.formFieldOutsideForm(getLabel()));
+            throw new RuntimeException(String.format("Component %s must be 
enclosed by a Form component.",
+                    resources.getCompleteId()));
 
         assignedClientId = jsSupport.allocateClientId(id);
         String controlName = formSupport.allocateControlName(id);

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/InternalMessages.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/InternalMessages.java?rev=1087522&r1=1087521&r2=1087522&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/InternalMessages.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/InternalMessages.java
 Fri Apr  1 00:33:31 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2011 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.
@@ -47,9 +47,4 @@ public final class InternalMessages
     {
         return MESSAGES.format("to-client-should-return-string");
     }
-
-    public static String formFieldOutsideForm(String fieldName)
-    {
-        return MESSAGES.format("form-field-outside-form", fieldName);
-    }
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/internal/InternalStrings.properties
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/internal/InternalStrings.properties?rev=1087522&r1=1087521&r2=1087522&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/internal/InternalStrings.properties
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/internal/InternalStrings.properties
 Fri Apr  1 00:33:31 2011
@@ -17,4 +17,3 @@ enclose-errors-in-form=The Errors compon
 failure-instantitating-object=Exception instantiating instance of %s (for 
component '%s'): %s
 conflicting-encoding-type=Encoding type of form has already been set to '%s' 
and may not be changed to '%s'.
 to-client-should-return-string=Return value from 'parseClient' event handler 
method must be a string.
-form-field-outside-form=The %s component must be enclosed by a Form component.
\ No newline at end of file

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java?rev=1087522&r1=1087521&r2=1087522&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
 Fri Apr  1 00:33:31 2011
@@ -493,7 +493,7 @@ public class FormTests extends TapestryC
 
         assertTextPresent(
                 "org.apache.tapestry5.internal.services.RenderQueueException",
-                "Render queue error in 
SetupRender[FormFieldOutsideForm:textfield]: The Textfield component must be 
enclosed by a Form component.",
+                "Render queue error in 
SetupRender[FormFieldOutsideForm:textfield]: Component 
FormFieldOutsideForm:textfield must be enclosed by a Form component.",
                 "context:FormFieldOutsideForm.tml, line 5");
     }
 


Reply via email to