Commit 3c8eb717 authored by Lukáš Marek's avatar Lukáš Marek

more java 6 compatibility fixes

parent 567bec58
......@@ -178,9 +178,17 @@ public class ClientServerEvaluationRunner {
private void writeFile (final String filename, final String str)
throws FileNotFoundException {
try (PrintWriter out = new PrintWriter (filename)) {
PrintWriter out = null;
try {
out = new PrintWriter (filename);
out.print (str);
}
finally {
if(out != null) {
out.close ();
}
}
}
......@@ -236,8 +244,12 @@ public class ClientServerEvaluationRunner {
private String getResource (final String filename)
throws IOException {
try (BufferedReader reader = new BufferedReader (
new InputStreamReader (this.c.getResourceAsStream (filename), "UTF-8"));) {
BufferedReader reader = null;
try {
reader = new BufferedReader (
new InputStreamReader (this.c.getResourceAsStream (filename), "UTF-8"));
final StringBuffer buffer = new StringBuffer ();
for (int c = reader.read (); c != -1; c = reader.read ()) {
......@@ -245,6 +257,10 @@ public class ClientServerEvaluationRunner {
}
return buffer.toString ();
} finally {
if(reader != null) {
reader.close ();
}
}
}
......
......@@ -106,9 +106,17 @@ public class ClientServerRunner {
private void writeFile (final String filename, final String str)
throws FileNotFoundException {
try (PrintWriter out = new PrintWriter (filename)) {
PrintWriter out = null;
try {
out = new PrintWriter (filename);
out.print (str);
}
finally {
if(out != null) {
out.close ();
}
}
}
......@@ -156,8 +164,12 @@ public class ClientServerRunner {
private String getResource (final String filename)
throws IOException {
try (BufferedReader reader = new BufferedReader (
new InputStreamReader (this.c.getResourceAsStream (filename), "UTF-8"));) {
BufferedReader reader = null;
try {
reader = new BufferedReader (
new InputStreamReader (this.c.getResourceAsStream (filename), "UTF-8"));
final StringBuffer buffer = new StringBuffer ();
for (int c = reader.read (); c != -1; c = reader.read ()) {
......@@ -165,6 +177,10 @@ public class ClientServerRunner {
}
return buffer.toString ();
} finally {
if(reader != null) {
reader.close ();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment