bool = Boolean.TRUE;
}
if ( bool != null && bool.booleanValue() ) {
boolean read = false;
SaxBuffer buffer = new SaxBuffer();
Exception error = null;
try {
if ( timeout != null ) {
final int milli = timeout.intValue() * 1000;
LoaderThread loader = new LoaderThread(this, coplet, buffer);
final RunnableManager runnableManager = (RunnableManager)this.manager.lookup( RunnableManager.ROLE );
try {
runnableManager.execute( new CocoonRunnable(loader) );
} finally {
this.manager.release( runnableManager );
}
try {
read = loader.join( milli );
} catch (InterruptedException ignore) {
// ignored
}
error = loader.exception;
if ( error != null && this.getLogger().isWarnEnabled() ) {
this.getLogger().warn("Unable to get content of coplet: " + coplet.getId(), error);
}
} else {
this.streamContent( coplet, buffer );
read = true;
}
} catch (Exception exception ) {
error = exception;
this.getLogger().warn("Unable to get content of coplet: " + coplet.getId(), exception);
}
if ( read ) {
buffer.toSAX( contentHandler );
} else {
if ( !this.renderErrorContent(coplet, contentHandler, error)) {
// FIXME - get correct error message
contentHandler.startDocument();
XMLUtils.startElement( contentHandler, "p");