Committed by
Jonathan Hart
Fix DefaultOvsdbClient Class's getBridges's improper return value
When tableStore or rowStore is null, getBridges() should not return (null), that will cause NullPointerException in its two usages: (getBRidges only has these two usages now, but it is very foundational.) 1. OvsdbBridgeConfig.java, line 113-115: Set<OvsdbBridge> bridges = client.getBridges(); return bridges.stream()...... 2. OvsdbControllerConfig.java, line 92: .filter(cs -> cs.getBridges().stream() .anyMatch(b -> dpidMatches(b, ofDeviceId))) ...... Change-Id: Ice14a8991f5022a5041cf48f5c8431712f946228
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -923,11 +923,11 @@ public class DefaultOvsdbClient implements OvsdbProviderService, OvsdbClientServ | ... | @@ -923,11 +923,11 @@ public class DefaultOvsdbClient implements OvsdbProviderService, OvsdbClientServ |
923 | Set<OvsdbBridge> ovsdbBridges = new HashSet<>(); | 923 | Set<OvsdbBridge> ovsdbBridges = new HashSet<>(); |
924 | OvsdbTableStore tableStore = getTableStore(DATABASENAME); | 924 | OvsdbTableStore tableStore = getTableStore(DATABASENAME); |
925 | if (tableStore == null) { | 925 | if (tableStore == null) { |
926 | - return null; | 926 | + return ovsdbBridges; |
927 | } | 927 | } |
928 | OvsdbRowStore rowStore = tableStore.getRows(BRIDGE); | 928 | OvsdbRowStore rowStore = tableStore.getRows(BRIDGE); |
929 | if (rowStore == null) { | 929 | if (rowStore == null) { |
930 | - return null; | 930 | + return ovsdbBridges; |
931 | } | 931 | } |
932 | ConcurrentMap<String, Row> rows = rowStore.getRowStore(); | 932 | ConcurrentMap<String, Row> rows = rowStore.getRowStore(); |
933 | for (String uuid : rows.keySet()) { | 933 | for (String uuid : rows.keySet()) { | ... | ... |
-
Please register or login to post a comment