Close resources

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1362306 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-07-16 23:04:19 +00:00
parent 7cd8a704d6
commit fab7746481
3 changed files with 12 additions and 2 deletions

View File

@ -70,8 +70,10 @@ public class BeanShellClient {
while ((b=fis.read()) != -1){
os.write(b);
}
fis.close();
sendLine("bsh.prompt=\"bsh % \";",os);// Reset for other users
os.flush();
os.close();
sock.shutdownOutput(); // Tell server that we are done
}

View File

@ -285,9 +285,11 @@ public class HTTPJavaImpl extends HTTPAbstractImpl {
}
in = new BufferedInputStream(conn.getErrorStream());
}
// N.B. this closes 'in'
byte[] responseData = readResponse(res, in, contentLength);
if (instream != null) {
res.setBodySize(((CountingInputStream) instream).getCount());
instream.close();
}
return responseData;
}

View File

@ -16,6 +16,8 @@
*/
package org.apache.jmeter.monitor.model.benchmark;
import org.apache.commons.io.IOUtils;
public class ParseBenchmark {
/**
@ -41,21 +43,25 @@ public class ParseBenchmark {
if (args[2] != null) {
loops = Integer.parseInt(args[2]);
}
java.io.File infile = new java.io.File(file);
java.io.FileInputStream fis = null;
java.io.InputStreamReader isr = null;
java.io.BufferedReader br = null;
StringBuilder buf = new StringBuilder();
try {
fis = new java.io.FileInputStream(infile);
isr = new java.io.InputStreamReader(fis);
java.io.BufferedReader br = new java.io.BufferedReader(isr);
br = new java.io.BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
buf.append(line);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(br);
IOUtils.closeQuietly(isr);
IOUtils.closeQuietly(fis);
}
long start = 0;
long end = 0;