maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [05/50] [abbrv] maven-aether git commit: Bug 435715 - DefaultProxySelector does not process non-proxy hosts in a case-insensitive manner
Date Sun, 01 May 2016 10:56:07 GMT
Bug 435715 - DefaultProxySelector does not process non-proxy hosts in a case-insensitive manner

Fixed implementation to use case-insensitive matching for non-proxy hosts


Project: http://git-wip-us.apache.org/repos/asf/maven-aether/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-aether/commit/5595ddf8
Tree: http://git-wip-us.apache.org/repos/asf/maven-aether/tree/5595ddf8
Diff: http://git-wip-us.apache.org/repos/asf/maven-aether/diff/5595ddf8

Branch: refs/heads/master
Commit: 5595ddf85c00b468d31ab8a5a8414b02387d92d6
Parents: 705cd01
Author: Benjamin Bentmann <bentmann@sonatype.com>
Authored: Sun May 25 16:57:21 2014 +0200
Committer: Benjamin Bentmann <bentmann@sonatype.com>
Committed: Sun May 25 16:57:21 2014 +0200

----------------------------------------------------------------------
 .../util/repository/DefaultProxySelector.java   |  4 +-
 .../repository/DefaultProxySelectorTest.java    | 43 +++++++++++++++-----
 2 files changed, 34 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-aether/blob/5595ddf8/aether-util/src/main/java/org/eclipse/aether/util/repository/DefaultProxySelector.java
----------------------------------------------------------------------
diff --git a/aether-util/src/main/java/org/eclipse/aether/util/repository/DefaultProxySelector.java
b/aether-util/src/main/java/org/eclipse/aether/util/repository/DefaultProxySelector.java
index fc30c55..3c5b03b 100644
--- a/aether-util/src/main/java/org/eclipse/aether/util/repository/DefaultProxySelector.java
+++ b/aether-util/src/main/java/org/eclipse/aether/util/repository/DefaultProxySelector.java
@@ -36,7 +36,7 @@ public final class DefaultProxySelector
      * a given repository will be used.
      * 
      * @param proxy The proxy definition to add, must not be {@code null}.
-     * @param nonProxyHosts The list of hosts to exclude from proxying, may be {@code null}.
+     * @param nonProxyHosts The list of (case-insensitive) host names to exclude from proxying,
may be {@code null}.
      * @return This proxy selector for chaining, never {@code null}.
      */
     public DefaultProxySelector add( Proxy proxy, String nonProxyHosts )
@@ -105,7 +105,7 @@ public final class DefaultProxySelector
                 {
                     String pattern = tokenizer.nextToken();
                     pattern = pattern.replace( ".", "\\." ).replace( "*", ".*" );
-                    patterns.add( Pattern.compile( pattern ) );
+                    patterns.add( Pattern.compile( pattern, Pattern.CASE_INSENSITIVE ) );
                 }
             }
             this.patterns = patterns.toArray( new Pattern[patterns.size()] );

http://git-wip-us.apache.org/repos/asf/maven-aether/blob/5595ddf8/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java
----------------------------------------------------------------------
diff --git a/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java
b/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java
index 1da7ac6..5f06982 100644
--- a/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java
+++ b/aether-util/src/test/java/org/eclipse/aether/util/repository/DefaultProxySelectorTest.java
@@ -26,21 +26,42 @@ public class DefaultProxySelectorTest
     }
 
     @Test
-    public void testIsNonProxyHost()
+    public void testIsNonProxyHost_Blank()
     {
-        assertFalse( isNonProxyHost( "www.sonatype.org", null ) );
-        assertFalse( isNonProxyHost( "www.sonatype.org", "" ) );
+        assertFalse( isNonProxyHost( "www.eclipse.org", null ) );
+        assertFalse( isNonProxyHost( "www.eclipse.org", "" ) );
+    }
 
-        assertTrue( isNonProxyHost( "www.sonatype.org", "*" ) );
-        assertTrue( isNonProxyHost( "www.sonatype.org", "*.org" ) );
-        assertTrue( isNonProxyHost( "www.sonatype.org", "www.*" ) );
-        assertTrue( isNonProxyHost( "www.sonatype.org", "www.*.org" ) );
+    @Test
+    public void testIsNonProxyHost_Wildcard()
+    {
+        assertTrue( isNonProxyHost( "www.eclipse.org", "*" ) );
+        assertTrue( isNonProxyHost( "www.eclipse.org", "*.org" ) );
+        assertFalse( isNonProxyHost( "www.eclipse.org", "*.com" ) );
+        assertTrue( isNonProxyHost( "www.eclipse.org", "www.*" ) );
+        assertTrue( isNonProxyHost( "www.eclipse.org", "www.*.org" ) );
+    }
 
-        assertFalse( isNonProxyHost( "www.sonatype.org", "www.sonatype.com" ) );
-        assertFalse( isNonProxyHost( "www.sonatype.org", "*.com" ) );
-        assertFalse( isNonProxyHost( "www.sonatype.org", "sonatype.org" ) );
+    @Test
+    public void testIsNonProxyHost_Multiple()
+    {
+        assertTrue( isNonProxyHost( "eclipse.org", "eclipse.org|host2" ) );
+        assertTrue( isNonProxyHost( "eclipse.org", "host1|eclipse.org" ) );
+        assertTrue( isNonProxyHost( "eclipse.org", "host1|eclipse.org|host2" ) );
+    }
 
-        assertTrue( isNonProxyHost( "www.sonatype.org", "*.com|*.org" ) );
+    @Test
+    public void testIsNonProxyHost_Misc()
+    {
+        assertFalse( isNonProxyHost( "www.eclipse.org", "www.eclipse.com" ) );
+        assertFalse( isNonProxyHost( "www.eclipse.org", "eclipse.org" ) );
+    }
+
+    @Test
+    public void testIsNonProxyHost_CaseInsensitivity()
+    {
+        assertTrue( isNonProxyHost( "www.eclipse.org", "www.ECLIPSE.org" ) );
+        assertTrue( isNonProxyHost( "www.ECLIPSE.org", "www.eclipse.org" ) );
     }
 
 }


Mime
View raw message