|
From: Seth L. <se...@eh...> - 2004-06-02 21:52:18
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I think this usage should be possible, so please let me know if this
isn't supported.
I am writing some custom validation in onBindAndValidate, and am
rejecting a field in a map. The specific code is:
errors.rejectValue("accepted['"+agencyName+"']",
~ "errors.required", new Object[] {
~ new DefaultMessageSourceResolvable(
~ new String[]{"signatureCommand.accept.dept."+agencyName})
~ }, null);
My bean looks like:
public class Command {
~ public Map getAccepted();
}
However, when I attempt to reject the field accepted['tax'], I receive a
NPE:
java.lang.NullPointerException
~ at
org.springframework.validation.DefaultMessageCodesResolver.resolveMes
sageCodes(DefaultMessageCodesResolver.java:103)
~ at
org.springframework.validation.BindException.resolveMessageCodes(Bind
Exception.java:163)
~ at
org.springframework.validation.BindException.rejectValue(BindExceptio
n.java:152)
~ at
com.hic.eboss.web.SignatureController.onBindAndValidate(SignatureCont
roller.java:143)
This is because the Class of accepted['tax'] was not found (because its
value is null). There was a similar problem w/ null values in a Map
with the registering of custom property editors.
I believe that DefaultMessageCodesResolver should just handle the case
where the Class is null.
Hope that helps,
Thanks!
Seth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAvkwKKZsFSwtW+wIRAnTzAJ415fKDkJsvj6ZdvKnD3x3LSRbjPgCfXSZs
SQpDKva/NQVTp60gFSZKrSM=
=Ubsm
-----END PGP SIGNATURE-----
|