mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-11-06 19:22:07 +01:00
Fix error when remove non-numeric key intent from UI
Change-Id: I74f164c9389ca6900058468cc21eb0b8b743a8f0
This commit is contained in:
parent
bc30e68753
commit
3a9b01cf8d
@ -431,15 +431,36 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Intent findIntentByPayload(ObjectNode payload) {
|
private Intent findIntentByPayload(ObjectNode payload) {
|
||||||
|
Intent intent;
|
||||||
|
Key key;
|
||||||
int appId = Integer.parseInt(string(payload, APP_ID));
|
int appId = Integer.parseInt(string(payload, APP_ID));
|
||||||
String appName = string(payload, APP_NAME);
|
String appName = string(payload, APP_NAME);
|
||||||
ApplicationId applicId = new DefaultApplicationId(appId, appName);
|
ApplicationId applicId = new DefaultApplicationId(appId, appName);
|
||||||
long intentKey = Long.decode(string(payload, KEY));
|
String stringKey = string(payload, KEY);
|
||||||
|
try {
|
||||||
|
// FIXME: If apps use different string key, but they contains
|
||||||
|
// same numeric value (e.g. "020", "0x10", "16", "#10")
|
||||||
|
// and one intent using long key (e.g. 16L)
|
||||||
|
// this function might return wrong intent.
|
||||||
|
|
||||||
|
long longKey = Long.decode(stringKey);
|
||||||
|
key = Key.of(longKey, applicId);
|
||||||
|
intent = intentService.getIntent(key);
|
||||||
|
|
||||||
|
if (intent == null) {
|
||||||
|
// Intent might using string key, not long key
|
||||||
|
key = Key.of(stringKey, applicId);
|
||||||
|
intent = intentService.getIntent(key);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
// string key
|
||||||
|
key = Key.of(stringKey, applicId);
|
||||||
|
intent = intentService.getIntent(key);
|
||||||
|
}
|
||||||
|
|
||||||
Key key = Key.of(intentKey, applicId);
|
|
||||||
log.debug("Attempting to select intent by key={}", key);
|
log.debug("Attempting to select intent by key={}", key);
|
||||||
|
|
||||||
return intentService.getIntent(key);
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class RemoveIntent extends RequestHandler {
|
private final class RemoveIntent extends RequestHandler {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user