Adding an error trap for the web-socket onClose handler.
Change-Id: I9d286ea8f929ac71f7e55e46cb1873ffda40838d
(cherry picked from commit c7e009a526e44d47cd60a2d858d696efcaa69af1)
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
index 07a0b0d..ea7e5ed 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
@@ -218,15 +218,19 @@
@Override
public synchronized void onClose(int closeCode, String message) {
try {
- tokenService().revokeToken(sessionToken);
- log.info("Session token revoked");
- } catch (ServiceNotFoundException e) {
- log.error("Unable to reference UiTokenService");
- }
- sessionToken = null;
+ try {
+ tokenService().revokeToken(sessionToken);
+ log.info("Session token revoked");
+ } catch (ServiceNotFoundException e) {
+ log.error("Unable to reference UiTokenService");
+ }
+ sessionToken = null;
- topoSession.destroy();
- destroyHandlersAndOverlays();
+ topoSession.destroy();
+ destroyHandlersAndOverlays();
+ } catch (Exception e) {
+ log.warn("Unexpected error", e);
+ }
log.info("GUI client disconnected [close-code={}, message={}]",
closeCode, message);
}