Github user NicoK commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3172#discussion_r97279222
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/query/netty/message/KvStateRequestSerializer.java
 ---
    @@ -377,22 +376,24 @@ public static Throwable 
deserializeServerFailure(ByteBuf buf) throws IOException
                                0,
                                serializedKeyAndNamespace.length);
     
    -           K key = keySerializer.deserialize(dis);
    -           byte magicNumber = dis.readByte();
    -           if (magicNumber != 42) {
    -                   throw new IllegalArgumentException("Unexpected magic 
number " + magicNumber +
    -                                   ". This indicates a mismatch in the key 
serializers used by the " +
    -                                   "KvState instance and this access.");
    -           }
    -           N namespace = namespaceSerializer.deserialize(dis);
    +           try {
    +                   K key = keySerializer.deserialize(dis);
    +                   byte magicNumber = dis.readByte();
    +                   if (magicNumber != 42) {
    +                           throw new IOException("Unexpected magic number 
" + magicNumber + ".");
    +                   }
    +                   N namespace = namespaceSerializer.deserialize(dis);
     
    -           if (dis.available() > 0) {
    -                   throw new IllegalArgumentException("Unconsumed bytes in 
the serialized key " +
    -                                   "and namespace. This indicates a 
mismatch in the key/namespace " +
    -                                   "serializers used by the KvState 
instance and this access.");
    -           }
    +                   if (dis.available() > 0) {
    +                           throw new IOException("Unconsumed bytes in the 
serialized key and namespace.");
    +                   }
     
    -           return new Tuple2<>(key, namespace);
    +                   return new Tuple2<>(key, namespace);
    +           } catch (IOException e) {
    --- End diff --
    
    it may, but there are other `IOException`s in deeper code, e.g. in 
`dis.readByte();` and I did not want any special code separating these from our 
`IOException`s and considered this the least obtrusive variant


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to