You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/01/03 03:55:09 UTC

[GitHub] zhaijack opened a new issue #1022: URI("pulsar://broker-:6650").getPort() will return "-1" instead of 6650

zhaijack opened a new issue #1022: URI("pulsar://broker-:6650").getPort() will return "-1" instead of 6650
URL: https://github.com/apache/incubator-pulsar/issues/1022
 
 
   found this by wrongly set hostname to "broker-", while using docker to do some test, not sure if this is a bug in java.net.URI.
   
   #### Expected behavior
   In this part of code,
   ```
      public BrokerService(PulsarService pulsar) throws Exception {
           this.pulsar = pulsar;
           this.managedLedgerFactory = pulsar.getManagedLedgerFactory();
           this.port = new URI(pulsar.getBrokerServiceUrl()).getPort();
           this.tlsPort = new URI(pulsar.getBrokerServiceUrlTls()).getPort();
   ...
   ```
   URI("pulsar://broker-:6650").getPort() should return 6650
   
   
   #### Actual behavior
   
   URI("pulsar://broker-:6650").getPort() will return "-1"
   
   #### Steps to reproduce
   
   set hostname to "broker-", start broker on this host, it will report wrong port:
   ```
   2018-01-03 02:13:14,778 - INFO  - [main:DistributedIdGenerator@79] - Created sequential node at /counters/producer-name/-0000000000 -- Generator Id is test_zj-0
   2018-01-03 02:13:14,781 - ERROR - [main:PulsarService@345] - port out of range:-1
   java.lang.IllegalArgumentException: port out of range:-1
       at java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
       at java.net.InetSocketAddress.<init>(InetSocketAddress.java:224)
       at org.apache.pulsar.broker.service.BrokerService.start(BrokerService.java:285)
       at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:270)
       at org.apache.pulsar.PulsarBrokerStarter$BrokerStarter.start(PulsarBrokerStarter.java:190)
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services