struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts git commit: WW-4674 Uses the same logic as in Dispatcher to control handling exception
Date Fri, 16 Sep 2016 14:31:35 GMT
Repository: struts
Updated Branches:
  refs/heads/master 45c113eaa -> 459e19802


WW-4674 Uses the same logic as in Dispatcher to control handling exception


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

Branch: refs/heads/master
Commit: 459e198022e8b96e9c3d5f97b1d4c428794ffb96
Parents: 45c113e
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Fri Sep 16 16:31:17 2016 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Fri Sep 16 16:31:17 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/struts2/dispatcher/Dispatcher.java    | 10 +++++++++-
 .../org/apache/struts2/dispatcher/PrepareOperations.java  |  4 +++-
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/459e1980/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index 728498f..2bc1901 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -216,7 +216,11 @@ public class Dispatcher {
      */
     @Inject(StrutsConstants.STRUTS_DEVMODE)
     public void setDevMode(String mode) {
-        devMode = "true".equals(mode);
+        devMode = Boolean.parseBoolean(mode);
+    }
+
+    public boolean isDevMode() {
+        return devMode;
     }
 
     /**
@@ -270,6 +274,10 @@ public class Dispatcher {
         this.handleException = Boolean.parseBoolean(handleException);
     }
 
+    public boolean isHandleException() {
+        return handleException;
+    }
+
     @Inject
     public void setDispatcherErrorHandler(DispatcherErrorHandler errorHandler) {
         this.errorHandler = errorHandler;

http://git-wip-us.apache.org/repos/asf/struts/blob/459e1980/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java b/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java
index efa4ea7..8bfb954 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/PrepareOperations.java
@@ -188,7 +188,9 @@ public class PrepareOperations {
                     request.setAttribute(STRUTS_ACTION_MAPPING_KEY, mapping);
                 }
             } catch (Exception ex) {
-                dispatcher.sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
ex);
+                if (dispatcher.isHandleException() || dispatcher.isDevMode()) {
+                    dispatcher.sendError(request, response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
ex);
+                }
             }
         }
 


Mime
View raw message