if (this.errorPipeline != null) {
return this.errorPipeline.process(environment, consumer);
}
// Have to buffer events if error handler is specified.
SaxBuffer buffer = null;
this.lastConsumer = this.errorHandler == null? consumer: (buffer = new SaxBuffer());
try {
connectPipeline(environment);
return processXMLPipeline(environment);
} catch (ProcessingException e) {
buffer = null;
return processErrorHandler(environment, e, consumer);
} finally {
if (buffer != null) {
try {
buffer.toSAX(consumer);
} catch (SAXException e) {
throw new ProcessingException("Failed to execute pipeline.", e);
}
}
}