Committed by
Gerrit Code Review
ONOS-3841 fix for deferred Subject issue
Change-Id: I0901757054b5263bca8ed5d4c38dc595529e3c45
Showing
1 changed file
with
10 additions
and
4 deletions
... | @@ -136,13 +136,19 @@ public class DistributedNetworkConfigStore | ... | @@ -136,13 +136,19 @@ public class DistributedNetworkConfigStore |
136 | 136 | ||
137 | @SuppressWarnings("unchecked") | 137 | @SuppressWarnings("unchecked") |
138 | private void validateConfig(ConfigKey key, ConfigFactory configFactory, JsonNode json) { | 138 | private void validateConfig(ConfigKey key, ConfigFactory configFactory, JsonNode json) { |
139 | - Config config = createConfig(key.subject, configFactory.configClass(), json); | 139 | + Object subject; |
140 | + if (key.subject instanceof String) { | ||
141 | + subject = configFactory.subjectFactory().createSubject((String) key.subject); | ||
142 | + } else { | ||
143 | + subject = key.subject; | ||
144 | + } | ||
145 | + Config config = createConfig(subject, configFactory.configClass(), json); | ||
140 | try { | 146 | try { |
141 | checkArgument(config.isValid(), INVALID_CONFIG_JSON); | 147 | checkArgument(config.isValid(), INVALID_CONFIG_JSON); |
142 | - configs.putAndGet(key(key.subject, configFactory.configClass()), json); | 148 | + configs.putAndGet(key(subject, configFactory.configClass()), json); |
143 | } catch (Exception e) { | 149 | } catch (Exception e) { |
144 | log.warn("Failed to validate pending {} configuration for {}: {}", | 150 | log.warn("Failed to validate pending {} configuration for {}: {}", |
145 | - key.configKey, configFactory.subjectFactory().subjectKey(key.subject), json); | 151 | + key.configKey, key.subject, json); |
146 | } | 152 | } |
147 | } | 153 | } |
148 | 154 | ||
... | @@ -156,7 +162,7 @@ public class DistributedNetworkConfigStore | ... | @@ -156,7 +162,7 @@ public class DistributedNetworkConfigStore |
156 | @Override | 162 | @Override |
157 | @SuppressWarnings("unchecked") | 163 | @SuppressWarnings("unchecked") |
158 | public <S, C extends Config<S>> ConfigFactory<S, C> getConfigFactory(Class<C> configClass) { | 164 | public <S, C extends Config<S>> ConfigFactory<S, C> getConfigFactory(Class<C> configClass) { |
159 | - return (ConfigFactory<S, C>) factoriesByConfig.get(configClass.getName()); | 165 | + return factoriesByConfig.get(configClass.getName()); |
160 | } | 166 | } |
161 | 167 | ||
162 | @Override | 168 | @Override | ... | ... |
-
Please register or login to post a comment