Announcement Announcement Module
Collapse
No announcement yet.
Null doubletrouble with bind Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Null doubletrouble with bind

    Code:
    17:18:30,343  INFO DelegationFormController:53 - Entering formBackingObject()...
    17:18:30,375 DEBUG DelegationFormController:104 - There are currently 1 delegations
    17:18:30,406 DEBUG DelegationFormController:115 - Putting existing object in the 'out' Map
    17:18:30,437 DEBUG DelegationFormController:116 - Existing Delegation: ks.rah.avik2.domain.Delegation@164de59[event: =2,
    delegate: =5,level: =─ndra] stored under key: ks.rah.avik2.domain.Function@27a
    17:18:30,453 DEBUG DelegationFormController:122 - The system encompasses 5 user-function pairs
    17:18:30,453 DEBUG DelegationFormController:136 - New Delegation object added to 'out'-map.
    17:18:30,468 DEBUG DelegationFormController:137 - New Delegation: ks.rah.avik2.domain.Delegation@dcdffc[event: =2,delega
    te: =1,level: =Inga rőttigheter] stored under key: 1
    17:18:30,468 DEBUG DelegationFormController:136 - New Delegation object added to 'out'-map.
    17:18:30,468 DEBUG DelegationFormController:137 - New Delegation: ks.rah.avik2.domain.Delegation@1064a6d[event: =2,deleg
    ate: =2,level: =Inga rőttigheter] stored under key: 2
    17:18:30,468 DEBUG DelegationFormController:136 - New Delegation object added to 'out'-map.
    17:18:30,468 DEBUG DelegationFormController:137 - New Delegation: ks.rah.avik2.domain.Delegation@5861[event: =2,delegate
    : =3,level: =Inga rőttigheter] stored under key: 3
    17:18:30,468 DEBUG DelegationFormController:136 - New Delegation object added to 'out'-map.
    17:18:30,468 DEBUG DelegationFormController:137 - New Delegation: ks.rah.avik2.domain.Delegation@aa559d[event: =2,delega
    te: =4,level: =Inga rőttigheter] stored under key: 4
    17:18:30,468 DEBUG DelegationFormController:142 - Size of 'out' before returning: 5
    17:18:30,468 DEBUG DelegationFormController:149 - ..and returning...
    17:18:30,484  INFO DelegationFormController:79 - Exiting formBackingObject()...
    17:18:30,484 ERROR DispatcherServlet:342 - Could not complete request
    org.springframework.beans.NullValueInNestedPathException: Invalid property 'delegations[2]' of bean class [ks.rah.avik2.
    web.form.DelegationForm]: Value of nested property 'delegations[2]' is null
            at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:479)
            at org.springframework.beans.BeanWrapperImpl.getBeanWrappersForNestedProperty(BeanWrapperImpl.java:458)
            at org.springframework.beans.BeanWrapperImpl.getBeanWrappersForPropertyPath(BeanWrapperImpl.java:441)
            at org.springframework.beans.BeanWrapperImpl.registerCustomEditor(BeanWrapperImpl.java:253)
            at org.springframework.validation.DataBinder.registerCustomEditor(DataBinder.java:184)
            at ks.rah.avik2.web.form.DelegationFormController.initBinder(DelegationFormController.java:188)
            at org.springframework.web.servlet.mvc.BaseCommandController.createBinder(BaseCommandController.java:325)
            at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:279)
            at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:
    240)
            at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:121)
            at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java
    :44)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:495)
            at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:321)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
            at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
            at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
            at java.lang.Thread.run(Thread.java:534)
    Debug trace printout from the execution of form controller. I know that the command object sent is OK.... so what can this be?

    Spring 1.1 RC2

    Form object
    Code:
    public class DelegationForm {
    
    	private Function function; //The function of the current user
    	private Map delegations; //All the delegation node objects per function in the system
    	
    	public DelegationForm(Function function){
    		this.function = function;
    	}
    	
    	public DelegationForm(){}
    	
    	public Function getFunction() { return (this.function); }
    	public void setFunction(Function function) { this.function = function; }
    	
    	public Map getDelegations() { return (this.delegations); }
    	public void setDelegations(Map delegations) { this.delegations = delegations; }			
    }
    initBinder method of form controller
    Code:
    protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) {
    		super.initBinder(request,binder);
    		//binder.setFieldMarkerPrefix("_radio.");
    		binder.registerCustomEditor(Delegation.class, "delegations.value", delegEditor);
    	}
    I'm really fed up with seeing that 'delegations[x]' is null, because I wrap the Delegation object in

    Code:
    public class DelegationWrapper {
    	
    	private Delegation value;
    
    	public DelegationWrapper(Delegation value) {
    		this.value = value;
    	}
    	
    	public Delegation getValue() { return (this.value); }
    	public void setValue(Delegation value) { this.value = value; }
    	
    }
    so the bind method shouldn't bother with the map whatsoever.

    I've understood that binding to a Map is not supported. But if you bind to an object IN a Map? Shouldn't this work?
Working...
X