Strabon

changeset 496:db1950dca920

close reader in QueryDir to avoid possible memory leak
author Babis Nikolaou <charnik@di.uoa.gr>
date Mon Jul 23 17:45:44 2012 +0300 (2012-07-23)
parents 87cac069e8e4
children ff46d93c0c3b
files runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryDir.java runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryDir.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryDir.java	Mon Jul 23 17:32:21 2012 +0300
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryDir.java	Mon Jul 23 17:45:44 2012 +0300
     1.3 @@ -82,13 +82,14 @@
     1.4  
     1.5  	private static String readFile(String file) throws IOException {
     1.6  		BufferedReader reader = new BufferedReader( new FileReader(file));
     1.7 -		String line  = null;
     1.8 +		String line = null;
     1.9  		StringBuilder stringBuilder = new StringBuilder();
    1.10  		String ls = System.getProperty("line.separator");
    1.11  		while( ( line = reader.readLine() ) != null ) {
    1.12  			stringBuilder.append( line );
    1.13  			stringBuilder.append( ls );
    1.14  		}
    1.15 +		reader.close();
    1.16  		return stringBuilder.toString();
    1.17  	}
    1.18  }
     2.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryDir.java	Mon Jul 23 17:32:21 2012 +0300
     2.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryDir.java	Mon Jul 23 17:45:44 2012 +0300
     2.3 @@ -84,13 +84,14 @@
     2.4  
     2.5  	private static String readFile(String file) throws IOException {
     2.6  		BufferedReader reader = new BufferedReader( new FileReader(file));
     2.7 -		String line  = null;
     2.8 +		String line = null;
     2.9  		StringBuilder stringBuilder = new StringBuilder();
    2.10  		String ls = System.getProperty("line.separator");
    2.11  		while( ( line = reader.readLine() ) != null ) {
    2.12  			stringBuilder.append( line );
    2.13  			stringBuilder.append( ls );
    2.14  		}
    2.15 +		reader.close();
    2.16  		return stringBuilder.toString();
    2.17  	}
    2.18  }