« Return to Thread: NullPointerException in UIComponentBase decode using Shale test framework

NullPointerException in UIComponentBase decode using Shale test framework

by Zhen, Jane :: Rate this Message:

Reply to Author | View in Thread

I simply created a Form and inside an inputTextField and tried to do decoding. But I got a java.lang.NullPointerException

at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:685)

at javax.faces.component.UIInput.decode(UIInput.java:484)

at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:905)

at javax.faces.component.UIInput.processDecodes(UIInput.java:400)

at com.hp.ed.configui.credential.CredentialBeanTest.testLabelUpdate(CredentialBeanTest.java:70)



This has happened before, but I couldn't find an answer for that. I'm just giving it another try, as Shale test framework is really not well documented.



<<Code segment>>

UIViewRoot root=facesContext.getViewRoot();

List<UIComponent> children = root.getChildren();

UIForm credForm = new HtmlForm();

credForm.setId("credForm");

credForm.setParent(root);



UIInput label = new HtmlInputText();

label.setId("label");

label.setParent(credForm);

ValueBinding vb = facesContext.getApplication().createValueBinding("#{credentialBean.passwordAgain}");

label.setValueBinding("value", vb);



facesContext.getExternalContext().getRequestMap().put("credentialBean", vc);

facesContext.getExternalContext().getRequestParameterMap().put("credForm.label","myLabel");

label.processDecodes(facesContext);  //if I don't call label.processDecodes, but root.processDecodes, then I don't get the exception, however, the submittedValue of inputText is null.



thanks for any help



Jane

 « Return to Thread: NullPointerException in UIComponentBase decode using Shale test framework

LightInTheBox - Buy quality products at wholesale price!