Jane,

Can you give us a full stack trace (not sure which line threw the exception)
and the snippet of code where you initialize the components that you're
testing? I'm guessing that you just didn't initialize the components
properly -- Shale Test leaves that all up to the developer.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
phone: +1 203-653-2989
fax: +1 203-653-2988


> -----Original Message-----
> From: Zhen, Jane [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 15, 2008 9:22 AM
> To: user@shale.apache.org
> Subject: NullPointerException in UIComponentBase decode using Shale
> test framework
> 
> 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.ja
> va:905)
> 
> at javax.faces.component.UIInput.processDecodes(UIInput.java:400)
> 
> at
> com.hp.ed.configui.credential.CredentialBeanTest.testLabelUpdate(Creden
> tialBeanTest.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.pass
> wordAgain}");
> 
> label.setValueBinding("value", vb);
> 
> 
> 
> facesContext.getExternalContext().getRequestMap().put("credentialBean",
> vc);
> 
> facesContext.getExternalContext().getRequestParameterMap().put("credFor
> m.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

Reply via email to