diff options
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/neighborhood/ExternalNeighborhood.java')
-rw-r--r-- | src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/neighborhood/ExternalNeighborhood.java | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/neighborhood/ExternalNeighborhood.java b/src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/neighborhood/ExternalNeighborhood.java index 33b5010a..5bdd05bf 100644 --- a/src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/neighborhood/ExternalNeighborhood.java +++ b/src/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/neighborhood/ExternalNeighborhood.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.algorithm.outlier.spatial.neighborhood; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2013 + Copyright (C) 2014 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team @@ -169,13 +169,11 @@ public class ExternalNeighborhood extends AbstractPrecomputedNeighborhood { } } - try { - if(LOG.isDebugging()) { - LOG.verbose("Loading neighborhood file."); - } - InputStream in = new FileInputStream(file); - in = FileUtil.tryGzipInput(in); - BufferedReader br = new BufferedReader(new InputStreamReader(in)); + if(LOG.isDebugging()) { + LOG.verbose("Loading neighborhood file."); + } + try(InputStream in = FileUtil.tryGzipInput(new FileInputStream(file)); + BufferedReader br = new BufferedReader(new InputStreamReader(in))) { for(String line; (line = br.readLine()) != null;) { ArrayModifiableDBIDs neighbours = DBIDUtil.newArray(); String[] entries = line.split(" "); @@ -200,9 +198,6 @@ public class ExternalNeighborhood extends AbstractPrecomputedNeighborhood { } } } - br.close(); - in.close(); - return store; } catch(IOException e) { |