Context supplied through convertValue to custom converter is missing many key-value pairs (including
ServletContext)
--------------------------------------------------------------------------------------------------------------------
Key: WW-3040
URL: https://issues.apache.org/struts/browse/WW-3040
Project: Struts 2
Issue Type: Bug
Affects Versions: 2.1.6
Environment: Windows Vista x64, Tomcat 6.0.18, Eclipse 3.4.1
Reporter: Nikos Andreou
I recently upgraded from Struts 2.0.11 to 2.1.6. I had a custom date converter class. In the
convertValue method, I had the code:
ServletContext servletContext = (ServletContext) context.get(StrutsStatics.SERVLET_CONTEXT);
I was getting the servletContext and I was reading a param where I had my date pattern.
With 2.0.11, the above code returns the servletContext. With 2.1.6, I get null. Basically,
the difference in the context provided through
public Object convertValue(Map context, Object value, Class toType) {}
is this:
2.0.11
---------
Key= com.opensymphony.xwork2.dispatcher.HttpServletRequest Value= org.apache.struts2.dispatcher.StrutsRequestWrapper@196232
Key= com.opensymphony.xwork2.ActionContext.locale Value= en_US
Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
Key= com.opensymphony.xwork2.dispatcher.HttpServletResponse Value= org.apache.catalina.connector.ResponseFacade@7dde6a
Key= com.opensymphony.xwork2.ActionContext.name Value= Transaction2
Key= com.opensymphony.xwork2.ActionContext.application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be,
blah-blah, datePattern=yyyy-MM-dd}
Key= last.property.accessed Value= null
Key= com.opensymphony.xwork2.dispatcher.ServletContext Value= org.apache.catalina.core.ApplicationContextFacade@11656b
Key= request Value= {struts.valueStack=com.opensymphony.xwork2.util.OgnlValueStack@13fb657}
Key= last.bean.accessed Value= null
Key= parameters Value= {amount=[Ljava.lang.String;@1dc0b6b, transactionType=[Ljava.lang.String;@171c4b5,
accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
Key= __link Value= [Ljava.lang.Object;@14e518
Key= application Value= {org.apache.catalina.WELCOME_FILES=[Ljava.lang.String;@2a38be,
blah-blah, datePattern=yyyy-MM-dd}
Key= xwork.NullHandler.createNullObjects Value= true
Key= current.property.path Value= null
Key= conversion.property.fullName Value= transactionDate
Key= attr Value= org.apache.struts2.util.AttributeMap@1cca665
Key= com.opensymphony.xwork2.ActionContext.session Value= {}
Key= com.opensymphony.xwork2.ActionContext.actionInvocation Value= com.opensymphony.xwork2.DefaultActionInvocation@c03c11
Key= com.opensymphony.xwork2.util.ValueStack.ValueStack Value= com.opensymphony.xwork2.util.OgnlValueStack@13fb657
Key= session Value= {}
Key= xwork.MethodAccessor.denyMethodExecution Value= true
Key= report.conversion.errors Value= true
Key= struts.actionMapping Value= org.apache.struts2.dispatcher.mapper.ActionMapping@a79811
Key= com.opensymphony.xwork2.ActionContext.parameters Value= {amount=[Ljava.lang.String;@1dc0b6b,
transactionType=[Ljava.lang.String;@171c4b5, accountId=[Ljava.lang.String;@2975fa, transactionDate=[Ljava.lang.String;@754c}
2.1.6
-------
Key= com.opensymphony.xwork2.util.ValueStack.ReportErrorsOnNoProp Value= true
Key= xwork.NullHandler.createNullObjects Value= true
Key= current.property.path Value= null
Key= conversion.property.fullName Value= transactionDate
Key= last.property.accessed Value= null
Key= report.conversion.errors Value= true
Key= xwork.MethodAccessor.denyMethodExecution Value= true
Key= last.bean.accessed Value= null
Most key-value pairs are missing and at the moment my code fails to work and I get an exception.
I am wondering if this is a known issue and whether there is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|