You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Johnny Yu (JIRA)" <ji...@apache.org> on 2010/11/12 09:18:13 UTC

[jira] Created: (WW-3530) Invalid cache key in AnnotationActionValidationManager.buildValidatorKey when using visitor field validators

Invalid cache key in AnnotationActionValidationManager.buildValidatorKey  when using visitor field validators
-------------------------------------------------------------------------------------------------------------

                 Key: WW-3530
                 URL: https://issues.apache.org/jira/browse/WW-3530
             Project: Struts 2
          Issue Type: Bug
          Components: XML Validators
    Affects Versions: 2.2.1
            Reporter: Johnny Yu


Error scenerio:

MyAction-validation.xml:
<validators>
	<field name="myField"> <!-- MyClass -->
		<field-validator type="visitor">
			<param name="context">basic</param>
			<param name="appendPrefix">true</param>
			<message/>
		</field-validator>
	</field>
	<field name="myField">
		<field-validator type="visitor">
			<param name="context">additional</param>
			<param name="appendPrefix">true</param>
			<message/>
		</field-validator>
	</field>
</validators>

In this case, validators in MyClass-basic-validation.xml will be executed two times, but validators in MyClass-additional-validation.xml will just ignored.

The problem is caused by AnnotationActionValidationManager.buildValidatorKey(Class) which returns the same cache key for the validator cache.

The current cache key is created by:

StringBuilder sb = new StringBuilder(clazz.getName());
sb.append("/");
sb.append(proxy.getConfig().getName());
sb.append("|");
sb.append(proxy.getMethod());

The context is not a part of the cache key. Therefore, the two visitor validator will just get the same cache key. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Updated] (WW-3530) Invalid cache key in AnnotationActionValidationManager.buildValidatorKey when using visitor field validators

Posted by "Lukasz Lenart (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart updated WW-3530:
------------------------------

    Fix Version/s: 3.x
    
> Invalid cache key in AnnotationActionValidationManager.buildValidatorKey  when using visitor field validators
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3530
>                 URL: https://issues.apache.org/jira/browse/WW-3530
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.2.1
>            Reporter: Johnny Yu
>             Fix For: 3.x
>
>
> Error scenerio:
> MyAction-validation.xml:
> <validators>
> 	<field name="myField"> <!-- MyClass -->
> 		<field-validator type="visitor">
> 			<param name="context">basic</param>
> 			<param name="appendPrefix">true</param>
> 			<message/>
> 		</field-validator>
> 	</field>
> 	<field name="myField">
> 		<field-validator type="visitor">
> 			<param name="context">additional</param>
> 			<param name="appendPrefix">true</param>
> 			<message/>
> 		</field-validator>
> 	</field>
> </validators>
> In this case, validators in MyClass-basic-validation.xml will be executed two times, but validators in MyClass-additional-validation.xml will just ignored.
> The problem is caused by AnnotationActionValidationManager.buildValidatorKey(Class) which returns the same cache key for the validator cache.
> The current cache key is created by:
> StringBuilder sb = new StringBuilder(clazz.getName());
> sb.append("/");
> sb.append(proxy.getConfig().getName());
> sb.append("|");
> sb.append(proxy.getMethod());
> The context is not a part of the cache key. Therefore, the two visitor validator will just get the same cache key. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (WW-3530) Invalid cache key in AnnotationActionValidationManager.buildValidatorKey when using visitor field validators

Posted by "Johnny Yu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WW-3530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johnny Yu updated WW-3530:
--------------------------


see also WW-3194 and WW-2996. 

> Invalid cache key in AnnotationActionValidationManager.buildValidatorKey  when using visitor field validators
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-3530
>                 URL: https://issues.apache.org/jira/browse/WW-3530
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.2.1
>            Reporter: Johnny Yu
>
> Error scenerio:
> MyAction-validation.xml:
> <validators>
> 	<field name="myField"> <!-- MyClass -->
> 		<field-validator type="visitor">
> 			<param name="context">basic</param>
> 			<param name="appendPrefix">true</param>
> 			<message/>
> 		</field-validator>
> 	</field>
> 	<field name="myField">
> 		<field-validator type="visitor">
> 			<param name="context">additional</param>
> 			<param name="appendPrefix">true</param>
> 			<message/>
> 		</field-validator>
> 	</field>
> </validators>
> In this case, validators in MyClass-basic-validation.xml will be executed two times, but validators in MyClass-additional-validation.xml will just ignored.
> The problem is caused by AnnotationActionValidationManager.buildValidatorKey(Class) which returns the same cache key for the validator cache.
> The current cache key is created by:
> StringBuilder sb = new StringBuilder(clazz.getName());
> sb.append("/");
> sb.append(proxy.getConfig().getName());
> sb.append("|");
> sb.append(proxy.getMethod());
> The context is not a part of the cache key. Therefore, the two visitor validator will just get the same cache key. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.