Merge "Increase timeout for waiting for broker service in sal-binding-it."
[controller.git] / opendaylight / protocol_plugins / openflow / src / main / java / org / opendaylight / controller / protocol_plugin / openflow / core / internal / SwitchHandler.java
index ed79d5c5a8f88a585dac9363478e6870bc77889c..7a177fa078c8607e41bb2fa62f9ea6c2c8b7d032 100644 (file)
@@ -61,6 +61,7 @@ import org.openflow.util.HexString;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 public class SwitchHandler implements ISwitch {
     private static final Logger logger = LoggerFactory.getLogger(SwitchHandler.class);
     private static final int SWITCH_LIVENESS_TIMER = 5000;
@@ -373,10 +374,12 @@ public class SwitchHandler implements ISwitch {
             case ECHO_REQUEST:
                 OFEchoReply echoReply = (OFEchoReply) factory.getMessage(OFType.ECHO_REPLY);
 
-                // the EchoReply must have the same payload as the request
                 byte []payload = ((OFEchoRequest)msg).getPayload();
-                echoReply.setPayload(payload);
-                echoReply.setLength( (short) (echoReply.getLength() + payload.length ));
+                if (payload != null && payload.length != 0 ) {
+                    // the response must have the same payload as the request
+                    echoReply.setPayload(payload);
+                    echoReply.setLength( (short)(echoReply.getLength() + payload.length) );
+                }
 
                 // respond immediately
                 asyncSendNow(echoReply, msg.getXid());