Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |
file stats: | LOC: | 36 |  | Methods: | 2
| NCLOC: | 26 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
FileReporter.java | 100% | 100% | 100% | 100% |

1 |  | /**
2 |  | * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 |  | */
4 |  | package net.sourceforge.pmd.cpd;
5 |  |
6 |  | import java.io.BufferedWriter;
7 |  | import java.io.File;
8 |  | import java.io.FileWriter;
9 |  | import java.io.IOException;
10 |  | import java.io.Writer;
11 |  |
12 |  | /**
13 |  | * @author Philippe T'Seyen
14 |  | */
15 |  | public class FileReporter {
16 |  | private File reportFile;
17 |  |
18 | 4 | public FileReporter(File reportFile) {
19 | 1 | if (reportFile == null) throw new NullPointerException("reportFile can not be null");
20 | 3 | this.reportFile = reportFile;
21 |  | }
22 |  |
23 | 3 | public void report(String content) throws ReportException {
24 | 3 | try {
25 | 3 | Writer writer = null;
26 | 3 | try {
27 | 3 | writer = new BufferedWriter(new FileWriter(reportFile));
28 | 2 | writer.write(content);
29 |  | } finally {
30 | 2 | if (writer != null) writer.close();
31 |  | }
32 |  | } catch (IOException ioe) {
33 | 1 | throw new ReportException(ioe);
34 |  | }
35 |  | }
36 |  | }