Replace redundant instanceof with non-null check
Change-Id: Ib86b0c8561824b1753b299f680d7d336205dd9a4
diff --git a/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepInitiateMsgVer1.java b/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepInitiateMsgVer1.java
index 60d4af9..5b47f53 100644
--- a/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepInitiateMsgVer1.java
+++ b/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepInitiateMsgVer1.java
@@ -252,7 +252,7 @@
//Srp Object is mandatory
PcepSrpObject srpObj = listReq.getSrpObject();
- if (srpObj instanceof PcepSrpObject) {
+ if (srpObj != null) {
isDelLspRequest = srpObj.getRFlag();
srpObj.write(cb);
} else {
@@ -261,7 +261,7 @@
//LSP Object is mandatory
PcepLspObject lspObj = listReq.getLspObject();
- if (lspObj instanceof PcepLspObject) {
+ if (lspObj != null) {
lspObj.write(cb);
} else {
throw new PcepParseException("LSP Object is mandatory for PcInitiate message.");
@@ -275,7 +275,7 @@
//EndPoints object is mandatory
PcepEndPointsObject endPointObj = listReq.getEndPointsObject();
- if (endPointObj instanceof PcepEndPointsObject) {
+ if (endPointObj != null) {
endPointObj.write(cb);
} else {
throw new PcepParseException("End points Object is mandatory for PcInitiate message.");
@@ -283,7 +283,7 @@
//Ero object is mandatory
PcepEroObject eroObj = listReq.getEroObject();
- if (eroObj instanceof PcepEroObject) {
+ if (eroObj != null) {
eroObj.write(cb);
} else {
throw new PcepParseException("ERO Object is mandatory for PcInitiate message.");
@@ -291,7 +291,7 @@
//PcepAttribute is optional
PcepAttribute pcepAttribute = listReq.getPcepAttribute();
- if (pcepAttribute instanceof PcepAttribute) {
+ if (pcepAttribute != null) {
pcepAttribute.write(cb);
}
}