// Javadoc inherited.
public void play(XMLProcess process) throws SAXException {
XMLPipeline pipeline = process.getPipeline();
ContextManagerProcess cup = new ContextManagerProcess();
cup.setPipeline(pipeline);
cup.setNextProcess(process);
cup.startProcess();
XMLPipelineContext context = pipeline.getPipelineContext();
Locator playLocator = player.getLocator();
context.pushLocator(playLocator);
manager = context.getFlowControlManager();
try {
player.setContentHandler(cup);
player.setFlowController(this);
player.play();
} catch (SAXException x) {
// Catching, logging and re-throwing because this exception may get lost
// in case of IllegalStateException thrown inside finally
logger.error(x);
throw x;
} finally {
manager = null;
Locator poppedLocator = (Locator) context.popLocator();
if (poppedLocator != playLocator) {
if (logger.isDebugEnabled()) {
String pushed = (null != playLocator) ? playLocator.getPublicId() : "null";
String popped = (null != poppedLocator) ? poppedLocator.getPublicId() : "null";
logger.debug("Popped locator does not match pushed locator." +
" Pushed: " + pushed +
" Popped: " + popped);
}
throw new IllegalStateException(
"Popped locator does not match pushed locator");
}
}
// TODO: move it to finally or explain why this is not inside finally
cup.stopProcess();
}