Temporary patch around unavailable username during websocket failover.

Change-Id: I38f98816e2e9022d07aad49e1184faa2c2174428
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocketServlet.java b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocketServlet.java
index 669bc98..0ca3b05 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocketServlet.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocketServlet.java
@@ -23,6 +23,7 @@
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
+import java.security.Principal;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -72,7 +73,9 @@
         }
 
         // FIXME: Replace this with globally shared opaque token to allow secure failover
-        String userName = request.getUserPrincipal().getName();
+        Principal p = request.getUserPrincipal();
+        String userName = p != null ? p.getName() : FAKE_USERNAME;
+
         UiWebSocket socket = new UiWebSocket(directory, userName);
         synchronized (sockets) {
             sockets.add(socket);
@@ -80,6 +83,9 @@
         return socket;
     }
 
+    // FIXME: This should not be necessary
+    private static final String FAKE_USERNAME = "UI-user";
+
     /**
      * Sends the specified message to all the GUI clients.
      *