You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Shengkai Fang (Jira)" <ji...@apache.org> on 2020/11/24 12:49:00 UTC

[jira] [Created] (FLINK-20321) Get NPE when using AvroDeserializationSchema to deserialize null input

Shengkai Fang created FLINK-20321:
-------------------------------------

             Summary: Get NPE when using AvroDeserializationSchema to deserialize null input
                 Key: FLINK-20321
                 URL: https://issues.apache.org/jira/browse/FLINK-20321
             Project: Flink
          Issue Type: Bug
          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
    Affects Versions: 1.12.0
            Reporter: Shengkai Fang


You can reproduce the bug by adding the code into the {{AvroDeserializationSchemaTest}}.
The code follows


{code:java}
@Test
	public void testSpecificRecord2() throws Exception {
		DeserializationSchema<Address> deserializer = AvroDeserializationSchema.forSpecific(Address.class);

		Address deserializedAddress = deserializer.deserialize(null);
		assertEquals(null, deserializedAddress);
	}

{code}

Exception stack:

{code:java}
java.lang.NullPointerException
	at org.apache.flink.formats.avro.utils.MutableByteArrayInputStream.setBuffer(MutableByteArrayInputStream.java:43)
	at org.apache.flink.formats.avro.AvroDeserializationSchema.deserialize(AvroDeserializationSchema.java:131)
	at org.apache.flink.formats.avro.AvroDeserializationSchemaTest.testSpecificRecord2(AvroDeserializationSchemaTest.java:69)
{code}





--
This message was sent by Atlassian Jira
(v8.3.4#803005)