You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2017/08/07 05:55:34 UTC

[1/4] struts git commit: WW-4834 fixed faulty regex

Repository: struts
Updated Branches:
  refs/heads/master c9d20b573 -> a05259ed6


WW-4834 fixed faulty regex


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/8a04e80f
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/8a04e80f
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/8a04e80f

Branch: refs/heads/master
Commit: 8a04e80f01350c90f053d71366d5e0c2186fded5
Parents: 9d47af6
Author: Stefaan Dutry <st...@gmail.com>
Authored: Wed Aug 2 09:31:11 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Wed Aug 2 09:31:11 2017 +0200

----------------------------------------------------------------------
 .../com/opensymphony/xwork2/validator/validators/URLValidator.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/8a04e80f/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
index b61f786..2727723 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
@@ -54,7 +54,7 @@ public class URLValidator extends FieldValidatorSupport {
             "@)?#?" +
             "(?:(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)*" +
             "[a-z][a-z0-9-]*[a-z0-9]" +
-            "|(?:[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5]\\.){3}" +
+            "|(?:(?:[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}" +
             "[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5]" +
             ")(?::\\d+)?" +
             ")(?:(?:/(?:[a-z0-9$_.+!*'(),;:@&=\\-]|%[0-9a-f]{2})*)*" +


[3/4] struts git commit: added tests for valid urls with default regex consisting of ip-address

Posted by lu...@apache.org.
added tests for valid urls with default regex consisting of ip-address


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/13828056
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/13828056
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/13828056

Branch: refs/heads/master
Commit: 13828056b47a25e7ddee80a042a6a8d3b670ff32
Parents: 418a20c
Author: Stefaan Dutry <st...@gmail.com>
Authored: Thu Aug 3 19:01:14 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Thu Aug 3 19:01:14 2017 +0200

----------------------------------------------------------------------
 .../xwork2/validator/URLValidatorTest.java             | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/13828056/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java b/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
index baa2bb1..3a39573 100644
--- a/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/validator/URLValidatorTest.java
@@ -168,6 +168,19 @@ public class URLValidatorTest extends XWorkTestCase {
         //this will cause test to hang indefinitely using JDK 1.8.0_121, Struts 2.5.10.1 and JUnit 4.5
         assertTrue(pattern.matcher("http://wargame.ch/wc/acw/sub/aotm/guestbook/index.php?page3D183EClearwater20Roofing20Contractors3C/a3E3Ekaldu20non20msg3C/a3E").matches());
         assertTrue(UrlValidator.getInstance().isValid("http://wargame.ch/wc/acw/sub/aotm/guestbook/index.php?page3D183EClearwater20Roofing20Contractors3C/a3E3Ekaldu20non20msg3C/a3E"));
+
+        assertTrue(pattern.matcher("http://253.254.255.1").matches());
+        assertTrue(UrlValidator.getInstance().isValid("http://253.254.255.1"));
+
+        assertTrue(pattern.matcher("http://253.254.255.12").matches());
+        assertTrue(UrlValidator.getInstance().isValid("http://253.254.255.12"));
+
+        assertTrue(pattern.matcher("http://1.2.3.100").matches());
+        assertTrue(UrlValidator.getInstance().isValid("http://1.2.3.100"));
+
+        assertTrue(pattern.matcher("http://1.2.3.255").matches());
+        assertTrue(UrlValidator.getInstance().isValid("http://1.2.3.255"));
+
     }
 
     public void testLongRunningValidations() throws Exception {


[2/4] struts git commit: further fixed faulty RegEx: missing grouping for last number in ip-address and escaped '/' to work in javascript

Posted by lu...@apache.org.
further fixed faulty RegEx: missing grouping for last number in ip-address and escaped '/' to work in javascript


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/418a20c0
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/418a20c0
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/418a20c0

Branch: refs/heads/master
Commit: 418a20c0594f23764fe29ced400c1219239899a8
Parents: 8a04e80
Author: Stefaan Dutry <st...@gmail.com>
Authored: Thu Aug 3 18:49:22 2017 +0200
Committer: Stefaan Dutry <st...@gmail.com>
Committed: Thu Aug 3 18:49:22 2017 +0200

----------------------------------------------------------------------
 .../xwork2/validator/validators/URLValidator.java            | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/418a20c0/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
index 2727723..a75b5a5 100644
--- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
+++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/URLValidator.java
@@ -48,17 +48,17 @@ public class URLValidator extends FieldValidatorSupport {
 
     private static final Logger LOG = LogManager.getLogger(URLValidator.class);
 
-    public static final String DEFAULT_URL_REGEX = "^(?:https?|ftp)://" +
+    public static final String DEFAULT_URL_REGEX = "^(?:https?|ftp):\\/\\/" +
             "(?:(?:[a-z0-9$_.+!*'(),;?&=\\-]|%[0-9a-f]{2})+" +
             "(?::(?:[a-z0-9$_.+!*'(),;?&=\\-]|%[0-9a-f]{2})+)?" +
             "@)?#?" +
             "(?:(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)*" +
             "[a-z][a-z0-9-]*[a-z0-9]" +
             "|(?:(?:[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}" +
-            "[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5]" +
+            "(?:[1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])" +
             ")(?::\\d+)?" +
-            ")(?:(?:/(?:[a-z0-9$_.+!*'(),;:@&=\\-]|%[0-9a-f]{2})*)*" +
-            "(?:\\?(?:[a-z0-9$_.+!*'(),;:@&=\\-/:]|%[0-9a-f]{2})*)?)?" +
+            ")(?:(?:\\/(?:[a-z0-9$_.+!*'(),;:@&=\\-]|%[0-9a-f]{2})*)*" +
+            "(?:\\?(?:[a-z0-9$_.+!*'(),;:@&=\\-\\/:]|%[0-9a-f]{2})*)?)?" +
             "(?:#(?:[a-z0-9$_.+!*'(),;:@&=\\-]|%[0-9a-f]{2})*)?" +
             "$";
 


[4/4] struts git commit: WW-4834 fixes faulty regex

Posted by lu...@apache.org.
WW-4834 fixes faulty regex


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/a05259ed
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/a05259ed
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/a05259ed

Branch: refs/heads/master
Commit: a05259ed69a5a48379aa91650e4cd1cb4bd6e5ad
Parents: c9d20b5 1382805
Author: Lukasz Lenart <lu...@apache.org>
Authored: Mon Aug 7 07:55:25 2017 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Mon Aug 7 07:55:25 2017 +0200

----------------------------------------------------------------------
 .../xwork2/validator/validators/URLValidator.java      | 10 +++++-----
 .../xwork2/validator/URLValidatorTest.java             | 13 +++++++++++++
 2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------