Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: Release 1.5.1
-
Fix Version/s: Release 1.5.2, Release 1.6
-
Component/s: Context Management
-
Labels:None
-
Environment:java 1.6
Description
If I use the built in toString and subclass ActionBeanContext, when I log the ActionBeanContext I get
DEBUG: 10:44:14,021: com.objecteffects.sample.web.action.TestStartActionBean.submitTest(TestStartActionBean.java:77): context: ActionBeanContext{eventName='submit', validationErrors={}}
But it's telling me that it's the wrong class. My ActionBeanContext subclasses my abstract BaseActionBeanContext;
class StartActionBeanContextFake extends BaseActionBeanContext {
When I add toString to my BaseActionBeanContext:
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
...
@Override
public String toString() {
return (new ReflectionToStringBuilder(this).toString());
}
Then the log message shows the correct class:
DEBUG: 10:48:34,460: com.objecteffects.sample.web.action.TestStartActionBean.submitTest(TestStartActionBean.java:77): context: com.objecteffects.sample.web.action.StartActionBeanContextFake@4865ce[desiredDate=com.objecteffects.sample.domain.DesiredDate@d3c6a3[year=2009,month=2,day=3],request=net.sourceforge.stripes.controller.StripesRequestWrapper@1d95da8,response=net.sourceforge.stripes.mock.MockHttpServletResponse@193f6e2,servletContext=net.sourceforge.stripes.mock.MockServletContext@1385660,eventName=submit,validationErrors={}]
This is important when you're testing and you need to be sure that the correct ActionBeanContext class was used.
Fixed in revision 1147. However I did not use commons-lang as to not introduce a dependency to it. But at least toString() will display your class name.