[SWS-717] Impossible to add custom error handling during JAXB marshalling/unmarshalling. Created: 12/Jul/11  Updated: 04/May/12  Resolved: 06/Oct/11

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 2.0 GA, 2.0.1, 2.0.2
Fix Version/s: 2.0.3

Type: Improvement Priority: Critical
Reporter: Victor Polischuk Assignee: Arjen Poutsma
Resolution: Fixed Votes: 0
Labels: third-party-compatibility
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Class "org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor" has private access methods "createUnmarshaller(..)" and "createMarshaller(..)" therefore developers (e.g. me) who might need to define custom validation (using "javax.xml.bind.ValidationEventHandler") cannot do it in easy way.

Usually, developer doesn't need to override default marshalling or unmarshalling validation behavior but the validator has a problem with "XmlGregorianCalendar" unmarshalling, it simply ignores the error (because it is warning for some reason) and it is impossible to get an exception without replacing default validator.

It would be very good if these methods ("createUnmarshaller(..)" and "createMarshaller(..)") had "protected" access modifier. In this case the methods should accept "JAXBContext" as a parameter instead of "Class<?>" to keep "getJaxbContext(..)" private.

Another option is adding additional setters for validation handler and many other JAXB options. It seems not so scalable but more strict.



 Comments   
Comment by Arjen Poutsma [ 06/Oct/11 ]

Fixed by adding protected create(Un)Marshaller methods, as suggested.

Comment by Arjen Poutsma [ 04/May/12 ]

Closing old issues

Generated at Sun Dec 17 11:54:33 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.