You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/03/29 04:46:29 UTC
svn commit: r642501 -
/myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java
Author: lu4242
Date: Fri Mar 28 20:46:28 2008
New Revision: 642501
URL: http://svn.apache.org/viewvc?rev=642501&view=rev
Log:
fix MYFACES-1845 Only date is returned wihen both dateStyle and timeStyle are set without specifying type
Modified:
myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java
Modified: myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java?rev=642501&r1=642500&r2=642501&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java (original)
+++ myfaces/core/trunk_1.2.x/impl/src/main/java/org/apache/myfaces/taglib/core/ConvertDateTimeTag.java Fri Mar 28 20:46:28 2008
@@ -227,19 +227,58 @@
DateTimeConverter converter,
ValueExpression value)
{
- if (value == null) return;
-
- String type = (String) UIComponentELTagUtils.evaluateValueExpression(elContext, value);
+ String type;
+
+ if (value == null)
+ {
+ type = null;
+ }
+ else
+ {
+ type = (String) UIComponentELTagUtils.evaluateValueExpression(elContext, value);
+ }
if (type == null)
{
- type = DEFAULT_TYPE;
- }
- if (!TYPE_DATE.equals(type) &&
+ //Now check the conditions on the spec, for type is not defined
+ // page 9-20
+ String timeStyle = (_timeStyle == null) ? null :
+ (String) UIComponentELTagUtils.evaluateValueExpression(elContext, _timeStyle);
+ String dateStyle = (_dateStyle == null) ? null :
+ (String) UIComponentELTagUtils.evaluateValueExpression(elContext, _dateStyle);
+ if (dateStyle == null)
+ {
+ if (timeStyle == null)
+ {
+ // if none type defaults to DEFAULT_TYPE
+ type = DEFAULT_TYPE;
+ }
+ else
+ {
+ // if timeStyle is set and dateStyle is not, type defaults to TYPE_TIME
+ type = TYPE_TIME;
+ }
+ }
+ else
+ {
+ if (timeStyle == null)
+ {
+ // if dateStyle is set and timeStyle is not, type defaults to TYPE_DATE
+ type = TYPE_DATE;
+ }
+ else
+ {
+ // if both dateStyle and timeStyle are set, type defaults to TYPE_BOTH
+ type = TYPE_BOTH;
+ }
+ }
+ }else {
+ if (!TYPE_DATE.equals(type) &&
!TYPE_TIME.equals(type) &&
!TYPE_BOTH.equals(type))
- {
- type = DEFAULT_TYPE;
+ {
+ type = DEFAULT_TYPE;
+ }
}
converter.setType(type);