Merge "Fix container authorization - front end"
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / packet / IPv4.java
index c7b97e9d483370d536559f2618507c3cc0279673..7a7a5a757fb4ab4ff7184da84a25662f42729e07 100644 (file)
@@ -378,9 +378,9 @@ public class IPv4 extends Packet {
      * @param checksum the checksum to set
      */
     /*public IPv4 setChecksum() {
-       short ipChecksum = computeChecksum();
+        short ipChecksum = computeChecksum();
         byte[] checksum = BitBufferHelper.toByteArray(ipChecksum);
-       fieldValues.put(CHECKSUM, checksum);
+        fieldValues.put(CHECKSUM, checksum);
         return this;
     }*/
 
@@ -444,7 +444,7 @@ public class IPv4 extends Packet {
     /**
      * Computes the IPv4 header checksum on the passed stream of bytes
      * representing the packet
-     * 
+     *
      * @param data
      *            The byte stream
      * @param offset
@@ -542,10 +542,12 @@ public class IPv4 extends Packet {
          * Deriving the Total Length here
          */
         int payloadLength = 0;
-        try {
-            payloadLength = payload.serialize().length;
-        } catch (PacketException e) {
-            logger.error("", e);
+        if (payload != null) {
+            try {
+                payloadLength = payload.serialize().length;
+            } catch (PacketException e) {
+                logger.error("", e);
+            }
         }
 
         this.setTotalLength((short) (this.getHeaderLen() + payloadLength));