[VOL-2587] Fixed NullPointerException for PORT_REMOVED event when ONU is deleted
Change-Id: Ie499fc39494e52d9150cc665c76d1dae61facb17
diff --git a/app/src/main/java/org/opencord/aaa/impl/AaaManager.java b/app/src/main/java/org/opencord/aaa/impl/AaaManager.java
index c2e62eb..79fc22c 100644
--- a/app/src/main/java/org/opencord/aaa/impl/AaaManager.java
+++ b/app/src/main/java/org/opencord/aaa/impl/AaaManager.java
@@ -1101,10 +1101,14 @@
private void flushStateMachineSession(String sessionId, String terminationReason) {
StateMachine stateMachine = stateMachines.get(sessionId);
- if (stateMachine != null) {
- stateMachine.setSessionTerminateReason(terminationReason);
+ if (stateMachine == null) {
+ // No active AAA sessions for this UNI port
+ log.debug("No Active AAA Session found with Id {}", sessionId);
+ return;
}
+ stateMachine.setSessionTerminateReason(terminationReason);
+
//pushing captured machine stats to kafka
AaaSupplicantMachineStats obj = aaaSupplicantStatsManager.getSupplicantStats(stateMachine);
aaaSupplicantStatsManager.getMachineStatsDelegate()