|
Enriched exception messages in SpringValidator - item and validation errors are included in the string.
@adrian: does this solve your logging usecase? <quote>Does this solve your logging usecase</quote>
-> It 's perfect for me for the 1.0.1. I'll test it tomorrow. Thanks very much Robert ! I need also to get the detailed item - I'm writing a record in a db table for every skipped item (but franckly I don't know if the item_detail column will be used). So for this latter usage, I'll wait for my customers real needs - and if they need it I'll wait for Spring Batch 1.1 facilities (as Lucas told in this post :http://forum.springframework.org/showpost.php?p=174758&postcount=11). Thanks once more for the reactivity !!! edited the issue summary to reflect what has been done to fix it - we can start a new issue for including the item itself in the exception if desired.
Tested it, works fine.
Thanks ! Sample log output : Validation failed for com.xxx.yyy.batch.modele.domain.Client@6ba06ba[ChargeClientele=7,numRib=6592236261555,dateAdhesion=Thu Jul 05 00:00:00 CEST 2007,isCorrect=true,contrats=[],identifiant=203494,adresse=com.xxx.yyy.batch.modele.domain.Adresse@6ae06ae[rue=55, Rue Gustave Eiffel,ville=Paris,codePostal=75000,pays=5,paysNaissance=3,villeNaissance=Paris,codePostalNaissance=43000],civilite=4,situationFamiliale=1,nomPatrimonial=ROUXP,nomMarital=,prenom=Pierre,prenom2=Pierre,codeSecu=208642935108231,dateNaissance=Mon Aug 28 00:00:00 CET 1363]: Field error in object 'item' on field 'dateNaissance': rejected value [Mon Aug 28 00:00:00 CET 1363]; codes [Client.dateNaissance[erreur sur date naissance].item.dateNaissance,Client.dateNaissance[erreur sur date naissance].dateNaissance,Client.dateNaissance[erreur sur date naissance].java.util.Date,Client.dateNaissance[erreur sur date naissance]]; arguments []; default message [erreur sur date naissance] |
||||||||||||||||||||||||||||||||||||||||||||||
I'm not sure including the item itself and/or the validation result object (BeanPropertyBindingResult in spring validator case) would be useful - both item and validation result can be arbitrary objects, so you would need to use instanceof checks or reflection to get more than "toString" information.