From 58edbf016ccd12678c77cb239b41b1350d331412 Mon Sep 17 00:00:00 2001 From: Chandra Shekar S Date: Thu, 9 Jan 2020 16:00:23 +0530 Subject: [PATCH] Fix NPE in SouthboundUtils JIRA: OVSDB-492 Add the null check to avoid the SouthboundUtils.compareDbVersionToMinVersion() throwing the NPE. By any chance if the method is getting triggered with one of the parameter as null, throws the NPE. Signed-off-by: Chandra Shekar S Change-Id: Ibd29fe283fec7376baec56c0fbbb35529e157dbb --- .../ovsdb/utils/southbound/utils/SouthboundUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java b/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java index e766b9d59..a85f3faf1 100644 --- a/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java +++ b/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java @@ -1345,6 +1345,10 @@ public class SouthboundUtils { } public static boolean compareDbVersionToMinVersion(final String dbVersion, final String minVersion) { + if (dbVersion == null || minVersion == null) { + LOG.error("Invalid DB version {} or minVersion {}", dbVersion, minVersion); + return false; + } final Matcher dbVersionMatcher = PATTERN.matcher(dbVersion); final Matcher minVersionMatcher = PATTERN.matcher(minVersion); LOG.debug("dbVersion {}, minVersion {}", dbVersion, minVersion); -- 2.36.6