Fix: resolve potential NPE in LispInfo request and reply

Change-Id: Iab01f0d2c947e918d5c131a7e416582f9fad9496
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispInfoReply.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispInfoReply.java
index ff34776..fd22fa8 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispInfoReply.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispInfoReply.java
@@ -63,7 +63,7 @@
      * @param eidPrefix      EID prefix
      * @param natLcafAddress NAT LCAF address
      */
-    protected DefaultLispInfoReply(boolean infoReply, long nonce, short keyId, short authDataLength,
+    DefaultLispInfoReply(boolean infoReply, long nonce, short keyId, short authDataLength,
                                    byte[] authData, int ttl, byte maskLength,
                                    LispAfiAddress eidPrefix, LispNatLcafAddress natLcafAddress) {
         super(infoReply, nonce, keyId, authDataLength, authData, ttl, maskLength, eidPrefix);
@@ -249,16 +249,19 @@
             LispNatLcafAddress natLcafAddress = (LispNatLcafAddress)
                     new LcafAddressReader().readFrom(byteBuf);
 
-            return new DefaultInfoReplyBuilder()
-                    .withIsInfoReply(lispInfo.isInfoReply())
-                    .withNonce(lispInfo.getNonce())
-                    .withKeyId(lispInfo.getKeyId())
-                    .withAuthDataLength(lispInfo.getAuthDataLength())
-                    .withAuthData(lispInfo.getAuthData())
-                    .withTtl(lispInfo.getTtl())
-                    .withMaskLength(lispInfo.getMaskLength())
-                    .withEidPrefix(lispInfo.getPrefix())
-                    .withNatLcafAddress(natLcafAddress).build();
+            if (lispInfo != null) {
+                return new DefaultInfoReplyBuilder()
+                        .withIsInfoReply(lispInfo.isInfoReply())
+                        .withNonce(lispInfo.getNonce())
+                        .withKeyId(lispInfo.getKeyId())
+                        .withAuthDataLength(lispInfo.getAuthDataLength())
+                        .withAuthData(lispInfo.getAuthData())
+                        .withTtl(lispInfo.getTtl())
+                        .withMaskLength(lispInfo.getMaskLength())
+                        .withEidPrefix(lispInfo.getPrefix())
+                        .withNatLcafAddress(natLcafAddress).build();
+            }
+            return null;
         }
     }
 
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispInfoRequest.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispInfoRequest.java
index 1a29579..19815e9 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispInfoRequest.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispInfoRequest.java
@@ -60,10 +60,10 @@
      * @param maskLength     EID prefix mask length
      * @param eidPrefix      EID prefix
      */
-    protected DefaultLispInfoRequest(boolean infoReply, long nonce, short keyId,
-                                     short authDataLength, byte[] authData,
-                                     int ttl, byte maskLength,
-                                     LispAfiAddress eidPrefix) {
+    DefaultLispInfoRequest(boolean infoReply, long nonce, short keyId,
+                                    short authDataLength, byte[] authData,
+                                    int ttl, byte maskLength,
+                                    LispAfiAddress eidPrefix) {
 
         super(infoReply, nonce, keyId, authDataLength, authData, ttl,
               maskLength, eidPrefix);
@@ -239,15 +239,19 @@
 
             LispInfo lispInfo = deserialize(byteBuf);
 
-            return new DefaultInfoRequestBuilder()
-                    .withIsInfoReply(lispInfo.isInfoReply())
-                    .withNonce(lispInfo.getNonce())
-                    .withKeyId(lispInfo.getKeyId())
-                    .withAuthDataLength(lispInfo.getAuthDataLength())
-                    .withAuthData(lispInfo.getAuthData())
-                    .withTtl(lispInfo.getTtl())
-                    .withMaskLength(lispInfo.getMaskLength())
-                    .withEidPrefix(lispInfo.getPrefix()).build();
+            if (lispInfo != null) {
+                return new DefaultInfoRequestBuilder()
+                        .withIsInfoReply(lispInfo.isInfoReply())
+                        .withNonce(lispInfo.getNonce())
+                        .withKeyId(lispInfo.getKeyId())
+                        .withAuthDataLength(lispInfo.getAuthDataLength())
+                        .withAuthData(lispInfo.getAuthData())
+                        .withTtl(lispInfo.getTtl())
+                        .withMaskLength(lispInfo.getMaskLength())
+                        .withEidPrefix(lispInfo.getPrefix()).build();
+            }
+
+            return null;
         }
     }