struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [08/28] struts git commit: WW-4453 Reports missing value
Date Thu, 19 Mar 2015 08:50:07 GMT
WW-4453 Reports missing value


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

Branch: refs/heads/master
Commit: cd0d8de67aacc531dbf2d5a9840b55ff46bcc817
Parents: acef492
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Tue Jan 27 09:00:00 2015 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Tue Jan 27 09:00:00 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/struts2/components/Component.java   | 8 +++++++-
 core/src/main/java/org/apache/struts2/components/Date.java   | 8 ++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/cd0d8de6/core/src/main/java/org/apache/struts2/components/Component.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Component.java b/core/src/main/java/org/apache/struts2/components/Component.java
index 7ed0d56..15cc698 100644
--- a/core/src/main/java/org/apache/struts2/components/Component.java
+++ b/core/src/main/java/org/apache/struts2/components/Component.java
@@ -69,6 +69,7 @@ public class Component {
      */
     protected static ConcurrentMap<Class<?>, Collection<String>> standardAttributesMap
= new ConcurrentHashMap<Class<?>, Collection<String>>();
 
+    protected boolean devMode = false;
     protected ValueStack stack;
     protected Map parameters;
     protected ActionMapper actionMapper;
@@ -97,7 +98,12 @@ public class Component {
 
         return name.substring(dot + 1).toLowerCase();
     }
-    
+
+    @Inject(value = StrutsConstants.STRUTS_DEVMODE, required = false)
+    public void setDevMode(String devMode) {
+        this.devMode = Boolean.parseBoolean(devMode);
+    }
+
     @Inject
     public void setActionMapper(ActionMapper mapper) {
         this.actionMapper = mapper;

http://git-wip-us.apache.org/repos/asf/struts/blob/cd0d8de6/core/src/main/java/org/apache/struts2/components/Date.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/components/Date.java b/core/src/main/java/org/apache/struts2/components/Date.java
index 887a5ec..0bb1207 100644
--- a/core/src/main/java/org/apache/struts2/components/Date.java
+++ b/core/src/main/java/org/apache/struts2/components/Date.java
@@ -285,6 +285,14 @@ public class Date extends ContextBean {
                 date = (java.util.Date) dateObject;
             } else if(dateObject instanceof Calendar){
                 date = ((Calendar) dateObject).getTime();
+            } else {
+                if (devMode) {
+                    LOG.error("Expression [#0] passed to <s:date/> tag which was evaluated
to [#1](#2) isn't instance of java.util.Date nor java.util.Calendar!",
+                            name, dateObject, (dateObject != null ? dateObject.getClass()
: "null"));
+                } else {
+                    LOG.debug("Expression [#0] passed to <s:date/> tag which was evaluated
to [#1](#2) isn't instance of java.util.Date nor java.util.Calendar!",
+                            name, dateObject, (dateObject != null ? dateObject.getClass()
: "null"));
+                }
             }
         } catch (Exception e) {
             LOG.error("Could not convert object with key '#0' to a java.util.Date instance",
name);


Mime
View raw message