[jboss-jira] [JBoss JIRA] Created: (JGRP-1360) getXXXAddress() protocol methods are annoying

Paul Ferraro (JIRA) jira-events at lists.jboss.org
Sat Sep 10 15:11:26 EDT 2011


getXXXAddress() protocol methods are annoying
---------------------------------------------

                 Key: JGRP-1360
                 URL: https://issues.jboss.org/browse/JGRP-1360
             Project: JGroups
          Issue Type: Enhancement
    Affects Versions: 2.12.1
            Reporter: Paul Ferraro
            Assignee: Bela Ban
            Priority: Minor


This one has been bothering me for a while.  Typically, when an object exposes JavaBean-style methods such as getBindAddress() and setBindAddress(String), one expects a certain level of idempotency.  For example:

TP transport;
String address = "127.0.0.1";
transport.setBindAddress(address);
Assert.assertEquals(address, transport.getBindAddress());

However, the assertion fails, because getBindAddress() returns the toString() of the InetAddress composed during setBindAddress().  InetAddress.toString() returns a combination of the host name, and a resolved host address.  Therefore, "127.0.0.1" != "/127.0.0.1"

More annoying, however, is the inability to do transport.setBindAddress(transport.getBindAddress()), since the result of getBindAddress() is not a valid address as expected by setBindAddress(String).

It would be great if all the getXXXAddress() methods returned the result of InetAddress.getHostAddress().  3.0 is a perfect opportunity to make this kind of change.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list