if (this.needsRefresh) {
this.refresh();
}
// VG: Why exception is not thrown in constructor?
if (this.exception != null) {
throw new ProcessingException(this.exception);
}
if (this.redirectSource != null) {
try {
return this.redirectSource.getInputStream();
} catch (SourceException se) {
throw SourceUtil.handle(se);
}
}
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
this.environment.setOutputStream(os);
try {
CocoonComponentManager.enterEnvironment(this.environment,
this.manager,
this.pipelineProcessor);
this.processingPipeline.process(this.environment);
} finally {
CocoonComponentManager.leaveEnvironment();
}
return new ByteArrayInputStream(os.toByteArray());
} catch (ProcessingException e) {
throw e;
} catch (Exception e) {
throw new ProcessingException("Exception during processing of " + this.systemId, e);
} finally {
// Unhide wrapped environment output stream
this.environment.setOutputStream(null);
reset();
}