Skip to content

Commit

Permalink
add some InputFileStream close at end of reads
Browse files Browse the repository at this point in the history
to make sure file is released
  • Loading branch information
reger committed Mar 24, 2014
1 parent ca7444d commit b126b9b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions source/net/yacy/cora/document/WordCache.java
Expand Up @@ -91,6 +91,8 @@ public Dictionary(final File file) throws IOException {
}
} catch (final IOException e) {
// finish
} finally {
reader.close();
}
}

Expand Down
2 changes: 2 additions & 0 deletions source/net/yacy/cora/storage/KeyList.java
Expand Up @@ -69,6 +69,8 @@ public KeyList(final File file) throws IOException {
}
} catch (final IOException e) {
// finish
} finally {
reader.close();
}
}

Expand Down
6 changes: 5 additions & 1 deletion source/net/yacy/gui/framework/Switchboard.java
Expand Up @@ -161,14 +161,18 @@ public static void shutdown() {
* @param propFile
*/
public static void load(File propFile) {
FileInputStream fis = null;
try {
properties.load(new FileInputStream(propFile));
fis = new FileInputStream(propFile);
properties.load(fis);
} catch (final FileNotFoundException e1) {
log.info("error: file dispatcher.properties does not exist. Exit");
System.exit(-1);
} catch (final IOException e1) {
log.info("error: file dispatcher.properties cannot be readed. Exit");
System.exit(-1);
} finally {
if (fis != null) try { fis.close(); } catch (IOException ex) { }
}
}

Expand Down
5 changes: 3 additions & 2 deletions source/net/yacy/yacy.java
Expand Up @@ -538,8 +538,9 @@ static private void preReadSavedConfigandInit(File dataHome) {
if (configFile.exists()) {
Properties p = new Properties();
try {
p.load(new FileInputStream(configFile));

FileInputStream fis = new FileInputStream(configFile);
p.load(fis);
fis.close();
// Test for server access restriction (is implemented using Jetty IPaccessHandler which does not support IPv6
// try to disavle IPv6
String teststr = p.getProperty("serverClient", "*");
Expand Down

0 comments on commit b126b9b

Please sign in to comment.