开发者

Field Error keys changing with Xwork upgrade to 2.0.6

开发者 https://www.devze.com 2022-12-31 21:08 出处:网络
I\'ve upgraded Xwork from 2.0开发者_如何学Python.4 to 2.0.6 (struts version is 2.0.11.1).The field validation is working correctly, however the keys for the errors are not.For example, I have a requir

I've upgraded Xwork from 2.0开发者_如何学Python.4 to 2.0.6 (struts version is 2.0.11.1). The field validation is working correctly, however the keys for the errors are not. For example, I have a required field called profile.name.firstName. The field error key is now coming up as profile.profile.name.firstName. The first value in the dot-notation is always repeated when the error is coming from Xwork validation.

Any ideas of what could be causing this?


There is a change in the body of getFullFieldName method of class VisitorFieldValidator:

diff -rNau xwork-2.0.4-sources/ xwork-2.0.6-sources/

Output:

         public String getFullFieldName(String fieldName) {
+            if (parent instanceof AppendingValidatorContext) {
+                return parent.getFullFieldName("") + field + "." + fieldName;
+            }
         return field + "." + fieldName;
     }

Also try to investigate compatibility test results. It seems to be a lot of dangerous changes in the API between 2.0.4 and 2.0.6 (several removed methods). The developers don't follow versioning conventions and I suppose the behavior may change regularly. You cannot update even minor versions without a breakage.

0

精彩评论

暂无评论...
验证码 换一张
取 消