From coverity: fix resource leak

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2215 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2014-01-28 21:25:29 +00:00
parent 06741a59c9
commit e65a0361f5
1 changed files with 13 additions and 2 deletions

View File

@ -38,8 +38,19 @@ public class OSXInfoPlist {
}
protected static String getInfoPlistContent() throws IOException {
FileInputStream fileInputStream = new FileInputStream(getInfoPlistPath());
return new String(IOUtil.readFully(fileInputStream));
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(getInfoPlistPath());
return new String(IOUtil.readFully(fileInputStream));
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
// ignore
}
}
}
}
/**