[ 
https://issues.apache.org/jira/browse/AXIS2-3146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560932#action_12560932
 ] 

Peter Flemming commented on AXIS2-3146:
---------------------------------------

The generated regular expression should take account of the dots "." in the 
http.nonProxyHosts string.  Since they are a regex metacharacter they should be 
escaped.

The regex derived from "*.epu.mycorp.com" should be ".*\.epu\.mycorp\.com".

I suggest the following code should replace the remainder of the 
validateNonProxyHosts() method after
String[] nonProxyHostsArray = nonProxyHosts.split("\\|");

            boolean pass = false;
            for (int i = 0; i < nonProxyHostsArray.length; i++) {
                String a = nonProxyHostsArray[i].replaceAll("\\.", 
"\\\\.").replaceAll("\\*", ".*");
                if (targetHost.matches(a)) {
                    pass = true;
                    break;
                }
            }
            return pass;


> Axis client fails if http.nonProxyHosts contains * as wildcard
> --------------------------------------------------------------
>
>                 Key: AXIS2-3146
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3146
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.3
>         Environment: Websphere with jdk 1.4.2 / local XP machine with java5
>            Reporter: Bernd Frey
>            Assignee: Saminda Wishwajith Abeyruwan
>            Priority: Critical
>
> I get the following error if I have defined 
> -Dhttp.nonProxyHosts=yyy|mbfq0202|*.epu.mycorp.com:
> java.util.regex.PatternSyntaxException: Dangling meta character '*' near 
> index 0
> *.epu.mycorp.com
> ^
>       at java.util.regex.Pattern.error(Pattern.java:1650)
>       at java.util.regex.Pattern.sequence(Pattern.java:1787)
>       at java.util.regex.Pattern.expr(Pattern.java:1687)
>       at java.util.regex.Pattern.compile(Pattern.java:1397)
>       at java.util.regex.Pattern.<init>(Pattern.java:1124)
>       at java.util.regex.Pattern.compile(Pattern.java:817)
>       at java.util.regex.Pattern.matches(Pattern.java:919)
>       at java.lang.String.matches(String.java:1921)
>       at 
> org.apache.axis2.transport.http.ProxyConfiguration.validateNonProxyHosts(ProxyConfiguration.java:261)
>       at 
> org.apache.axis2.transport.http.ProxyConfiguration.isProxyEnabled(ProxyConfiguration.java:223)
>       at 
> org.apache.axis2.transport.http.AbstractHTTPSender.getHostConfiguration(AbstractHTTPSender.java:271)
>       at 
> org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:502)
>       at 
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191)
>       at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
>       at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
>       at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
>       at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
> ...
> the problem is Axis2 does a String.match on "*.epu.mycorp.com" in 
> ProxyConfiguration.validateNonProxyHosts. This must fail because 
> "*.epu.mycorp.com" is a valid entry for http.nonProxyHosts, but it is not a 
> valid regexp.
> I suggest to add
>         for (int i=0; i<nonProxyHostsArray.length; i++) {
>               if (nonProxyHostsArray[i].startsWith("*")) {
>                       nonProxyHostsArray[i] = "\\w" + nonProxyHostsArray[i];
>               }
>         }
> after
>         String[] nonProxyHostsArray = nonProxyHosts.split("\\|");
>         
> Bernd

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to