24
24
import java .io .File ;
25
25
import java .io .FileInputStream ;
26
26
import java .io .FileNotFoundException ;
27
+ import java .io .IOException ;
27
28
import java .io .InputStream ;
28
29
import java .text .ParseException ;
29
30
import java .text .SimpleDateFormat ;
35
36
import org .apache .maven .plugin .MojoExecutionException ;
36
37
import org .apache .maven .plugin .logging .Log ;
37
38
import org .apache .maven .plugins .issues .Issue ;
38
- import org .codehaus .plexus .util .IOUtil ;
39
39
import org .xml .sax .Attributes ;
40
40
import org .xml .sax .InputSource ;
41
41
import org .xml .sax .helpers .DefaultHandler ;
@@ -64,8 +64,8 @@ public class JiraXML extends DefaultHandler {
64
64
private SimpleDateFormat sdf ;
65
65
66
66
/**
67
- * @param log not null.
68
- * @param datePattern may be null.
67
+ * @param log not null
68
+ * @param datePattern may be null
69
69
* @since 2.4
70
70
*/
71
71
public JiraXML (Log log , String datePattern ) {
@@ -83,22 +83,20 @@ public JiraXML(Log log, String datePattern) {
83
83
}
84
84
85
85
/**
86
- * Parse the given xml file. The list of issues can then be retrieved with {@link #getIssueList()}.
86
+ * Parse the given XML file. The list of issues can then be retrieved with {@link #getIssueList()}.
87
87
*
88
- * @param xmlPath the file to pares.
89
- * @throws MojoExecutionException in case of errors.
88
+ * @param xmlPath the file to parse
89
+ * @throws MojoExecutionException in case of errors
90
90
* @since 2.4
91
91
*/
92
92
public void parseXML (File xmlPath ) throws MojoExecutionException {
93
- InputStream xmlStream = null ;
94
- try {
95
- xmlStream = new FileInputStream (xmlPath );
93
+ try (InputStream xmlStream = new FileInputStream (xmlPath )) {
96
94
InputSource inputSource = new InputSource (xmlStream );
97
95
parse (inputSource );
98
96
} catch (FileNotFoundException e ) {
99
97
throw new MojoExecutionException ("Failed to open JIRA XML file " + xmlPath , e );
100
- } finally {
101
- IOUtil . close ( xmlStream );
98
+ } catch ( IOException e ) {
99
+ throw new MojoExecutionException ( "Failed to read JIRA XML file " + xmlPath , e );
102
100
}
103
101
}
104
102
0 commit comments