Skip to content
Permalink
Browse files
fix JENKINS-48102: CMake plugin leaks file handle on CMakeCache.txt
  • Loading branch information
15knots committed Nov 26, 2017
1 parent 9ab29db commit 859b3626990d3dda462cafcbb7b13ec8bd44afac
Showing with 12 additions and 10 deletions.
  1. +12 −10 src/main/java/hudson/plugins/cmake/BuildToolEntryParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015 Martin Weber.
* Copyright (c) 2015-2017 Martin Weber.
*
* Contributors:
* Martin Weber - Initial implementation
@@ -44,17 +44,19 @@ public String invoke(File cmakeCacheFile, VirtualChannel channel)
InputStreamReader isr = new InputStreamReader(
new BufferedInputStream(new FileInputStream(cmakeCacheFile)),
Charset.defaultCharset());
List<SimpleCMakeCacheEntry> result = new ArrayList<SimpleCMakeCacheEntry>(
1);
List<SimpleCMakeCacheEntry> result = new ArrayList<>(1);
final CMakeCacheFileParser parser = new CMakeCacheFileParser();
try {
parser.parse(isr, new EntryFilter() {

parser.parse(isr, new EntryFilter() {

@Override
public boolean accept(String key) {
return "CMAKE_MAKE_PROGRAM".equals(key);
}
}, result, null);
@Override
public boolean accept(String key) {
return "CMAKE_MAKE_PROGRAM".equals(key);
}
}, result, null);
} finally {
isr.close();
}
if (result.size() > 0) {
return result.get(0).getValue();
}

0 comments on commit 859b362

Please sign in to comment.