karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1163926 - in /karaf/cellar/branches/cellar-2.2.x: config/src/main/java/org/apache/karaf/cellar/config/shell/ shell/src/main/java/org/apache/karaf/cellar/shell/ shell/src/main/java/org/apache/karaf/cellar/shell/group/
Date Thu, 01 Sep 2011 07:42:45 GMT
Author: jbonofre
Date: Thu Sep  1 07:42:44 2011
New Revision: 1163926

URL: http://svn.apache.org/viewvc?rev=1163926&view=rev
Log:
[KARAF-839] Fix NPE raised when pinging an unexisting node.

Modified:
    karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java
    karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java
    karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
    karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/PingCommand.java
    karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java

Modified: karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java?rev=1163926&r1=1163925&r2=1163926&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/ListCommand.java
Thu Sep  1 07:42:44 2011
@@ -41,12 +41,12 @@ public class ListCommand extends ConfigC
             Map<String, Properties> configurationTable = clusterManager.getMap(Constants.CONFIGURATION_MAP
+ Configurations.SEPARATOR + groupName);
 
             if (configurationTable != null && !configurationTable.isEmpty()) {
-                System.out.println(String.format("PIDs for group:" + groupName));
+                System.out.println(String.format("PIDs for group " + groupName));
                 System.out.println(String.format(OUTPUT_FORMAT, "PID"));
                 for (String pid : configurationTable.keySet()) {
                     System.out.println(String.format(OUTPUT_FORMAT, pid));
                 }
-            } else System.err.println("No PIDs found for group:" + groupName);
+            } else System.err.println("No PIDs found for group " + groupName);
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);
 

Modified: karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java?rev=1163926&r1=1163925&r2=1163926&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropListCommand.java
Thu Sep  1 07:42:44 2011
@@ -45,7 +45,7 @@ public class PropListCommand extends Cel
             Map<String, Properties> configurationTable = clusterManager.getMap(Constants.CONFIGURATION_MAP
+ Configurations.SEPARATOR + groupName);
 
             if (configurationTable != null && !configurationTable.isEmpty()) {
-                System.out.println(String.format("Property list for PID:" + pid + " for group:"
+ groupName));
+                System.out.println(String.format("Property list for PID " + pid + " for group
" + groupName));
                 System.out.println(String.format(OUTPUT_FORMAT, "Key", "Value"));
                 Properties properties = configurationTable.get(pid);
                 if (properties != null && !properties.isEmpty())
@@ -53,7 +53,7 @@ public class PropListCommand extends Cel
                         String value = properties.getProperty((String) key);
                         System.out.println(String.format(OUTPUT_FORMAT, key, value));
                     }
-            } else System.err.print("No PIDs found for group:" + groupName);
+            } else System.err.print("No PIDs found for group " + groupName);
         } finally {
             Thread.currentThread().setContextClassLoader(originalClassLoader);
 

Modified: karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java?rev=1163926&r1=1163925&r2=1163926&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/config/src/main/java/org/apache/karaf/cellar/config/shell/PropSetCommand.java
Thu Sep  1 07:42:44 2011
@@ -43,12 +43,16 @@ public class PropSetCommand extends Conf
     @Override
     protected Object doExecute() throws Exception {
         Map<String, Properties> configurationTable = clusterManager.getMap(Constants.CONFIGURATION_MAP
+ Configurations.SEPARATOR + groupName);
-        Properties properties = configurationTable.get(pid);
-        if (properties == null) {
-            properties = new Properties();
+        if (configurationTable != null) {
+            Properties properties = configurationTable.get(pid);
+            if (properties == null) {
+                properties = new Properties();
+            }
+            properties.put(key, value);
+            configurationTable.put(pid, properties);
+        } else {
+            System.out.println("Group " + groupName + " doesn't exist.");
         }
-        properties.put(key, value);
-        configurationTable.put(pid, properties);
         return null;
     }
 

Modified: karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/PingCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/PingCommand.java?rev=1163926&r1=1163925&r2=1163926&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/PingCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/PingCommand.java
Thu Sep  1 07:42:44 2011
@@ -39,7 +39,11 @@ public class PingCommand extends Cluster
     @Override
     protected Object doExecute() throws Exception {
         Node node = clusterManager.findNodeById(nodeId);
-        System.out.println("Pinging node :" + node.getId());
+        if (node == null) {
+            System.out.println("Node " + nodeId + " doesn't exist.");
+            return null;
+        }
+        System.out.println("Pinging node " + node.getId());
         for (int i = 1; i <= iterations; i++) {
             Long start = System.currentTimeMillis();
             Ping ping = new Ping(clusterManager.generateId());

Modified: karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java?rev=1163926&r1=1163925&r2=1163926&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java
(original)
+++ karaf/cellar/branches/cellar-2.2.x/shell/src/main/java/org/apache/karaf/cellar/shell/group/GroupDeleteCommand.java
Thu Sep  1 07:42:44 2011
@@ -43,6 +43,10 @@ public class GroupDeleteCommand extends 
         try {
             Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
             Group g = groupManager.findGroupByName(group);
+            if (g == null) {
+                System.out.println("Group " + group + " doesn't exist.");
+                return null;
+            }
             List<String> nodes = new LinkedList<String>();
 
             if (g.getMembers() != null && !g.getMembers().isEmpty()) {



Mime
View raw message