karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject karaf git commit: [KARAF-3500]NPE throws when executing "bin/client shutdown"
Date Thu, 05 Feb 2015 04:14:57 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x aafcdd1af -> 07f885815


[KARAF-3500]NPE throws when executing "bin/client shutdown"


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/07f88581
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/07f88581
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/07f88581

Branch: refs/heads/karaf-3.0.x
Commit: 07f8858153407d06894924ee9d8c89693f447c0c
Parents: aafcdd1
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Thu Feb 5 12:14:16 2015 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Thu Feb 5 12:14:16 2015 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/karaf/system/commands/Shutdown.java   | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/07f88581/system/command/src/main/java/org/apache/karaf/system/commands/Shutdown.java
----------------------------------------------------------------------
diff --git a/system/command/src/main/java/org/apache/karaf/system/commands/Shutdown.java b/system/command/src/main/java/org/apache/karaf/system/commands/Shutdown.java
index bc71e57..a185329 100644
--- a/system/command/src/main/java/org/apache/karaf/system/commands/Shutdown.java
+++ b/system/command/src/main/java/org/apache/karaf/system/commands/Shutdown.java
@@ -69,6 +69,12 @@ public class Shutdown extends AbstractSystemAction {
                 msg = String.format("Confirm: halt instance %s (yes/no): ", karafName);
             }
             ConsoleReader reader = (ConsoleReader) session.get(".jline.reader");
+            if (reader == null) {
+                //this is a remote client with shutdown argument so here isn't a interactive
way
+                // so return a prompt message instead of NPE
+                System.out.println("please use \"shutdown -f\" or \"shutdown --force\" to
shutdown instance: " + karafName );
+                return null;
+            }
             String str = reader.readLine(msg);
             if (str.equalsIgnoreCase("yes")) {
                 if (reboot) {


Mime
View raw message