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

Bela Ban (JIRA) jira-events at lists.jboss.org
Tue Sep 13 08:58:26 EDT 2011


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

Bela Ban commented on JGRP-1360:
--------------------------------

Is TP.getBindAddress() and TP.setBindAddress() the only occurrence ? Ichecked other protocols, but didn't find this inconsistency.
Fixed.

> 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
>             Fix For: 3.0
>
>
> 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