You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Chesnay Schepler (Jira)" <ji...@apache.org> on 2023/06/13 14:37:00 UTC

[jira] [Created] (FLINK-32327) Python Kafka connector runs into strange NullPointerException

Chesnay Schepler created FLINK-32327:
----------------------------------------

             Summary: Python Kafka connector runs into strange NullPointerException
                 Key: FLINK-32327
                 URL: https://issues.apache.org/jira/browse/FLINK-32327
             Project: Flink
          Issue Type: Sub-task
          Components: API / Python
            Reporter: Chesnay Schepler


The following error occurs when running the python kafka tests:
(this uses a slightly modified version of the code, but the error also happens without it)

{code:python}
     def set_record_serializer(self, record_serializer: 'KafkaRecordSerializationSchema') \
             -> 'KafkaSinkBuilder':
         """
         Sets the :class:`KafkaRecordSerializationSchema` that transforms incoming records to kafka
         producer records.
     
         :param record_serializer: The :class:`KafkaRecordSerializationSchema`.
         """
         # NOTE: If topic selector is a generated first-column selector, do extra preprocessing
         j_topic_selector = get_field_value(record_serializer._j_serialization_schema,
                                            'topicSelector')
     
         caching_name_suffix = 'KafkaRecordSerializationSchemaBuilder.CachingTopicSelector'
         if j_topic_selector.getClass().getCanonicalName().endswith(caching_name_suffix):
             class_name = get_field_value(j_topic_selector, 'topicSelector')\
                 .getClass().getCanonicalName()
 >           if class_name.startswith('com.sun.proxy') or class_name.startswith('jdk.proxy'):
 E           AttributeError: 'NoneType' object has no attribute 'startswith'
{code}

My assumption is that {{getCanonicalName}} returns {{null}} for some objects, and this set of objects may have increased in Java 17. I tried adding a null check, but that caused other tests to fail.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)