You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2015/05/03 23:25:52 UTC
[2/2] incubator-nifi git commit: NIFI-573 fix NPE in nifi.sh and
clean up open streams
NIFI-573 fix NPE in nifi.sh and clean up open streams
Signed-off-by: Mark Payne <ma...@hotmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/22ded807
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/22ded807
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/22ded807
Branch: refs/heads/develop
Commit: 22ded807be8a81f09b618af4c79a9b2d8ee7496f
Parents: 018473b
Author: Mark Latimer <ma...@gmail.com>
Authored: Sat May 2 12:47:29 2015 +0100
Committer: Mark Payne <ma...@hotmail.com>
Committed: Sun May 3 17:13:30 2015 -0400
----------------------------------------------------------------------
.../src/main/java/org/apache/nifi/bootstrap/RunNiFi.java | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/22ded807/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
index d3796b5..bb83e3d 100644
--- a/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
+++ b/nifi/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
@@ -276,6 +276,8 @@ public class RunNiFi {
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
final String response = reader.readLine();
logger.log(Level.FINE, "PING response: {0}", response);
+ out.close();
+ reader.close();
return PING_CMD.equals(response);
} catch (final IOException ioe) {
@@ -425,6 +427,7 @@ public class RunNiFi {
final Integer port = getCurrentPort();
if (port == null) {
System.out.println("Apache NiFi is not currently running");
+ return;
}
final Properties nifiProps = loadProperties();
@@ -442,6 +445,7 @@ public class RunNiFi {
final OutputStream out = socket.getOutputStream();
out.write((DUMP_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8));
out.flush();
+ out.close();
final InputStream in = socket.getInputStream();
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
@@ -449,6 +453,7 @@ public class RunNiFi {
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
+ reader.close();
}
final String dump = sb.toString();
@@ -483,10 +488,12 @@ public class RunNiFi {
final OutputStream out = socket.getOutputStream();
out.write((SHUTDOWN_CMD + " " + secretKey + "\n").getBytes(StandardCharsets.UTF_8));
out.flush();
+ out.close();
final InputStream in = socket.getInputStream();
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
final String response = reader.readLine();
+ reader.close();
logger.log(Level.FINE, "Received response to SHUTDOWN command: {0}", response);