Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1360

getXXXAddress() protocol methods are annoying

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Minor Minor
    • 3.0
    • 2.12.1
    • None

      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.

              rhn-engineering-bban Bela Ban
              pferraro@redhat.com Paul Ferraro
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: