No functional changes.

Replaces Writer.close() in finally by try-with-ressource

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1797743 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2017-06-06 07:40:51 +00:00
parent 4e529f7055
commit 2388ed61f7
2 changed files with 3 additions and 16 deletions
@@ -472,10 +472,9 @@ public class CommonServices {
OutputStream out = (OutputStream) context.get("outputStream");
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
Writer writer = new OutputStreamWriter(out);
String line;
try {
try (Writer writer = new OutputStreamWriter(out)) {
while ((line = reader.readLine()) != null) {
Debug.logInfo("Read line: " + line, module);
writer.write(line);
@@ -483,12 +482,6 @@ public class CommonServices {
} catch (IOException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
} finally {
try {
writer.close();
} catch (Exception e) {
Debug.logError(e, module);
}
}
Map<String, Object> result = ServiceUtil.returnSuccess();