+1

Mikhail Loenko wrote:
I think this is the case when me might choose "follow the spec"

Most likely we will not break existing applications if we weaken
requirements for method arguments. But advanced users would be able
to use our benefits.

Thanks,
Mikhail


2006/3/30, Paulex Yang <[EMAIL PROTECTED]>:
Hi,
About the Internet proxy properties, the Java 5 document says '*' can be
used as wild card character for matching, as below

"http.nonProxyHosts indicates the hosts which should be connected too
directly and not through the proxy server. The value can be a list of
hosts, each seperated by a |, and in addition a wild card character (*)
can be used for matching. For example:
-Dhttp.nonProxyHosts="*.foo.com|localhost". "

But RI's behavior looks strange. The wildcard character works only if
it's the first or last character in "host" String. Test case below shows
the details. Shall we make Harmony be compatible with RI?

public void testNonProxyHosts() throws URISyntaxException {
       ProxySelector selector = ProxySelector.getDefault();
       List proxyList;
       Proxy proxy;

       // set http proxy
       System.setProperty("http.proxyHost", "192.168.0.1");

       // RI works as expected if '*' is the last character
       System.setProperty("http.nonProxyHosts", "10.10.*");
       proxyList = selector.select(new URI("http://10.10.1.2";));
       proxy = (Proxy) proxyList.get(0);
       assertEquals(Proxy.NO_PROXY, proxy);

       // If '*' is neither the first character nor the last character, '*'
       // RI consider '*' as a common character instead of wild card
       System.setProperty("http.nonProxyHosts", "10.10.*.2");
       proxyList = selector.select(new URI("http://10.10.*.2";));
       proxy = (Proxy) proxyList.get(0);
       assertEquals(Proxy.NO_PROXY, proxy);

       // the test below confirms that the '*' is not considered as
wild card
       System.setProperty("http.nonProxyHosts", "10.10.*.2");
       proxyList = selector.select(new URI("http://10.10.1.2";));
       proxy = (Proxy) proxyList.get(0);
       assertEquals(Proxy.Type.HTTP, proxy.type());
       assertEquals("192.168.0.1:80", proxy.address().toString());
   }

--
Paulex Yang
China Software Development Lab
IBM






Reply via email to