michaeljmarshall commented on issue #14304: URL: https://github.com/apache/pulsar/issues/14304#issuecomment-1041080489
> I believe that `hasAdvertisedListenerName` would return true for any value, including `null`. I don't believe this is correct. If you look at the protobuf field definition, the `advertised_listener_name` field is an optional string. https://github.com/apache/pulsar/blob/a43fab0045a93ee864da6bc386bcc0e8bf17bf11/pulsar-common/src/main/proto/PulsarApi.proto#L437 I just ran a quick test to double check my understanding, and this test passes: ```java @Test public void testAdvertisedListenerName() { BaseCommand bc1 = new BaseCommand(); bc1.setLookupTopic(); assertFalse(bc1.getLookupTopic().hasAdvertisedListenerName()); try { bc1.setLookupTopic().setAdvertisedListenerName(null); fail(); } catch (NullPointerException e) { // expected } BaseCommand bc2 = new BaseCommand(); bc2.setLookupTopic().setAdvertisedListenerName(""); assertTrue(bc2.getLookupTopic().hasAdvertisedListenerName()); } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
