Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-20321

Get NPE when using AvroDeserializationSchema to deserialize null input

    XMLWordPrintableJSON

Details

    Description

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

      @Test
      	public void testSpecificRecord2() throws Exception {
      		DeserializationSchema<Address> deserializer = AvroDeserializationSchema.forSpecific(Address.class);
      
      		Address deserializedAddress = deserializer.deserialize(null);
      		assertEquals(null, deserializedAddress);
      	}
      
      

      Exception stack:

      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)
      

      Attachments

        Issue Links

          Activity

            People

              xwang51 Xue Wang
              fsk119 Shengkai Fang
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: