[jboss-as7-dev] TS: Bad approach used as fallback mechanism for gathering IP address

Kabir Khan kabir.khan at jboss.com
Fri Mar 2 08:53:06 EST 2012


On 2 Mar 2012, at 13:31, Pavel Janousek wrote:

> Hi,
> 
> I've investigated some issue now and seen there are several places in TS where we can see similar code like this:
> 
> static final String someIPproperty = System.getProperty("<some key>", "localhost"); 
> 
> or
> 
> static final String someIPproperty = System.getProperty("<some key>", "127.0.0.1"); 
> 
> As you can see above, this fallback mechanism is bound in this case (key value isn't found) to IPv4 only IP address at all. This approach is bad because we can run in other network stack - IPv6 is presented in these days - and in this case the such testcase fails with some strange error due to this issue.
> 
> I think we have two option how to resolve this issue:
> 
> 1) Don't use fallback mechanism at all and fix (= remove) them in present testcases
> 
> 2) Create auxiliary class which return 127.0.0.1 or ::1 string (but not string "localhost" because we can't be sure how it is translated (*))
> 
> (*) common setup in Linux is to translate localhost -> 127.0.0.1 and localhost6 -> ::1
> 
> 
> Ad 1) I prefer this option because some forget/miss setting is very easy to catch
I don't like this one - having to remember to set all the addresses while developing will be annoying :-)
> 
> Ad 2) This auxiliary class should need to make some magic decision in which IP network stack mode we are now running and return IPv4 or IPv6 lookpack address accordingly.
> 
> WDYT about this?
> 
> --
> Pavel Janousek
> Senior JBoss QA Engineer
> 
> 
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev




More information about the jboss-as7-dev mailing list