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

madhan pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 4edaf7e8bf942c7552718302881f7e3e4f7ccad3
Author: Radhika Kundam <82411560+rkun...@users.noreply.github.com>
AuthorDate: Wed Jul 16 09:51:21 2025 -0700

    ATLAS-5070: Startup failure due to NPE in IndexRecoveryService when 
atlas.index.recovery.start.time is unset (#400)
    
    (cherry picked from commit 66a8e531380affda6ce84fd0eff26e158c2e26a1)
---
 .../apache/atlas/repository/graph/IndexRecoveryService.java  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/repository/src/main/java/org/apache/atlas/repository/graph/IndexRecoveryService.java
 
b/repository/src/main/java/org/apache/atlas/repository/graph/IndexRecoveryService.java
index d59935511..277143336 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/graph/IndexRecoveryService.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/graph/IndexRecoveryService.java
@@ -28,6 +28,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraphQuery;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.service.Service;
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.math.NumberUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -132,12 +133,13 @@ public class IndexRecoveryService implements Service, 
ActiveStateChangeHandler {
         long ret = 0L;
 
         try {
-            String           time       = 
config.getString(SOLR_INDEX_RECOVERY_CONFIGURED_START_TIME);
-            SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
+            String time = 
config.getString(SOLR_INDEX_RECOVERY_CONFIGURED_START_TIME);
+            if (StringUtils.isNotBlank(time)) {
+                SimpleDateFormat dateFormat = new 
SimpleDateFormat(DATE_FORMAT);
+                dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
 
-            dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
-
-            ret = dateFormat.parse(time).toInstant().toEpochMilli();
+                ret = dateFormat.parse(time).toInstant().toEpochMilli();
+            }
         } catch (Exception e) {
             LOG.error("Error fetching: {}", 
SOLR_INDEX_RECOVERY_CONFIGURED_START_TIME, e);
         }

Reply via email to