Add NotNull and Argument check during object build for LISP object
Also correct IP enumeration type into IP4.
Change-Id: Id970ee608c885826cfd2de7b5448b2bc451e079f
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
index b6ed216..e0d1490 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
@@ -175,9 +175,9 @@
private long nonce;
private short keyId;
private short authDataLength;
- private byte[] authenticationData;
+ private byte[] authenticationData = new byte[0];
private byte recordCount;
- private List<LispMapRecord> mapRecords;
+ private List<LispMapRecord> mapRecords = Lists.newArrayList();
private boolean proxyMapReply;
private boolean wantMapNotify;
@@ -226,8 +226,6 @@
public RegisterBuilder withAuthenticationData(byte[] authenticationData) {
if (authenticationData != null) {
this.authenticationData = authenticationData;
- } else {
- this.authenticationData = new byte[0];
}
return this;
}
@@ -236,22 +234,12 @@
public RegisterBuilder withMapRecords(List<LispMapRecord> mapRecords) {
if (mapRecords != null) {
this.mapRecords = ImmutableList.copyOf(mapRecords);
- } else {
- this.mapRecords = Lists.newArrayList();
}
return this;
}
@Override
public LispMapRegister build() {
- if (authenticationData == null) {
- authenticationData = new byte[0];
- }
-
- if (mapRecords == null) {
- mapRecords = Lists.newArrayList();
- }
-
return new DefaultLispMapRegister(nonce, keyId, authDataLength,
authenticationData, recordCount, mapRecords, proxyMapReply, wantMapNotify);
}