@@ -65,15 +65,16 @@ public void addReporter(ReporterParameter parameter, Reporter reporter) {
6565 * Writes the reports to the output.
6666 *
6767 * @param connection The database {@link Connection}
68- * @throws MojoExecutionException if any exception happens
68+ * @throws SQLException if database access fails
69+ * @throws IOException if files can't be written
6970 */
70- public void writeReports (Connection connection ) throws MojoExecutionException {
71+ public void writeReports (Connection connection ) throws SQLException , IOException {
7172 for (Pair <Reporter , ReporterParameter > pair : reporters ) {
7273 writeReports (connection , pair .getLeft (), pair .getRight ());
7374 }
7475 }
7576
76- private void writeReports (Connection connection , Reporter reporter , ReporterParameter reporterParameter ) throws MojoExecutionException {
77+ private void writeReports (Connection connection , Reporter reporter , ReporterParameter reporterParameter ) throws IOException , SQLException {
7778 FileOutputStream fileOutputStream = null ;
7879 try {
7980 OutputBuffer buffer = OutputBufferProvider .getCompatibleOutputBuffer (databaseVersion , reporter , connection );
@@ -103,15 +104,9 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara
103104
104105 buffer .printAvailable (connection , printStreams );
105106
106- } catch (FileNotFoundException | SQLException e ) {
107- throw new MojoExecutionException (e .getMessage (), e );
108107 } finally {
109108 if (fileOutputStream != null ) {
110- try {
111- fileOutputStream .close ();
112- } catch (IOException e ) {
113- log .error (format ("Couldn't close the output stream %s" , reporterParameter .getClass ()));
114- }
109+ fileOutputStream .close ();
115110 }
116111 }
117112 }
0 commit comments