ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hit...@apache.org
Subject svn commit: r1396452 - in /incubator/ambari/branches/AMBARI-666: ./ ambari-server/src/main/java/org/apache/ambari/server/controller/
Date Wed, 10 Oct 2012 02:44:34 GMT
Author: hitesh
Date: Wed Oct 10 02:44:34 2012
New Revision: 1396452

URL: http://svn.apache.org/viewvc?rev=1396452&view=rev
Log:
AMBARI-843. Fix more null pointers for partial request objects. (hitesh)

Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
    incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1396452&r1=1396451&r2=1396452&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Wed Oct 10 02:44:34 2012
@@ -227,6 +227,8 @@ AMBARI-666 branch (unreleased changes)
 
   BUG FIXES
 
+  AMBARI-843. Fix more null pointers for partial request objects. (hitesh)
+
   AMBARI-842. Fix null point exception during adding of hosts to cluster. (hitesh)
 
   AMBARI-839. Temporary fix for server start order. (hitesh)

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java?rev=1396452&r1=1396451&r2=1396452&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
Wed Oct 10 02:44:34 2012
@@ -263,12 +263,16 @@ public class AmbariManagementControllerI
 
     clusters.addHost(request.getHostname());
 
-    for (String clusterName : request.getClusterNames()) {
-      clusters.mapHostToCluster(request.getHostname(), clusterName);
+    if (request.getClusterNames() != null) {
+      for (String clusterName : request.getClusterNames()) {
+        clusters.mapHostToCluster(request.getHostname(), clusterName);
+      }
     }
 
-    h = clusters.getHost(request.getHostname());
-    h.setHostAttributes(request.getHostAttributes());
+    if (request.getHostAttributes() != null) {
+      h = clusters.getHost(request.getHostname());
+      h.setHostAttributes(request.getHostAttributes());
+    }
 
     // TODO
     return null;

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java?rev=1396452&r1=1396451&r2=1396452&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterRequest.java
Wed Oct 10 02:44:34 2012
@@ -94,8 +94,6 @@ public class ClusterRequest {
 
   public String toString() {
     StringBuilder sb = new StringBuilder();
-
-
     sb.append("{"
         + " clusterName=" + clusterName
         + ", clusterId=" + clusterId

Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java?rev=1396452&r1=1396451&r2=1396452&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java
(original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java
Wed Oct 10 02:44:34 2012
@@ -62,24 +62,29 @@ public class HostRequest {
   }
 
   public String toString() {
+    // FIXME check if clusters and host attrs is non null before printing
     StringBuilder sb = new StringBuilder();
     sb.append("{"
         + ", hostname=" + hostname
         + ", clusterNames=[");
-    for (int i = 0; i < clusterNames.size(); ++i) {
-      if (i != 0) {
-        sb.append(",");
+    if (clusterNames != null) {
+      for (int i = 0; i < clusterNames.size(); ++i) {
+        if (i != 0) {
+          sb.append(",");
+        }
+        sb.append(clusterNames.get(i));
       }
-      sb.append(clusterNames.get(i));
     }
-    sb.append("], hostAttributes=[");
-    int i = 0;
-    for (Entry<String, String> attr : hostAttributes.entrySet()) {
-      if (i != 0) {
-        sb.append(",");
+    if (hostAttributes != null) {
+      sb.append("], hostAttributes=[");
+      int i = 0;
+      for (Entry<String, String> attr : hostAttributes.entrySet()) {
+        if (i != 0) {
+          sb.append(",");
+        }
+        ++i;
+        sb.append(attr.getKey() + "=" + attr.getValue());
       }
-      ++i;
-      sb.append(attr.getKey() + "=" + attr.getValue());
     }
     sb.append("] }");
     return sb.toString();



Mime
View raw message