Issue Details (XML | Word | Printable)

Key: BEEHIVE-307
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Julie Zhuo
Reporter: Carlin Rogers
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Beehive

Struts validator support for the msg and args' bundle attribute is not working

Created: 17/Feb/05 08:36 AM   Updated: 07/Feb/06 07:53 AM
Return to search
Component/s: NetUI
Affects Version/s: V1Beta, v1m1, 1.0
Fix Version/s: 1.0.1

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works bundles-test-patch.txt 2005-02-17 09:22 AM Carlin Rogers 8 kB
Text File Licensed for inclusion in ASF works j307-patch.txt 2005-09-01 05:15 AM Carlin Rogers 22 kB

Resolution Date: 22/Sep/05 01:20 PM


 Description  « Hide
Struts does not correctly get validator msg and args from alternate resource bundles. Struts ignores a bundle attribute defined in the validation XML msg or args element tags used in the commons-validator framework.

There's already a bug in struts on this. Here's a summary,

Bug 21760 already includes a patch to go into Struts to resolve this issue. The patch is dependent on some changes in Commons Validator that are part of Validator 1.1.4. Struts is waiting for a "GA" quality release of Validator 1.1.4, then will move the Struts dependency to 1.1.4 and apply the fix.

and the details...
http://issues.apache.org/bugzilla/show_bug.cgi?id=21760


Unfortunately this implies that the NetUI annotations for validator msg and args alternate resource bundles will not work until the fix in struts is integrated into NetUI. User will need to keep msg and args in the default resource bundle.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Carlin Rogers added a comment - 17/Feb/05 09:22 AM
Here's a patch that includes a JPF to test the struts validator support
of the bundle attribute. No need to commit this patch until the struts
fix has been released and we've integrated with the new version.

Steve Tocco added a comment - 05/Apr/05 02:03 AM
moving to v1 (if not needed for ship, please move to Fix For = TBD)

Carlin Rogers added a comment - 14/Apr/05 07:26 AM
Changing fix for to "TBD".

The Struts bugzilla issue, 21760, has been resolved in the
Struts 1.2.x branch of code. However, it is unlikely the
next 1.2.x release (1.2.7 ?) will come in time for a beehive
v1.0 release.

Carlin Rogers added a comment - 10/Jun/05 05:21 AM
Assigning to Rich to consider an upgrade of NetUI to use Struts 1.2.7.
Struts bug 21760 was fixed in the Struts 1.2.x on 3/29/2005 and should be
part of the Struts 1.2.7 release.

There was a Struts announcement on 5/26/2005 about the GA release
of 1.2.7.

With the upgrade we should be able to close this bug.

Rich Feit added a comment - 16/Jun/05 06:34 AM
Fixed with revision 190814. Carlin, thanks for identifying the root issue.

Alejandro Ramirez added a comment - 30/Aug/05 08:44 AM
Carlin,
I used the pageflow that you attached (in the form of a patch) and entered the following values for the form:
Item 1: 1
Item 2: 12345
Item 3: 1234
Item 4: 1234567890

Expected: All validation for the form properties should fail and correct messages should be displayed.
Actual: Validation failed, however, the error and errors tags displayed the following "tag error messages:

Error Number Tag Type Error
1 Error Message Could not find a message for message key "Maximum length validation: item two cannot be more than four chars." in the default message bundle for the current page flow.
2 Error Message Could not find a message for message key "Maximum length validation: item four cannot be more than eight chars." in the default message bundle for the current page flow.
3 Errors Message Could not find a message for message key "Maximum length validation: item four cannot be more than eight chars." in the default message bundle for the current page flow.
4 Errors Message Could not find a message for message key "Maximum length validation: item two cannot be more than four chars." in the default message bundle for the current page flow.

Carlin Rogers added a comment - 31/Aug/05 12:11 AM
I'll look at this right now. If there's still an issue I think this one could go back to TBD and not
hold up V1.

Carlin Rogers added a comment - 31/Aug/05 06:59 AM
We still need to make a change on the NetUI side. The struts validator Resources
class formats the validation error using the alternate bundle and then creates a
struts ActionMessage for the error. However, this ActionMessage is a little different
from the others that our ErrorBaseTag handle.

The error ActionMessage objects usually have the key being the actual key or the
key is the message but identified by a leading "NETUI-EXPRESSION:" to indicate
that we don't need to get the messsage from the default bundle.

In this case we have a message and not a real key but it does not start with the
leading "NETUI-EXPRESSION:" so we treat it as a key and actually try to look up
the message from the default bundle.

The fix will require some changes, probably in the NetUI ErrorBaseTag. I will go
ahead and make a patch. At this stage in preparing to release for V1, I think we
should move this back to TBD, unless anyone objects.

Thoughts?

Carlin Rogers added a comment - 01/Sep/05 05:15 AM
The following patch includes a fix to the ErrorbaseTag.getErrorMessage() method to check if
the error ActionMessage is a resource or not. If not, then we just get the already formatted
message and return. This fix is in place because the struts validator Resources class will
format the message using the alternate resource bundle and create the new ActionMessage
with resource=false.

The patch also has the updated test files along with a new testRecorder BVT.

Carlin Rogers added a comment - 01/Sep/05 05:17 AM
Assigning to Rich for review. The fix is just a three line diff but I still think this
could go in post V1 unless others feel strongly that this needs to go in this
release.

Rich Feit added a comment - 22/Sep/05 01:20 PM
Committed the patch with revision 290884. Thanks Carlin!

Julie Zhuo added a comment - 07/Feb/06 07:53 AM
Verified with rev374489. The ValidatorMsgBundles test has various combination of validation messges (with keys or without keys). They are all working propertly now. Close.