This is an automated email from the ASF dual-hosted git repository.

ncole pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 2bc4779  [AMBARI-25197] NullPointerException if there is no proper 
HDP/HDF rep… (#2873)
2bc4779 is described below

commit 2bc4779a1e6aabe638101fc8b0e28cd1963d6b13
Author: amarnathreddy pappu <[email protected]>
AuthorDate: Wed Mar 20 05:42:22 2019 -0700

    [AMBARI-25197] NullPointerException if there is no proper HDP/HDF rep… 
(#2873)
---
 .../server/stack/UpdateActiveRepoVersionOnStartup.java      | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/UpdateActiveRepoVersionOnStartup.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/UpdateActiveRepoVersionOnStartup.java
index 6ba1f94..7af2c93 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/UpdateActiveRepoVersionOnStartup.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/UpdateActiveRepoVersionOnStartup.java
@@ -88,10 +88,15 @@ public class UpdateActiveRepoVersionOnStartup {
 
           StackId stackId = repositoryVersion.getStackId();
           StackInfo stack = stackManager.getStack(stackId.getStackName(), 
stackId.getStackVersion());
-
-          if (updateRepoVersion(stack, repositoryVersion)) {
-            repositoryVersionDao.merge(repositoryVersion);
-          }
+        
+          if (stack !=null) {
+            if (updateRepoVersion(stack, repositoryVersion)) {
+              repositoryVersionDao.merge(repositoryVersion);
+            }
+          } else {
+           throw new AmbariException(String.format("Stack %s %s was not found 
on the file system. In the event that it was removed, " +
+              "please ensure that it exists before starting Ambari Server.",  
stackId.getStackName(), stackId.getStackVersion()));
+          } 
         }
       }
     }

Reply via email to