Skip to content

Commit af63d03

Browse files
RANGER-5398: Handle NullPointerException for lastGdsUpdateTime in Audit Plugin Status page
Signed-off-by: Dineshkumar Yadav <[email protected]>
1 parent 4fb3011 commit af63d03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

security-admin/src/main/java/org/apache/ranger/service/RangerPluginInfoService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ private Map<String, String> jsonStringToMap(String jsonStr, XXServiceVersionInfo
305305
Date lastGdsUpdateTime = xxServiceVersionInfo.getGdsUpdateTime();
306306

307307
ret.put(RangerPluginInfo.RANGER_ADMIN_LATEST_POLICY_VERSION, Long.toString(latestPolicyVersion));
308-
ret.put(RangerPluginInfo.RANGER_ADMIN_LAST_POLICY_UPDATE_TIME, Long.toString(lastPolicyUpdateTime.getTime()));
308+
ret.put(RangerPluginInfo.RANGER_ADMIN_LAST_POLICY_UPDATE_TIME, lastPolicyUpdateTime == null ? "" : Long.toString(lastPolicyUpdateTime.getTime()));
309309
ret.put(RangerPluginInfo.RANGER_ADMIN_LATEST_GDS_VERSION, Long.toString(latestGdsVersion));
310-
ret.put(RangerPluginInfo.RANGER_ADMIN_LAST_GDS_UPDATE_TIME, Long.toString(lastGdsUpdateTime.getTime()));
310+
ret.put(RangerPluginInfo.RANGER_ADMIN_LAST_GDS_UPDATE_TIME, lastGdsUpdateTime == null ? "" : Long.toString(lastGdsUpdateTime.getTime()));
311311

312312
if (hasAssociatedTagService) {
313313
ret.put(RangerPluginInfo.RANGER_ADMIN_LATEST_TAG_VERSION, Long.toString(latestTagVersion));
314-
ret.put(RangerPluginInfo.RANGER_ADMIN_LAST_TAG_UPDATE_TIME, Long.toString(lastTagUpdateTime.getTime()));
314+
ret.put(RangerPluginInfo.RANGER_ADMIN_LAST_TAG_UPDATE_TIME, lastTagUpdateTime == null ? "" : Long.toString(lastTagUpdateTime.getTime()));
315315
} else {
316316
ret.remove(RangerPluginInfo.RANGER_ADMIN_LATEST_TAG_VERSION);
317317
ret.remove(RangerPluginInfo.RANGER_ADMIN_LAST_TAG_UPDATE_TIME);

0 commit comments

Comments
 (0)