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

rlevas pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 009bd76  [AMBARI-25197] NullPointerException if there is no proper 
HDP/HDF repo version folder
009bd76 is described below

commit 009bd76df27cf411d06940e6618dedc5a9e14866
Author: amarnathreddy pappu <apa...@hortonworks.com>
AuthorDate: Thu Mar 21 14:51:19 2019 -0700

    [AMBARI-25197] NullPointerException if there is no proper HDP/HDF repo 
version folder
    
    * [AMBARI-25197] NullPointerException if there is no proper HDP/HDF repo 
version folder (apappu)
    
    * [AMBARI-25197] NullPointerException if there is no proper HDP/HDF repo 
version folder (apappu)
    
    * [AMBARI-25197] NullPointerException if there is no proper HDP/HDF repo 
version folder (apappu)
    
    * [AMBARI-25197] NullPointerException if there is no proper HDP/HDF repo 
version folder (apappu)
---
 .../ambari/server/stack/UpdateActiveRepoVersionOnStartup.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 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 23c79d8..3477d6d 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
@@ -89,8 +89,13 @@ 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