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 2015/03/19 09:50:07 UTC
[08/28] struts git commit: WW-4453 Reports missing value
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 <lu...@apache.org>
Authored: Tue Jan 27 09:00:00 2015 +0100
Committer: Lukasz Lenart <lu...@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);