George McCone created AMQ-9438:
----------------------------------

             Summary: FailoverTransport throws UnknowHostException on compeURIs
                 Key: AMQ-9438
                 URL: https://issues.apache.org/jira/browse/AMQ-9438
             Project: ActiveMQ Classic
          Issue Type: Improvement
          Components: Transport
    Affects Versions: 5.16.7, 5.17.6, 5.18.3
         Environment: This occurs using OpenJDK 11 on both Windows and Linux 
environments.
            Reporter: George McCone


In the org.apache.activemq.transport.failover.FailoverTransport.compareURIs(), 
it is trying to compare 2 hosts to see if they are the same.

To accomplish this, the function InetAddress.getByName() used to help extract 
out the the IP address of each of the hosts to see if they are the same.

In the event one of the hosts is not resolvable,  InetAddress.getByName() 
throws a UnknownHostException.

This UnknownHostException is not being caught in the try/catch block, only 
IOException.

I believe the exception catch block should be extended to catch 
UnknownHostException as it is simply doing a string compare that the 2 hosts 
are the same at that point.
{code:java}
java.net.UnknownHostException: No such host is known (UNKNOWN)
    at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[?:?]
    at 
java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
 ~[?:?]
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1519) 
~[?:?]
    at java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) 
~[?:?]
    at java.net.InetAddress.getAllByName0(InetAddress.java:1509) ~[?:?]
    at java.net.InetAddress.getAllByName(InetAddress.java:1368) ~[?:?]
    at java.net.InetAddress.getAllByName(InetAddress.java:1302) ~[?:?]
    at java.net.InetAddress.getByName(InetAddress.java:1252) ~[?:?]
    at 
org.apache.activemq.transport.failover.FailoverTransport.compareURIs(FailoverTransport.java:1393)
 ~[?:?] {code}



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

Reply via email to