@@ -69,21 +69,22 @@ public Annotation getAnnotation() {
6969
7070 @ Override
7171 public void processStream (InputStream input ) throws IOException {
72- BufferedReader in = new BufferedReader (GitRepository .newLogReader (input ));
73- String line = "" ;
74- int lineno = 0 ;
75- Matcher matcher = BLAME_PATTERN .matcher (line );
76- while ((line = in .readLine ()) != null ) {
77- ++lineno ;
78- matcher .reset (line );
79- if (matcher .find ()) {
80- String rev = matcher .group (1 );
81- String author = matcher .group (2 ).trim ();
82- annotation .addLine (rev , author , true );
83- } else {
84- LOGGER .log (Level .SEVERE ,
85- "Error: did not find annotation in line {0}: [{1}] of {2}" ,
86- new Object []{String .valueOf (lineno ), line , annotation .getFilename ()});
72+ try (BufferedReader in = new BufferedReader (GitRepository .newLogReader (input ))) {
73+ String line = "" ;
74+ int lineno = 0 ;
75+ Matcher matcher = BLAME_PATTERN .matcher (line );
76+ while ((line = in .readLine ()) != null ) {
77+ ++lineno ;
78+ matcher .reset (line );
79+ if (matcher .find ()) {
80+ String rev = matcher .group (1 );
81+ String author = matcher .group (2 ).trim ();
82+ annotation .addLine (rev , author , true );
83+ } else {
84+ LOGGER .log (Level .SEVERE ,
85+ "Error: did not find annotation in line {0}: [{1}] of {2}" ,
86+ new Object []{String .valueOf (lineno ), line , annotation .getFilename ()});
87+ }
8788 }
8889 }
8990 }
0 commit comments