On Tuesday 22 February 2011 7:24:10 PM Jason Pell wrote: > Ok - I give up. I can see now that I misunderstood. The jaxb-ri is > where I would need to > be looking, but from what I can tell the ValidatingUnmarshaller hard > codes the setErrorHandler > > So I guess for now I am stuck with the errors as they stand.
Yea. I kind of remember having to do some other wacky hacks when trying to get validation working with MTOM due to some of the same issues. I had to catch the exception and check the error message for specific strings and such. Kind of crappy. I would suggest logging a request with the JAXB folks to add a new property for an ErrorHandler of some sort. Dan > > On Wed, Feb 23, 2011 at 10:41 AM, Jason Pell <[email protected]> wrote: > > Ok - sorry for the repeated of emails, I think I have answered my own > > questions. I believe I know where I would add a XMLErrorHandler, its > > to > > > > ./rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataRe > > ader.java > > > > The private Element validate(XMLStreamReader input) method is where > > the jaxp validator is created. > > > > This method could be enhanced much like > > org.apache.cxf.jaxb.io.DataReaderImpl is configured with a jaxb > > validation event handler to configure an XMLErrorHandler I should > > think. > > > > I might have a play around with it and submit a patch if I come up > > with something. > > > > Cheers > > Jason > > > > On Wed, Feb 23, 2011 at 10:21 AM, Jason Pell <[email protected]> wrote: > >> Ok - this looks like what I need - now to figure out where in cxf I can > >> do this! > >> > >> http://stackoverflow.com/questions/4864681/jaxb-2-0-schema-validation-pr > >> oblem > >> > >> I need to register an XMLErrorHandler > >> > >> Any ideas? > >> > >> On Wed, Feb 23, 2011 at 10:18 AM, Jason Pell <[email protected]> wrote: > >>> It looks like I need to somehow override xerces error handling as this > >>> is the partial stack trace from the JAXBEncoderDecoder > >>> > >>> Caused by: org.xml.sax.SAXParseException: cvc-minInclusive-valid: > >>> Value '2009-12-31T23:59:59' is not facet-valid with respect to > >>> minInclusive '2010-01-01T00:00:00.0' for type > >>> '#AnonType_childSubmissionDatesPerson'. > >>> at > >>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXP > >>> arseException(ErrorHandlerWrapper.java:195) at > >>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Erro > >>> rHandlerWrapper.java:131) at > >>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(X > >>> MLErrorReporter.java:384) at > >>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(X > >>> MLErrorReporter.java:318) at > >>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIError > >>> Reporter.reportError(XMLSchemaValidator.java:417) at > >>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSc > >>> hemaError(XMLSchemaValidator.java:3182) at > >>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementL > >>> ocallyValidType(XMLSchemaValidator.java:3097) at > >>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processE > >>> lementContent(XMLSchemaValidator.java:3007) at > >>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEn > >>> dElement(XMLSchemaValidator.java:2150) at > >>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endEleme > >>> nt(XMLSchemaValidator.java:818) > >>> > >>> On Wed, Feb 23, 2011 at 9:15 AM, Jason Pell <[email protected]> wrote: > >>>> Hi, > >>>> > >>>> I have the ValidationEventHandler working but this does not actually > >>>> appear to allow me to modify the content of the soap fault. I have > >>>> been digging in JAXBEncoderDecoder and can see that the exception from > >>>> the jaxb unmarshaller is wrapped in a fault and thrown. So in cxf > >>>> itself there does not appear to be anything I can do to modify the > >>>> soap message details (to for example add a line number). > >>>> > >>>> When I tried to implement my own handler by throwing a run time > >>>> exception, jaxb appeared to treat this as though I had returned false > >>>> from the handler and completely ignored my exception. > >>>> > >>>> I will keep digging into the jaxb ri for more insight but if anyone > >>>> has anything I would appreciate it. > >>>> > >>>> Thanks > >>>> Jason -- Daniel Kulp [email protected] http://dankulp.com/blog Talend - http://www.talend.com
