Scott:
Thanks for your reply. The exception is coming from a custom tag library that I use for scheduling. This code works fine in v3.2.7 but not in v4.0.1. I tried several different combinations in the 'properties-service.xml' file, all of which generated mbean errors.
I don't have a clue as to what should be used here. Is the a way to disable the default date parser?
Any help would be appreciated.
Thanks,
Jack
org.jboss.util.NestedRuntimeException: Unparseable date: "Mon Dec 27 16:49:16 PST 2004";
- nested throwable: (java.text.ParseException: Unparseable date: "Mon Dec 27 16:49:16 PST
2004")
org.jboss.util.propertyeditor.DateEditor.getValue(DateEditor.java:42)
org.apache.taglibs.standard.lang.jstl.Coercions.coerceToObject(Unknown
Source)
org.apache.taglibs.standard.lang.jstl.Coercions.coerce(Unknown Source)
org.apache.taglibs.standard.lang.jstl.ELEvaluator.convertStaticValueToExpectedType(Unknown
Source)
org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(Unknown
Source)
org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(Unknown
Source)
org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Unknown Source)
org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Unknown Source)
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(Unknown
Source)
com.nwc.tags.DateSelectTag.doEndTag(DateSelectTag.java:120)<--- CODE SNIP --->
public int doEndTag() throws JspException {
/*
* Evaluate the EL expression, if any
*/
Integer days = (Integer) ExpressionEvaluatorManager.evaluate("days", daysEL, Integer.class, this, pageContext);
<<< THIS IS THE LINE THAT THROWS THE EXCEPTION >>>
java.util.Date attribSelect = (java.util.Date) ExpressionEvaluatorManager.evaluate("select", selectEL, java.util.Date.class, this, pageContext);
String name = (String) ExpressionEvaluatorManager.evaluate("name", nameEL, String.class, this, pageContext);
String expires = (String) ExpressionEvaluatorManager.evaluate("expires", expiresEL, String.class, this, pageContext);
Calendar now = Calendar.getInstance(); now.set(Calendar.HOUR_OF_DAY, 0); now.set(Calendar.MINUTE, 0); now.set(Calendar.SECOND, 0); now.set(Calendar.MILLISECOND, 0);
SimpleDateFormat displayFormat = new SimpleDateFormat("MMM dd (EE)");
SimpleDateFormat valueFormat = new SimpleDateFormat("MMMddyyyy");HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
try {
JspWriter out = pageContext.getOut();
out.write("<SELECT NAME=\"" + name + "\">");
java.util.Date today = valueFormat.parse(valueFormat.format(now.getTime()));
java.util.Date select = null;
if (attribSelect == null) {
Calendar invalid = Calendar.getInstance();
invalid.set(Calendar.HOUR_OF_DAY, 0);
invalid.set(Calendar.MINUTE, 0);
invalid.set(Calendar.SECOND, 0);
invalid.set(Calendar.MILLISECOND, 0);
invalid.set(Calendar.DAY_OF_YEAR, invalid.get(Calendar.DAY_OF_YEAR) + days.intValue() + 1);
select = valueFormat.parse(valueFormat.format(invalid.getTime()));
} else {
select = valueFormat.parse(valueFormat.format(attribSelect));
}
if (select.before(today)) {
if (expires.equals("yes")) {
out.write("<OPTION SELECTED CLASS=\"red\" VALUE=\"" + valueFormat.format(select) + "\">Expired</OPTION>");
} else {
out.write("<OPTION SELECTED VALUE=\"" + valueFormat.format(select) + "\">" + displayFormat.format(select) + "</OPTION>");
}
}
<--- END CODE SNIP --->
[EMAIL PROTECTED] wrote:
Apparently the new version is using java bean property editors for the string conversion, and jboss installs its own date property editor. This is simply doing the following:
| public Object getValue()
| {
| try | {
| DateFormat df = DateFormat.getDateInstance();
| return df.parse(getAsText());
| }
| catch (ParseException e)
| {
| throw new NestedRuntimeException(e);
| }
| }
|
This is using the locale default format parser, which is not very flexible. You can use the properties-service.xml PropertyEditorManagerService to
| <mbean code="org.jboss.varia.property.PropertyEditorManagerService"
| name="jboss:type=Service,name=PropertyEditorManager">
| | <!--
| | Register and editor for each of the type_name=editor_type_name listed
| | in properties file style convetion.
| -->
| <attribute name="Editors">
| java.util.Date=my.project.editors.DateEditor
| </attribute>
| | </mbean>
|
Presumably there is a DateEditor in the jstl release that should be used.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3859637#3859637
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3859637
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user
