protected String readAnnouncement()

in src/main/java/org/apache/maven/plugins/announcement/AnnouncementMailMojo.java [363:393]


    protected String readAnnouncement( File file )
        throws MojoExecutionException
    {
        try
        {
            if ( templateEncoding == null || templateEncoding.isEmpty() )
            {
                templateEncoding = ReaderFactory.FILE_ENCODING;
                getLog().warn( "File encoding has not been set, using platform encoding '" + templateEncoding
                                   + "', i.e. build is platform dependent!" );

            }

            try ( InputStreamReader reader = new InputStreamReader( new FileInputStream( file ), templateEncoding ) )
            {
                return IOUtil.toString( reader );
            }
        }
        catch ( FileNotFoundException fnfe )
        {
            throw new MojoExecutionException( "File not found. " + file );
        }
        catch ( UnsupportedEncodingException uee )
        {
            throw new MojoExecutionException( "Unsupported encoding: '" + templateEncoding + "'" );
        }
        catch ( IOException ioe )
        {
            throw new MojoExecutionException( "Failed to read the announcement file.", ioe );
        }
    }