struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [17/22] git commit: Reverts returned values to match logic and checks if protocol is not null
Date Fri, 21 Mar 2014 20:15:56 GMT
Reverts returned values to match logic and checks if protocol is not null


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

Branch: refs/heads/feature/use-js-to-support-multiple-buttons
Commit: d59fb2b9ecd6e43a9029583f720002a072d965fb
Parents: 1ca55b8
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Wed Mar 19 08:50:56 2014 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Wed Mar 19 08:50:56 2014 +0100

----------------------------------------------------------------------
 .../apache/struts2/dispatcher/ServletRedirectResult.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/d59fb2b9/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
index 9820295..e4347b0 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
@@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URL;
 import java.util.*;
 
 import static javax.servlet.http.HttpServletResponse.SC_FOUND;
@@ -274,27 +275,27 @@ public class ServletRedirectResult extends StrutsResultSupport implements
Reflec
         try {
             URI uri = URI.create(url);
             if (uri.isAbsolute()) {
-                uri.toURL();
+                URL validUrl = uri.toURL();
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("[#0] is full url, not a path", url);
                 }
-                return true;
+                return validUrl.getProtocol() == null;
             } else {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("[#0] isn't absolute URI, assuming it's a path", url);
                 }
-                return false;
+                return true;
             }
         } catch (IllegalArgumentException e) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url);
             }
-            return false;
+            return true;
         } catch (MalformedURLException e) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url);
             }
-            return false;
+            return true;
         }
     }
 


Mime
View raw message