BUG-4862: catch ClassCastException 97/39097/1
authorRobert Varga <rovarga@cisco.com>
Wed, 27 Jan 2016 14:21:03 +0000 (15:21 +0100)
committerShuva Jyoti Kar <shuva.jyoti.kar@ericsson.com>
Thu, 19 May 2016 09:30:15 +0000 (09:30 +0000)
When the looked up serializer does not implement the expected
HeaderDesersializer interface we end up with a ClassCastException. Catch
it, issue a warning and continue.

Change-Id: I70f23733078710507bdc65931e41c1bd02c0684f
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit b80a043a43abc0948378f2d8cbb5a3b819a1f3bc)

openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ListDeserializer.java

index a53749c28e6cbaddfaf8a57da3cbe06a75ba8d9e..f5d0c2bace6dcb9af04c87f5e9d0dc519f35688b 100644 (file)
@@ -77,8 +77,9 @@ public final class ListDeserializer {
                 MessageCodeKey key = keyMaker.make(input);
                 try {
                     deserializer = registry.getDeserializer(key);
-                } catch (IllegalStateException e) {
-                    LOG.warn("Problem during reading table feature property. Skipping unknown feature property: {}", key);
+                } catch (ClassCastException | IllegalStateException e) {
+                    LOG.warn("Problem during reading table feature property. Skipping unknown feature property: {}",
+                        key, e);
                     input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
                     continue;
                 }