add some InputFileStream close at end of reads

to make sure file is released
pull/1/head
reger 11 years ago
parent ca7444dbdf
commit b126b9ba17

@ -91,6 +91,8 @@ public class WordCache {
} }
} catch (final IOException e) { } catch (final IOException e) {
// finish // finish
} finally {
reader.close();
} }
} }

@ -69,6 +69,8 @@ public class KeyList implements Iterable<String> {
} }
} catch (final IOException e) { } catch (final IOException e) {
// finish // finish
} finally {
reader.close();
} }
} }

@ -161,14 +161,18 @@ public class Switchboard {
* @param propFile * @param propFile
*/ */
public static void load(File propFile) { public static void load(File propFile) {
FileInputStream fis = null;
try { try {
properties.load(new FileInputStream(propFile)); fis = new FileInputStream(propFile);
properties.load(fis);
} catch (final FileNotFoundException e1) { } catch (final FileNotFoundException e1) {
log.info("error: file dispatcher.properties does not exist. Exit"); log.info("error: file dispatcher.properties does not exist. Exit");
System.exit(-1); System.exit(-1);
} catch (final IOException e1) { } catch (final IOException e1) {
log.info("error: file dispatcher.properties cannot be readed. Exit"); log.info("error: file dispatcher.properties cannot be readed. Exit");
System.exit(-1); System.exit(-1);
} finally {
if (fis != null) try { fis.close(); } catch (IOException ex) { }
} }
} }

@ -538,8 +538,9 @@ public final class yacy {
if (configFile.exists()) { if (configFile.exists()) {
Properties p = new Properties(); Properties p = new Properties();
try { 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 // Test for server access restriction (is implemented using Jetty IPaccessHandler which does not support IPv6
// try to disavle IPv6 // try to disavle IPv6
String teststr = p.getProperty("serverClient", "*"); String teststr = p.getProperty("serverClient", "*");

Loading…
Cancel
Save