Fixed deprecated pkt deserialize method in TorInterpreter
Change-Id: I9a3ad9655f6660f1c0f21d4ee789260953147d36
diff --git a/apps/pi-demo/tor/src/main/java/org/onosproject/pi/demo/app/tor/TorInterpreter.java b/apps/pi-demo/tor/src/main/java/org/onosproject/pi/demo/app/tor/TorInterpreter.java
index 6bf4f77..ddf7049 100644
--- a/apps/pi-demo/tor/src/main/java/org/onosproject/pi/demo/app/tor/TorInterpreter.java
+++ b/apps/pi-demo/tor/src/main/java/org/onosproject/pi/demo/app/tor/TorInterpreter.java
@@ -18,6 +18,7 @@
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableList;
+import org.onlab.packet.DeserializationException;
import org.onlab.packet.Ethernet;
import org.onlab.util.ImmutableByteSequence;
import org.onosproject.net.ConnectPoint;
@@ -198,9 +199,13 @@
}
// FIXME Assuming that the packet is ethernet. is it fine ? tor.p4 can deparse also other packets.
- Ethernet ethPkt = new Ethernet();
-
- ethPkt.deserialize(packetIn.data().asArray(), 0, packetIn.data().size());
+ Ethernet ethPkt = null;
+ try {
+ ethPkt = Ethernet.deserializer()
+ .deserialize(packetIn.data().asArray(), 0, packetIn.data().size());
+ } catch (DeserializationException e) {
+ throw new PiInterpreterException(format("Unable to deserialize packet-in: %s", e.getMessage()));
+ }
// Returns the ingress port packet metadata.
Optional<PiPacketMetadata> packetMetadata = packetIn.metadatas()