Return-Path: X-Original-To: apmail-struts-commits-archive@minotaur.apache.org Delivered-To: apmail-struts-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E9F6710AF9 for ; Fri, 21 Mar 2014 20:16:36 +0000 (UTC) Received: (qmail 22364 invoked by uid 500); 21 Mar 2014 20:15:58 -0000 Delivered-To: apmail-struts-commits-archive@struts.apache.org Received: (qmail 22176 invoked by uid 500); 21 Mar 2014 20:15:52 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 21734 invoked by uid 99); 21 Mar 2014 20:15:42 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Mar 2014 20:15:42 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4D47432BDEE; Fri, 21 Mar 2014 20:15:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lukaszlenart@apache.org To: commits@struts.apache.org Date: Fri, 21 Mar 2014 20:15:56 -0000 Message-Id: <3caa74c0c0ff4175acc67d9bf33108f8@git.apache.org> In-Reply-To: <56d21da87402495c8056527ea1c9a0b6@git.apache.org> References: <56d21da87402495c8056527ea1c9a0b6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [17/22] 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/use-js-to-support-multiple-buttons Commit: d59fb2b9ecd6e43a9029583f720002a072d965fb Parents: 1ca55b8 Author: Lukasz Lenart Authored: Wed Mar 19 08:50:56 2014 +0100 Committer: Lukasz Lenart 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; } }