Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #19 from kunigaku/file-leak
Fix JENKINS-18858
  • Loading branch information
ssogabe committed Oct 16, 2013
2 parents d04c87d + 3d7a8d2 commit cf35b92
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -26,6 +26,7 @@

import java.io.File;
import java.io.FilenameFilter;
import java.io.InputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -542,7 +543,8 @@ public FilePath[] invoke(File f, VirtualChannel channel) throws IOException, Int

for (FilePath filePath : r) {
try {
XMLEventReader reader = factory.createXMLEventReader(filePath.read());
InputStream is = filePath.read();
XMLEventReader reader = factory.createXMLEventReader(is);
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
Expand All @@ -556,6 +558,7 @@ public FilePath[] invoke(File f, VirtualChannel channel) throws IOException, Int
}
}
reader.close();
IOUtils.closeQuietly(is);
} catch (XMLStreamException e) {
throw new IOException(filePath + " is not an XML file, please check your report pattern");
}
Expand Down

0 comments on commit cf35b92

Please sign in to comment.