Grzegorz Liter created FLINK-34474:
--------------------------------------
Summary: After failed deserialization with
ConfluentRegistryAvroDeserializationSchema all subsequent deserialization fails
Key: FLINK-34474
URL: https://issues.apache.org/jira/browse/FLINK-34474
Project: Flink
Issue Type: Bug
Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
Affects Versions: 1.18.1
Environment: * Locally executed, without Flink cluster.
* Flink on Kubernetes
Reporter: Grzegorz Liter
Steps to reproduce:
# Create ConfluentRegistryAvroDeserializationSchema instance for specific Avro
# Parse invalid byte representation of serialized Avro event
# Parse valid byte representation of serialized Avro event
Expected:
Validation in step 3 is successful
Actual:
Validation in step 3 fails
Short code example, I cannot attach full examples at this time:
```
public class DeserializationTest {
public static void main(String[] args) throws Exception {
byte[] valid = new byte[]{
...
};
byte[] invalid = new byte[]{
...
};
ConfluentRegistryAvroDeserializationSchema<RawEvent> deserializer =
ConfluentRegistryAvroDeserializationSchema.forSpecific(RawEvent.class, valid
schema registry url);
System.out.println("deserialize valid");
des(deserializer, valid);
System.out.println("deserialize invalid");
des(deserializer, invalid);
System.out.println("deserialize valid");
des(deserializer, valid);
System.out.println("deserialize valid");
des(deserializer, valid);
}
private static void
des(ConfluentRegistryAvroDeserializationSchema<RawEvent> deserializer, byte[]
bytes) {
try {
deserializer.deserialize(bytes);
System.out.println("VALID");
} catch (Exception e) {
System.out.println("FAILED: " + e);
}
}
}
```
Console output:
```
deserialize valid
VALID
deserialize invalid
FAILED: java.lang.ArrayIndexOutOfBoundsException: Index -154 out of bounds for
length 2
deserialize valid
FAILED: java.lang.ArrayIndexOutOfBoundsException: Index 24 out of bounds for
length 2
deserialize valid
FAILED: java.lang.ArrayIndexOutOfBoundsException: Index 25 out of bounds for
length 2
```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)