}
}
catch ( MavenReportException e )
{
String report = ( reportMojoInfo == null ) ? ( '"' + localReportName + "\" report" ) : reportMojoInfo;
throw new RendererException( "Error generating " + report + ": " + e.getMessage(), e );
}
catch ( LinkageError e )
{
String report = ( reportMojoInfo == null ) ? ( '"' + localReportName + "\" report" ) : reportMojoInfo;
log.warn( "An issue has occurred with " + report + ", skipping LinkageError "
+ e.getMessage() + ", please report an issue to Maven dev team.", e );
}
finally
{
if ( classLoader != null )
{
Thread.currentThread().setContextClassLoader( originalClassLoader );
}
mainSink.close();
}
if ( report.isExternalReport() )
{
// external reports are rendered from their own: no Doxia site rendering needed
return;
}
// render main sink
renderer.generateDocument( writer, mainSink, siteRenderingContext );
// render sub-sinks, eventually created by multi-page reports
try
{
List<MultiPageSubSink> sinks = multiPageSinkFactory.sinks();
log.debug( "Multipage report: " + sinks.size() + " subreports" );
for ( MultiPageSubSink mySink : sinks )
{
mySink.enableLogging( new MojoLogWrapper( log ) );
log.debug( " Rendering " + mySink.getOutputName() );
File outputFile = new File( mySink.getOutputDir(), mySink.getOutputName() );
Writer out = null;
try
{
out = WriterFactory.newWriter( outputFile, siteRenderingContext.getOutputEncoding() );
renderer.generateDocument( out, mySink, siteRenderingContext );
}
finally
{
mySink.close();
IOUtil.close( out );
}
}
}
catch ( IOException e )
{
throw new RendererException( "Cannot create writer", e );
}
}