Pavlin Radoslavov

Fix for bug ONOS-330:

Add missing "null" checks for IntentService.getIntentState()

Change-Id: Idd574227636f6cdd3a0dbae4c753ada6157e04e1
...@@ -126,7 +126,8 @@ public class IntentSynchronizer { ...@@ -126,7 +126,8 @@ public class IntentSynchronizer {
126 // Skip the intents that are already withdrawn 126 // Skip the intents that are already withdrawn
127 IntentState intentState = 127 IntentState intentState =
128 intentService.getIntentState(intent.id()); 128 intentService.getIntentState(intent.id());
129 - if (intentState.equals(IntentState.WITHDRAWING) || 129 + if ((intentState == null) ||
130 + intentState.equals(IntentState.WITHDRAWING) ||
130 intentState.equals(IntentState.WITHDRAWN)) { 131 intentState.equals(IntentState.WITHDRAWN)) {
131 continue; 132 continue;
132 } 133 }
...@@ -461,7 +462,8 @@ public class IntentSynchronizer { ...@@ -461,7 +462,8 @@ public class IntentSynchronizer {
461 462
462 IntentState state = 463 IntentState state =
463 intentService.getIntentState(fetchedIntent.id()); 464 intentService.getIntentState(fetchedIntent.id());
464 - if (state == IntentState.WITHDRAWING || 465 + if (state == null ||
466 + state == IntentState.WITHDRAWING ||
465 state == IntentState.WITHDRAWN) { 467 state == IntentState.WITHDRAWN) {
466 // The intent has been withdrawn but according to our route 468 // The intent has been withdrawn but according to our route
467 // table it should be installed. We'll reinstall it. 469 // table it should be installed. We'll reinstall it.
...@@ -482,7 +484,8 @@ public class IntentSynchronizer { ...@@ -482,7 +484,8 @@ public class IntentSynchronizer {
482 484
483 IntentState state = 485 IntentState state =
484 intentService.getIntentState(fetchedIntent.id()); 486 intentService.getIntentState(fetchedIntent.id());
485 - if (state == IntentState.WITHDRAWING || 487 + if (state == null ||
488 + state == IntentState.WITHDRAWING ||
486 state == IntentState.WITHDRAWN) { 489 state == IntentState.WITHDRAWN) {
487 // Nothing to do. The intent has been already withdrawn. 490 // Nothing to do. The intent has been already withdrawn.
488 continue; 491 continue;
......
...@@ -126,6 +126,9 @@ public class IntentsListCommand extends AbstractShellCommand { ...@@ -126,6 +126,9 @@ public class IntentsListCommand extends AbstractShellCommand {
126 // Collect the summary for each intent type intents 126 // Collect the summary for each intent type intents
127 for (Intent intent : intents) { 127 for (Intent intent : intents) {
128 IntentState intentState = service.getIntentState(intent.id()); 128 IntentState intentState = service.getIntentState(intent.id());
129 + if (intentState == null) {
130 + continue;
131 + }
129 132
130 // Update the summary for all Intents 133 // Update the summary for all Intents
131 summaryAll.update(intentState); 134 summaryAll.update(intentState);
......