There are really two ways to handle it:

1) When you set the schema into the wstx StreamReader, then wrapper it with a 
new stream reader delegate that would override the "next" method to catch it 
and map it to a fault.


2) Add an interceptor to the FaultOut chain that would check the class of the 
exception and if it's the wstx validation exception, do whatever mapping is 
needed. 

Dan


On Fri June 5 2009 9:14:53 pm Benson Margulies wrote:
> Next question: Exception mapping. Woodstox throws what it throws, in
> the middle of StaxUtils, when this goes off.
>
> I'm trying to figure out how to turn this into a fault.
>
> SchemaValidationTest [JUnit]
>       org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at 
> localhost:52320
>               Thread [main] (Running)
>               Thread [ReaderThread] (Running)
>               Thread [Thread-1] (Suspended (exception 
> WstxValidationException))
>                       
> ValidatingStreamReader(StreamScanner).reportValidationProblem(XMLValidat
>ionProblem) line: 540
>                       
> NsInputElementStack(InputElementStack).reportProblem(XMLValidationProble
>m) line: 380
>                       GenericMsvValidator.reportError(String, Location) line: 
> 521
>                       GenericMsvValidator.reportError(String) line: 513
>                       GenericMsvValidator.reportError(StringRef) line: 507
>                       GenericMsvValidator.validateElementStart(String, 
> String, String) line:
> 261 NsInputElementStack.resolveAndValidateElement() line: 370
>                       
> ValidatingStreamReader(BasicStreamReader).handleStartElem(char) line:
> 2926 ValidatingStreamReader(BasicStreamReader).nextFromTree() line: 2786
> ValidatingStreamReader(BasicStreamReader).next() line: 1054
>                       DepthXMLStreamReader.next() line: 220
>                       StaxUtils.toNextElement(DepthXMLStreamReader) line: 302
>                       DocLiteralInInterceptor.getPara(DepthXMLStreamReader,
> DataReader<XMLStreamReader>, MessageContentsList,
> Iterator<MessagePartInfo>, Message) line: 217
>                       DocLiteralInInterceptor.handleMessage(Message) line: 117
>                       PhaseInterceptorChain.doIntercept(Message) line: 236
>                       ChainInitiationObserver.onMessage(Message) line: 89
>                       LocalConduit$1$1.run() line: 132
>                       Thread.run() line: 613
>       /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java
> (Jun 5, 2009 9:13:03 PM)

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to