Author: hlship
Date: Wed Sep 7 12:48:54 2005
New Revision: 279409
URL: http://svn.apache.org/viewcvs?rev=279409&view=rev
Log:
TAPESTRY-600: Intermixing FieldLabels and form components can force a
StaleLinkException
Modified:
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/FieldLabel.java
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/BaseFormComponentTest.java
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/valid/TestFieldLabel.java
jakarta/tapestry/trunk/status.xml
Modified:
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java?rev=279409&r1=279408&r2=279409&view=diff
==============================================================================
---
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
(original)
+++
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
Wed Sep 7 12:48:54 2005
@@ -669,10 +669,13 @@
{
String key = field.getExtendedId();
- String buffer = (String) _prerenderMap.get(key);
+ // During a rewind, if the form is pre-rendered, the buffer will be
null,
+ // so do the check based on the key, not a non-null value.
- if (buffer == null)
+ if (!_prerenderMap.containsKey(key))
return false;
+
+ String buffer = (String) _prerenderMap.get(key);
writer.printRaw(buffer);
Modified:
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/FieldLabel.java
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/FieldLabel.java?rev=279409&r1=279408&r2=279409&view=diff
==============================================================================
---
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/FieldLabel.java
(original)
+++
jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/valid/FieldLabel.java
Wed Sep 7 12:48:54 2005
@@ -41,15 +41,15 @@
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
- if (cycle.isRewinding())
- return;
-
IForm form = TapestryUtils.getForm(cycle, this);
IFormComponent field = getField();
if (field != null)
form.prerenderField(writer, field, getLocation());
+
+ if (cycle.isRewinding())
+ return;
String displayName = getDisplayName();
Modified:
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/BaseFormComponentTest.java
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/BaseFormComponentTest.java?rev=279409&r1=279408&r2=279409&view=diff
==============================================================================
---
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/BaseFormComponentTest.java
(original)
+++
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/form/BaseFormComponentTest.java
Wed Sep 7 12:48:54 2005
@@ -100,4 +100,9 @@
{
return (IActionListener) newMock(IActionListener.class);
}
+
+ protected IFormComponent newField()
+ {
+ return (IFormComponent) newMock(IFormComponent.class);
+ }
}
Modified:
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/valid/TestFieldLabel.java
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/valid/TestFieldLabel.java?rev=279409&r1=279408&r2=279409&view=diff
==============================================================================
---
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/valid/TestFieldLabel.java
(original)
+++
jakarta/tapestry/trunk/framework/src/test/org/apache/tapestry/valid/TestFieldLabel.java
Wed Sep 7 12:48:54 2005
@@ -74,17 +74,24 @@
public void testRewinding()
{
- MockControl cyclec = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) cyclec.getMock();
+ Location l = newLocation();
+ IMarkupWriter writer = newWriter();
+ IRequestCycle cycle = newCycle();
+ IForm form = newForm();
+ IFormComponent field = newField();
- cycle.isRewinding();
- cyclec.setReturnValue(true);
+ trainGetForm(cycle, form);
+
+ form.prerenderField(writer, field, l);
+
+ trainIsRewinding(cycle, true);
replayControls();
- FieldLabel fl = (FieldLabel) newInstance(FieldLabel.class);
+ FieldLabel fl = (FieldLabel) newInstance(FieldLabel.class, new Object[]
+ { "field", field, "location", l });
- fl.render(null, cycle);
+ fl.render(writer, cycle);
verifyControls();
}
@@ -97,9 +104,10 @@
MockControl cyclec = newControl(IRequestCycle.class);
IRequestCycle cycle = (IRequestCycle) cyclec.getMock();
- trainIsRewinding(cycle, false);
trainGetForm(cycle, form);
+ trainIsRewinding(cycle, false);
+
replayControls();
FieldLabel fl = (FieldLabel) newInstance(FieldLabel.class, new Object[]
@@ -120,9 +128,10 @@
MockControl cyclec = newControl(IRequestCycle.class);
IRequestCycle cycle = (IRequestCycle) cyclec.getMock();
- trainIsRewinding(cycle, false);
trainGetForm(cycle, form);
+ trainIsRewinding(cycle, false);
+
replayControls();
FieldLabel fl = (FieldLabel) newInstance(FieldLabel.class, new Object[]
@@ -146,9 +155,10 @@
IBinding binding = newBinding(l);
IPage page = newFred();
- trainIsRewinding(cycle, false);
trainGetForm(cycle, form);
+ trainIsRewinding(cycle, false);
+
replayControls();
FieldLabel fl = (FieldLabel) newInstance(FieldLabel.class, new Object[]
@@ -184,12 +194,12 @@
IFormComponent field = newField("MyLabel", null);
Location l = newLocation();
- MockControl cyclec = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) cyclec.getMock();
+ IRequestCycle cycle = newCycle();
- trainIsRewinding(cycle, false);
trainGetForm(cycle, form);
+ trainIsRewinding(cycle, false);
+
FieldLabel fl = (FieldLabel) newInstance(FieldLabel.class, new Object[]
{ "location", l, "field", field });
@@ -218,12 +228,12 @@
IFormComponent field = newField("MyLabel", "clientId");
Location l = newLocation();
- MockControl cyclec = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) cyclec.getMock();
+ IRequestCycle cycle = newCycle();
- trainIsRewinding(cycle, false);
trainGetForm(cycle, form);
+ trainIsRewinding(cycle, false);
+
FieldLabel fl = (FieldLabel) newInstance(FieldLabel.class, new Object[]
{ "location", l, "field", field });
@@ -251,11 +261,11 @@
MockControl fieldc = newControl(IFormComponent.class);
IFormComponent field = (IFormComponent) fieldc.getMock();
- MockControl cyclec = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) cyclec.getMock();
+ IRequestCycle cycle = newCycle();
- trainIsRewinding(cycle, false);
trainGetForm(cycle, form);
+
+ trainIsRewinding(cycle, false);
Location l = newLocation();
IPage page = newFred();
Modified: jakarta/tapestry/trunk/status.xml
URL:
http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/status.xml?rev=279409&r1=279408&r2=279409&view=diff
==============================================================================
--- jakarta/tapestry/trunk/status.xml (original)
+++ jakarta/tapestry/trunk/status.xml Wed Sep 7 12:48:54 2005
@@ -54,7 +54,7 @@
<action type="update" dev="HLS" due-to="Henri Yandell">Convert Tapestry
repository from CVS to SVN</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-611">Pattern validator
invokes wrong client-side JavaScript function</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-610">$bean syntax for
validators: binding prefix is broken</action>
- <action type="fix" dev="HLS"
fixes-bug="TAPESTRY-609">Tapestry.set_focus() seems to be passed the form
components elementId (i.e. name attribute) not clientId (i.e. id attribute),
which keeps
+ <action type="fix" dev="HLS"
fixes-bug="TAPESTRY-609">Tapestry.set_focus() seems to be passed the form
components elementId (i.e. name attribute) not clientId (i.e. id attribute),
which keeps
focus from being set</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-478, TAPESTRY-477,
TAPESTRY-463, TAPESTRY-474" due-to="Pierre-Yves Nicolas">Document RadioGroup,
Radio, ExternalLink, Option components</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-613">Javascript problem
with @LinkSubmit</action>
@@ -70,13 +70,14 @@
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-606">ListEdit
components should not attempt to take focus</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-546">Build uploads
vlibbeans-xxx.jar to java repository (and thence to the maven
repository)</action>
<action type="fix" dev="DS" fixes-bug="TAPESTRY-461" due-to="Warner
Onstine">Document DirectLink component</action>
+ <action type="fix" dev="HLS" fixes-bug="TAPESTRY-600">Intermixing
FieldLabels and form components can force a StaleLinkException</action>
</release>
<release version="4.0-beta-5" date="Aug 26 2005">
<action type="fix" dev="MB,HLS" fixes-bug="TAPESTRY-552">Improperly
configured SerializableAdaptor (for DataSqueezer) prevents serialized objects
from being de-serialized</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-554">Hook needed on
client side to control how validation errors are presented to the user</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-528">Add
IComponentSpecification.getReservedParameterNames()</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-557">Remove unused
org.apache.tapestry.IResourceLocation (replaced by
org.apache.hivemind.Resource)</action>
- <action type="fix" dev="HLS" fixes-bug="TAPESTRY-553">Rename
property-name attribute of configure element to "property" (matching the code
in SpecificationParser, as well as other similar
+ <action type="fix" dev="HLS" fixes-bug="TAPESTRY-553">Rename
property-name attribute of configure element to "property" (matching the code
in SpecificationParser, as well as other similar
elements in the DTD)</action>
<action type="fix" dev="MB" fixes-bug="TAPESTRY-555">IfBean has a logic
error in it</action>
<action type="fix" dev="MB" fixes-bug="TAPESTRY-290">Incorrect binding
type converter for array of int[]</action>
@@ -112,7 +113,7 @@
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-445" due-to="Markus
Joschko">ContextAssetFactory assembles wrong filename for assets</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-444">regexp
validator(Email) script function name mismatch</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-446">Changes to assets
are not picked up, even when caching is disabled</action>
- <action type="fix" dev="HLS"
fixes-bug="TAPESTRY-435,TAPESTRY-325,TAPESTRY-309,TAPESTRY-311,TAPESTRY-252,TAPESTRY-254,TAPESTRY-327,TAPESTRY-333"
due-to="Our many international users">Add many
+ <action type="fix" dev="HLS"
fixes-bug="TAPESTRY-435,TAPESTRY-325,TAPESTRY-309,TAPESTRY-311,TAPESTRY-252,TAPESTRY-254,TAPESTRY-327,TAPESTRY-333"
due-to="Our many international users">Add many
translations of ValidationStrings.properties.</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-441">Poor reporting of
duplicate method implementations</action>
<action type="update" dev="HLS">Remove default-binding attribute from
<parameter> element</action>
@@ -131,15 +132,15 @@
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-534">WebRequest
interface doesn't expose getRemoteUser(), isUserInRole() or
getUserPrincipal()</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-530" due-to="Raphael
Jean">Namespace messages are retrieved using page's locale rather than engine's
locale</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-354">Components without
a .jwc file not visible</action>
- <action type="fix" dev="HLS" fixes-bug="TAPESTRY-533" due-to="Raphael
Jean">Generated client-side javascript is wrong when error message or field
display name contains single-quote characters
+ <action type="fix" dev="HLS" fixes-bug="TAPESTRY-533" due-to="Raphael
Jean">Generated client-side javascript is wrong when error message or field
display name contains single-quote characters
or backslashes</action>
- <action type="fix" dev="HLS" fixes-bug="TAPESTRY-365">Set the location
for a page that has no specification (just a template) to be relative to the
application (or library)
+ <action type="fix" dev="HLS" fixes-bug="TAPESTRY-365">Set the location
for a page that has no specification (just a template) to be relative to the
application (or library)
specification</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-537">Allow listener
methods to return ILink, to support redirect-after-post</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-539">Abstract
properties (without a <property> element) do not clear out their
values</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-351">Add isRequired()
to IFieldComponent</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-452">Tapestry 4.0
(excluding annotations) not source compatible with JDK 1.3</action>
- <action type="fix" dev="PF" fixes-bug="TAPESTRY-350">Replaced
RequirableField logic and 'required' parameter in PropertySelection,
RadioGroup, Select, Upload, contrib:MultiplePropertySelection,
+ <action type="fix" dev="PF" fixes-bug="TAPESTRY-350">Replaced
RequirableField logic and 'required' parameter in PropertySelection,
RadioGroup, Select, Upload, contrib:MultiplePropertySelection,
and contrib:Palette with more general ValidatableField logic that adds
a 'validators' parameter.</action>
<action type="update" dev="PF">Checkbox component is now
validatable.</action>
<action type="update" dev="PF">Required validator additionally detects
empty strings and empty collections.</action>
@@ -208,9 +209,9 @@
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-337">Incorrect link to
Spring integration docs in FAQ</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-304">Non thread safe
documentation example</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-261">ListEditMap can
return null from getDeletedKeys()</action>
- <action type="fix" dev="HLS">Fix injection problems; InjectScriptWorker
injects a DeferredScript, not an IScript. Add super-verbose exception output
when there's a failure instantiating a
+ <action type="fix" dev="HLS">Fix injection problems; InjectScriptWorker
injects a DeferredScript, not an IScript. Add super-verbose exception output
when there's a failure instantiating a
component class. </action>
- <action type="add" dev="PF">Refactored and expanded validation
functionality to include DatePicker, PropertySelection, RadioGroup, Select,
TextArea, TextField, Upload, contrib:Palette, and
+ <action type="add" dev="PF">Refactored and expanded validation
functionality to include DatePicker, PropertySelection, RadioGroup, Select,
TextArea, TextField, Upload, contrib:Palette, and
contrib:MultiplePropertySelection</action>
<action type="update" dev="HLS">Rework form event management to be
primarily a client-side concern</action>
<action type="add" dev="HLS">Add translator binding prefix</action>
@@ -287,7 +288,7 @@
<action type="add" dev="HLS"> Add <inject-state> element to
specifications. </action>
<action type="add" dev="HLS"> Add property attribute to
<component>, <bean> and <asset> and add enhancement workers
to inject these objects as properties. </action>
<action type="add" dev="HLS"> Add hivemind: binding prefix. </action>
- <action type="update" dev="HLS"> Make the Body component output
initializations in a script block at the end of the page (just before the close
tag), rather than in a window.onload event
+ <action type="update" dev="HLS"> Make the Body component output
initializations in a script block at the end of the page (just before the close
tag), rather than in a window.onload event
handler. </action>
<action type="update" dev="HLS" fixes-bug="TAPESTRY-262"> Support more
boolean values. </action>
<action type="update" dev="HLS"> Inject Messages into components; this
means that all Tapestry page and component classes are abstract. </action>
@@ -309,7 +310,7 @@
<action type="fix" dev="HLS" due-to="Xi Ping Wang"
fixes-bug="TAPESTRY-249"> Provide localized validation messages for Simplified
Chinese (zh_CN). </action>
<action type="fix" dev="HLS" due-to="Niklas Ekman"
fixes-bug="TAPESTRY-139"> Provide localized validation messages for Swedish.
</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-230"> Ignored
interruptedException prevents Janitorthread termination. </action>
- <action type="fix" dev="HLS" due-to="Morten Holm"
fixes-bug="TAPESTRY-248"> The online Tapestry component reference for 3.0.1 for
@Foreach component has an error in the example section.
+ <action type="fix" dev="HLS" due-to="Morten Holm"
fixes-bug="TAPESTRY-248"> The online Tapestry component reference for 3.0.1 for
@Foreach component has an error in the example section.
</action>
<action type="fix" dev="HLS" due-to="Michael Frericks"
fixes-bug="TAPESTRY-218"> Persistent properties can't be set to null. </action>
<action type="fix" dev="HLS" due-to="Sadanori Ito"
fixes-bug="TAPESTRY-200"> ListEdit component reference should list source and
value as required. </action>
@@ -338,11 +339,11 @@
<!-- Use due-to to give acknowledgement for patches. -->
<release version="3.0-rc-3" date="Apr 7 2004">
<action type="update" dev="HLS"> Add docs on how to report problems.
</action>
- <action type="fix" dev="HLS" fixes-bug="28202" due-to="Mats
Forstöf"> Pass the java.security.ProtectionDomain to the parent class
loader when creating an enhanced class, to allow Tapestry
+ <action type="fix" dev="HLS" fixes-bug="28202" due-to="Mats
Forstöf"> Pass the java.security.ProtectionDomain to the parent class
loader when creating an enhanced class, to allow Tapestry
operation inside secure environments such as Tomcat. </action>
<action type="fix" dev="DS" fixes-bug="28177" due-to="[EMAIL
PROTECTED]"> NPE in org.apache.tapestry.form.LinkSubmit. </action>
<action type="fix" dev="HLS" fixes-bug="27956"> Make checks for
unimplemented abstract methods optional, to work around a bug in IBM JDK 1.3.1
(used with Websphere 4.x). </action>
- <action type="fix" dev="HLS" fixes-bug="28235"> Allow more primitive
types to be used with parameter direction <code>auto</code> (byte, char, short,
float and long) in addition to the
+ <action type="fix" dev="HLS" fixes-bug="28235"> Allow more primitive
types to be used with parameter direction <code>auto</code> (byte, char, short,
float and long) in addition to the
previously accepted types (boolean, int, double and objects). </action>
</release>
<release version="3.0-rc-2" date="Apr 1 2004">
@@ -368,7 +369,7 @@
<action type="update" dev="HLS"> Update DatePicker to use a graphic icon
to hide and show the calendar. </action>
<action type="fix" dev="HLS" fixes-bug="20932"> Check for duplication of
ids between the HTML template and the specification. </action>
<action type="fix" dev="HLS" fixes-bug="27082"> Fix some number
conversion problems inside NumberValidator. </action>
- <action type="update" dev="HLS"> Dynamically download OGNL and Javassist
libraries (in accordance with ASF directives about non-ASL code).
<b>Unfortunately, this means that we no longer can
+ <action type="update" dev="HLS"> Dynamically download OGNL and Javassist
libraries (in accordance with ASF directives about non-ASL code).
<b>Unfortunately, this means that we no longer can
distribute precompiled examples that include those libraries</b>
</action>
</release>
<release version="3.0-beta-4" date="Feb 5 2004">
@@ -418,7 +419,7 @@
<action type="fix" dev="MB" fixes-bug="25642"> properties cannot be of
complex array types </action>
<action type="fix" dev="EH" fixes-bug="25766"> fixed broken links in
doc\src\common\TapestryLinks.xml </action>
<action type="fix" dev="MB" fixes-bug="26395"> Inherited parameters do
not pick up default values </action>
- <action type="update" dev="HLS"> Changed code to no longer invoke
<code>StringUtils.isEmpty() / isNonEmpty()</code> (this is because the behavior
of the method is changing between
+ <action type="update" dev="HLS"> Changed code to no longer invoke
<code>StringUtils.isEmpty() / isNonEmpty()</code> (this is because the behavior
of the method is changing between
jakarta-commons 1.0 and 2.0). </action>
<action type="update" dev="HLS"> Add an implementation of
<code>toString()</code> to <code>RequestCycle</code>. </action>
<action type="update" dev="HLS"> Update all copyrights for 2004.
</action>
@@ -434,7 +435,7 @@
<action type="update" dev="MB"> Evaluate the string 'false' as
Boolean.FALSE. All other non-empty strings continue to be evaluated as
Boolean.TRUE. </action>
<action type="update" dev="MB"> Automatically download external
dependencies (such as Forrest and McKoi DB). </action>
<action type="fix" dev="HK" due-to="Anatol Pomazau"> DatePicker
positioning problem fixed. </action>
- <action type="fix" dev="HK" fixes-bug="24336"> Automatic rendering of
the maxlength and size attributes have been removed. DatePicker now allows
informal attributes that will be applied to the
+ <action type="fix" dev="HK" fixes-bug="24336"> Automatic rendering of
the maxlength and size attributes have been removed. DatePicker now allows
informal attributes that will be applied to the
field. </action>
<action type="fix" dev="MB" fixes-bug="25611"> Fixed one more place
where the encoding needs to be set </action>
</release>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]