2424import java .io .File ;
2525import java .io .FileInputStream ;
2626import java .io .FileNotFoundException ;
27+ import java .io .IOException ;
2728import java .io .InputStream ;
2829import java .text .ParseException ;
2930import java .text .SimpleDateFormat ;
3536import org .apache .maven .plugin .MojoExecutionException ;
3637import org .apache .maven .plugin .logging .Log ;
3738import org .apache .maven .plugins .issues .Issue ;
38- import org .codehaus .plexus .util .IOUtil ;
3939import org .xml .sax .Attributes ;
4040import org .xml .sax .InputSource ;
4141import org .xml .sax .helpers .DefaultHandler ;
@@ -64,8 +64,8 @@ public class JiraXML extends DefaultHandler {
6464 private SimpleDateFormat sdf ;
6565
6666 /**
67- * @param log not null.
68- * @param datePattern may be null.
67+ * @param log not null
68+ * @param datePattern may be null
6969 * @since 2.4
7070 */
7171 public JiraXML (Log log , String datePattern ) {
@@ -83,22 +83,20 @@ public JiraXML(Log log, String datePattern) {
8383 }
8484
8585 /**
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()}.
8787 *
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
9090 * @since 2.4
9191 */
9292 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 )) {
9694 InputSource inputSource = new InputSource (xmlStream );
9795 parse (inputSource );
9896 } catch (FileNotFoundException e ) {
9997 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 );
102100 }
103101 }
104102
0 commit comments