Package org.apache.maven.doxia.siterenderer

Examples of org.apache.maven.doxia.siterenderer.RendererException


            }
        }
        catch ( MavenReportException e )
        {
            throw new RendererException( "Error rendering Maven report: " + e.getMessage(), e );
        }
        catch ( LinkageError e )
        {
            StringBuilder stringBuilder =
                new StringBuilder( " an issue has occured with report " + report.getClass().getName() );
            stringBuilder.append( ", skip LinkageError " + e.getMessage() + ", please report an issue to maven dev team" );
            log.warn( stringBuilder.toString(), e );
        }
        finally
        {
            Thread.currentThread().setContextClassLoader( originalClassLoader );
            sink.close();
        }

        if ( !report.isExternalReport() )
        {
            try
            {
                List sinks = sf.sinks();

                log.debug( "Multipage report: " + sinks.size() + " subreports" );

                for ( Iterator it = sinks.iterator(); it.hasNext(); )
                {
                    MySink mySink = (MySink) it.next();
                    mySink.enableLogging( new MojoLogWrapper( log ) );

                    log.debug( "  Rendering " + mySink.getOutputName() );

                    Writer out = new FileWriter( new File( mySink.getOutputDir(), mySink.getOutputName() ) );

                    try
                    {
                        renderer.generateDocument( out, mySink, siteRenderingContext );
                    }
                    finally
                    {
                        mySink.close();
                    }
                }
            }
            catch ( IOException e )
            {
                throw new RendererException( "Cannot create writer", e );
            }

            renderer.generateDocument( writer, sink, siteRenderingContext );
        }
    }
View Full Code Here


                report.generate( sink, locale );
            }
        }
        catch ( MavenReportException e )
        {
            throw new RendererException( "Error rendering Maven report: " + e.getMessage(), e );
        }
        catch ( LinkageError e )
        {
            log.warn( "An issue has occurred with report " + report.getClass().getName() + ", skip LinkageError "
                          + e.getMessage() + ", please report an issue to Maven dev team.", e );
        }
        finally
        {
            if ( classLoader != null )
            {
                Thread.currentThread().setContextClassLoader( originalClassLoader );
            }
            sink.close();
        }

        if ( !report.isExternalReport() )
        {
            try
            {
                List<MySink> sinks = sf.sinks();

                log.debug( "Multipage report: " + sinks.size() + " subreports" );

                for ( MySink 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 );
            }

            renderer.generateDocument( writer, sink, siteRenderingContext );
        }
    }
View Full Code Here

            }
        }
        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 );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.doxia.siterenderer.RendererException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.