diff --git a/src/main/java/org/opengauss/cmrestapi/OGCmdExecuter.java b/src/main/java/org/opengauss/cmrestapi/OGCmdExecuter.java index 414988b8caac11722f5d680a2d9a9e21ef370c6a..0fe5f4f27031eda07ec15edb48db6667d79f334f 100644 --- a/src/main/java/org/opengauss/cmrestapi/OGCmdExecuter.java +++ b/src/main/java/org/opengauss/cmrestapi/OGCmdExecuter.java @@ -71,8 +71,12 @@ public class OGCmdExecuter { BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); StringBuffer sb = new StringBuffer(); String line; - while ((line = br.readLine()) != null) { - sb.append(line).append(System.lineSeparator()); + try { + while ((line = br.readLine()) != null) { + sb.append(line).append(System.lineSeparator()); + } + }finally { + br.close(); } int statusCode = process.waitFor(); String resultString = sb.toString();