incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject git commit: AMBARI-3110. NullPointerException when trying to access a service that does not exist (dlysnichenko)
Date Thu, 05 Sep 2013 15:29:54 GMT
Updated Branches:
  refs/heads/trunk f8e59976d -> 9496abdd2


AMBARI-3110. NullPointerException when trying to access a service that does not exist (dlysnichenko)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/9496abdd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/9496abdd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/9496abdd

Branch: refs/heads/trunk
Commit: 9496abdd25f5c93afd9d866d4f1626d6c547d2c2
Parents: f8e5997
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Sep 5 18:26:22 2013 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Sep 5 18:29:35 2013 +0300

----------------------------------------------------------------------
 .../ambari/server/api/services/AmbariMetaInfo.java      | 12 ++++++++----
 .../ambari/server/api/services/AmbariMetaInfoTest.java  |  2 +-
 .../controller/AmbariManagementControllerTest.java      |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/9496abdd/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index bce5e92..d1de2a2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -275,8 +275,10 @@ public class AmbariMetaInfo {
   public boolean isSupportedStack(String stackName, String version) throws AmbariException
{
     boolean exist = false;
     try {
-      getStackInfo(stackName, version);
-      exist = true;
+      StackInfo stackInfo = getStackInfo(stackName, version);
+      if (stackInfo != null) {
+        exist = true;
+      }
     } catch (ObjectNotFoundException e) {
     }
     return exist;
@@ -290,8 +292,10 @@ public class AmbariMetaInfo {
 
     boolean exist = false;
     try {
-      getServiceInfo(stackName, version, serviceName);
-      exist = true;
+      ServiceInfo info= getServiceInfo(stackName, version, serviceName);
+      if (info != null) {
+        exist = true;
+      }
     } catch (ObjectNotFoundException e) {
     }
     return exist;

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/9496abdd/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index be1f006..56d24d3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -134,7 +134,7 @@ public class AmbariMetaInfoTest {
         SERVICE_NAME_HDFS);
     assertTrue(valid);
 
-    boolean invalid = metaInfo.isValidService(STACK_NAME_HDP, NON_EXT_VALUE, NON_EXT_VALUE);
+    boolean invalid = metaInfo.isValidService(STACK_NAME_HDP, STACK_VERSION_HDP, NON_EXT_VALUE);
     assertFalse(invalid);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/9496abdd/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index b0e9801..7a63a85 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -606,7 +606,7 @@ public class AmbariManagementControllerTest {
     controller.createServices(set1);
 
     try {
-      valid1 = new ServiceRequest("foo", "bar", null, null);
+      valid1 = new ServiceRequest("foo", "PIG", null, null);
       valid2 = new ServiceRequest("foo", "MAPREDUCE", null, null);
       set1.add(valid1);
       set1.add(valid2);


Mime
View raw message