[jboss-jira] [JBoss JIRA] (WFLY-2921) Wrong condition statement in NetworkUtils#formatAddress(InetSocketAddress)

Sri Ram (JIRA) issues at jboss.org
Sat May 3 15:21:56 EDT 2014


    [ https://issues.jboss.org/browse/WFLY-2921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965282#comment-12965282 ] 

Sri Ram commented on WFLY-2921:
-------------------------------

I think, It's the right condition. That method is expected to return "ipAddress:port" and not the "hostname:port"

Reason :
With this below condition, if an inet socket address is unresolved, then we can't get it's address (i.e., inet.getAddress() will return null) and the getHostName() will return whatever we passed as string). 

>>
        if(inet.isUnresolved()){
            result.append(inet.getHostName());
        }else{
            result.append(formatPossibleIpv6Address(formatAddress(inet.getAddress())));
        }
<<

Does it sounds good?

> Wrong condition statement in NetworkUtils#formatAddress(InetSocketAddress)
> --------------------------------------------------------------------------
>
>                 Key: WFLY-2921
>                 URL: https://issues.jboss.org/browse/WFLY-2921
>             Project: WildFly
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 8.0.0.Final
>            Reporter: Ted Won
>            Priority: Minor
>
> It seems there is a wrong condition statement of formatAddress(InetSocketAddress inet) in the class org.jboss.as.network.NetworkUtils.
> https://github.com/wildfly/wildfly/blob/master/network/src/main/java/org/jboss/as/network/NetworkUtils.java
> This method returns "ipAddress:port", but expected to "hostname:port".
> public static String formatAddress(InetSocketAddress inet)
> ...
> // As-is
> if(inet.isUnresolved()){
>             result.append(inet.getHostName());
> // Expected to reversely: 
> if(!inet.isUnresolved()){
>             result.append(inet.getHostName());
> ...



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the jboss-jira mailing list