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 2014/03/19 20:50:05 UTC
[11/16] git commit: Reverts returned values to match logic and checks
if protocol is not null
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/WW-4267-removes-defaults
Commit: d59fb2b9ecd6e43a9029583f720002a072d965fb
Parents: 1ca55b8
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 19 08:50:56 2014 +0100
Committer: Lukasz Lenart <lu...@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;
}
}