Github user uce commented on a diff in the pull request:
https://github.com/apache/flink/pull/3172#discussion_r97099962
--- 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 --
Do you think it makes sense to directly throw the final exception in the
method body? The reported stack traces are usually already very deep.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---