Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias
Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
The type is string public String getTimeZone() { return GMT-05:00; } Paul Spencer Matthias Wessendorf wrote: f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias
Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
Can you *convert* it to TimeZone? By wrapping w/ TimeZone.getTimeZone(GMT-05:00); ? Inside if setConverterTimeZone the CCE happens. When you are using *hard coded* Strings, the else {} is executed. By using EL / ValueBinding (timeZone=#{phrQueryManager.timeZone}) the if {} is executed. HTH, Matthias snip private static void setConverterTimeZone(FacesContext facesContext, DateTimeConverter converter, String value) { if (value == null) return; if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } else { converter.setTimeZone(TimeZone.getTimeZone(value)); } } /snip On 5/31/06, Paul Spencer [EMAIL PROTECTED] wrote: The type is string public String getTimeZone() { return GMT-05:00; } Paul Spencer Matthias Wessendorf wrote: f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias -- Matthias Wessendorf Aechterhoek 18 48282 Emsdetten blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com
Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
Matthias, When I changed my method getTimeZone() to return a TimeZone, things worked as expected. I guess my confusion comes from the TLD Documentation, http://myfaces.apache.org/impl/tlddoc/index.html. When this value is a value-binding to a TimeZone instance, that timezone is used. Otherwise this value is treated as a String containing a timezone id, ie as the ID parameter of method java.util.TimeZone.getTimeZone(String). I read this to mean that the converter would converter would treat String value-binding the same way as a String value. Below is a coded version of my expectation. if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); TimeZone timeZone; Object value = vb.getValue(facesContext); if (value instanceof TimeZone) { timeZone = (TimeZone) value; } else { timeZone = TimeZone.getTimeZone(value.toString()) } converter.setTimeZone(timeZone); } Is my expectation in keeping with the spec? If it is case should I enter a JIRA issue? Paul Spencer Paul Spencer wrote: The type is string public String getTimeZone() { return GMT-05:00; } Paul Spencer Matthias Wessendorf wrote: f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias
Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
Paul- good catch. You are right. RI TLD Doc says the same. Create a bug for MyFaces Core Jira project and asign the ticket please to me ! (matzew) Thanks, Matthias On 5/31/06, Paul Spencer [EMAIL PROTECTED] wrote: Matthias, When I changed my method getTimeZone() to return a TimeZone, things worked as expected. I guess my confusion comes from the TLD Documentation, http://myfaces.apache.org/impl/tlddoc/index.html. When this value is a value-binding to a TimeZone instance, that timezone is used. Otherwise this value is treated as a String containing a timezone id, ie as the ID parameter of method java.util.TimeZone.getTimeZone(String). I read this to mean that the converter would converter would treat String value-binding the same way as a String value. Below is a coded version of my expectation. if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); TimeZone timeZone; Object value = vb.getValue(facesContext); if (value instanceof TimeZone) { timeZone = (TimeZone) value; } else { timeZone = TimeZone.getTimeZone(value.toString()) } converter.setTimeZone(timeZone); } Is my expectation in keeping with the spec? If it is case should I enter a JIRA issue? Paul Spencer Paul Spencer wrote: The type is string public String getTimeZone() { return GMT-05:00; } Paul Spencer Matthias Wessendorf wrote: f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias -- Matthias Wessendorf Aechterhoek 18 48282 Emsdetten blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com
Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
Matthias I have entered the issue, http://issues.apache.org/jira/browse/MYFACES-1317, but I was not able to assign it to you. Thanks you, Paul Spencer Matthias Wessendorf wrote: Paul- good catch. You are right. RI TLD Doc says the same. Create a bug for MyFaces Core Jira project and asign the ticket please to me ! (matzew) Thanks, Matthias On 5/31/06, Paul Spencer [EMAIL PROTECTED] wrote: Matthias, When I changed my method getTimeZone() to return a TimeZone, things worked as expected. I guess my confusion comes from the TLD Documentation, http://myfaces.apache.org/impl/tlddoc/index.html. When this value is a value-binding to a TimeZone instance, that timezone is used. Otherwise this value is treated as a String containing a timezone id, ie as the ID parameter of method java.util.TimeZone.getTimeZone(String). I read this to mean that the converter would converter would treat String value-binding the same way as a String value. Below is a coded version of my expectation. if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); TimeZone timeZone; Object value = vb.getValue(facesContext); if (value instanceof TimeZone) { timeZone = (TimeZone) value; } else { timeZone = TimeZone.getTimeZone(value.toString()) } converter.setTimeZone(timeZone); } Is my expectation in keeping with the spec? If it is case should I enter a JIRA issue? Paul Spencer Paul Spencer wrote: The type is string public String getTimeZone() { return GMT-05:00; } Paul Spencer Matthias Wessendorf wrote: f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias
Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
Locale is same problem IMO Thanks! -Matthias On 5/31/06, Matthias Wessendorf [EMAIL PROTECTED] wrote: Paul- good catch. You are right. RI TLD Doc says the same. Create a bug for MyFaces Core Jira project and asign the ticket please to me ! (matzew) Thanks, Matthias On 5/31/06, Paul Spencer [EMAIL PROTECTED] wrote: Matthias, When I changed my method getTimeZone() to return a TimeZone, things worked as expected. I guess my confusion comes from the TLD Documentation, http://myfaces.apache.org/impl/tlddoc/index.html. When this value is a value-binding to a TimeZone instance, that timezone is used. Otherwise this value is treated as a String containing a timezone id, ie as the ID parameter of method java.util.TimeZone.getTimeZone(String). I read this to mean that the converter would converter would treat String value-binding the same way as a String value. Below is a coded version of my expectation. if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); TimeZone timeZone; Object value = vb.getValue(facesContext); if (value instanceof TimeZone) { timeZone = (TimeZone) value; } else { timeZone = TimeZone.getTimeZone(value.toString()) } converter.setTimeZone(timeZone); } Is my expectation in keeping with the spec? If it is case should I enter a JIRA issue? Paul Spencer Paul Spencer wrote: The type is string public String getTimeZone() { return GMT-05:00; } Paul Spencer Matthias Wessendorf wrote: f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias -- Matthias Wessendorf Aechterhoek 18 48282 Emsdetten blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com -- Matthias Wessendorf Aechterhoek 18 48282 Emsdetten blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com
Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
The type is string public String getTimeZone() { return GMT-05:00; } Paul Spencer Matthias Wessendorf wrote: f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias
Re: ClassCastException when setting timeZone attribute in f:convertDataTime using EL
Matthias I have entered the issue, http://issues.apache.org/jira/browse/MYFACES-1317, but I was not able to assign it to you. Thanks you, Paul Spencer Matthias Wessendorf wrote: Paul- good catch. You are right. RI TLD Doc says the same. Create a bug for MyFaces Core Jira project and asign the ticket please to me ! (matzew) Thanks, Matthias On 5/31/06, Paul Spencer [EMAIL PROTECTED] wrote: Matthias, When I changed my method getTimeZone() to return a TimeZone, things worked as expected. I guess my confusion comes from the TLD Documentation, http://myfaces.apache.org/impl/tlddoc/index.html. When this value is a value-binding to a TimeZone instance, that timezone is used. Otherwise this value is treated as a String containing a timezone id, ie as the ID parameter of method java.util.TimeZone.getTimeZone(String). I read this to mean that the converter would converter would treat String value-binding the same way as a String value. Below is a coded version of my expectation. if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); TimeZone timeZone; Object value = vb.getValue(facesContext); if (value instanceof TimeZone) { timeZone = (TimeZone) value; } else { timeZone = TimeZone.getTimeZone(value.toString()) } converter.setTimeZone(timeZone); } Is my expectation in keeping with the spec? If it is case should I enter a JIRA issue? Paul Spencer Paul Spencer wrote: The type is string public String getTimeZone() { return GMT-05:00; } Paul Spencer Matthias Wessendorf wrote: f:convertDateTime type=time timeZone=#{phrQueryManager.timeZone}/ Is this type of TimeZone ? *snip* if (UIComponentTag.isValueReference(value)) { ValueBinding vb = facesContext.getApplication().createValueBinding(value); converter.setTimeZone((TimeZone)vb.getValue(facesContext)); } *snip* Regards, Matthias