protected String readAnnouncement()

in src/main/java/org/apache/maven/plugins/changes/announcement/AnnouncementMailMojo.java [325:343]


    protected String readAnnouncement(File file) throws MojoExecutionException {
        try {
            if (templateEncoding == null || templateEncoding.isEmpty()) {
                templateEncoding = Charset.defaultCharset().displayName();
                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);
        }
    }