New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

o:validateBean throws NullPointerException if an Input field is conditionally rendered on the form with EL #150

Closed
exabrial opened this Issue Jul 15, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@exabrial

exabrial commented Jul 15, 2015

If you have an inputField on your form that's conditionally rendered using EL, o:validateBean will toss an NPE.

Easiest fix I came up with is to do additional null checks inside that method, but there's probably a better way to just check if the component is even rendered first.

            <b:inputText
                id="readOnlyStateInputText"
                value="#{leadMB.lead.findResidenceState()}"
                disabled="true"
                label="State"
                rendered="#{leadMB.lead.findResidenceState() ne null}" />
                                <b:buttonGroup id="pageActionsButtonGroup">
                                    <h:commandButton
                                        id="updateLeadCommandButton"
                                        styleClass="btn btn-default"
                                        action="#{leadMB.updateLead}"
                                        value="Save Changes to Lead"
                                        disabled="#{!leadMB.leadEditMode and leadMB.newLeadNote eq null
                                    and empty leadMB.quotesBeingEdited 
                                    and empty leadMB.policiesBeingEdited and empty leadMB.phonesBeingEdited
                                    and empty leadMB.addressesBeingEdited and empty leadMB.emailsBeingEdited}">
                                        <f:ajax
                                            event="click"
                                            execute="@form"
                                            render="@form" />
                                        <o:validateBean
                                            value="#{leadMB.lead}"
                                            validationGroups="com.xxx.shp.validation.ShpUserValidationGroup" />
                                    </h:commandButton>
Caused by: java.lang.NullPointerException: null
    at org.omnifaces.taghandler.ValidateBean$6.invoke(ValidateBean.java:333) ~[omnifaces-2.1.jar:2.1]
    at org.omnifaces.taghandler.ValidateBean$6.invoke(ValidateBean.java:326) ~[omnifaces-2.1.jar:2.1]
    at org.omnifaces.util.Components$ForEach$1.visit(Components.java:492) ~[omnifaces-2.1.jar:2.1]
    at org.omnifaces.util.Components$ForEach$TypesVisitCallback.visit(Components.java:557) ~[omnifaces-2.1.jar:2.1]
    at org.apache.myfaces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:141) ~[myfaces-impl-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1016) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1044) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1191) ~[myfaces-api-2.2.8.jar:2.2.8]
    at javax.faces.component.UIForm.visitTree(UIForm.java:345) ~[myfaces-api-2.2.8.jar:2.2.8]
    at org.omnifaces.util.Components$ForEach.invoke(Components.java:525) ~[omnifaces-2.1.jar:2.1]
    at org.omnifaces.util.Components$ForEach.invoke(Components.java:489) ~[omnifaces-2.1.jar:2.1]
    at org.omnifaces.taghandler.ValidateBean.forEachInputWithMatchingBase(ValidateBean.java:326) ~[omnifaces-2.1.jar:2.1]
    at org.omnifaces.taghandler.ValidateBean.access$400(ValidateBean.java:151) ~[omnifaces-2.1.jar:2.1]
    at org.omnifaces.taghandler.ValidateBean$3.run(ValidateBean.java:286) ~[omnifaces-2.1.jar:2.1]
    at org.omnifaces.taghandler.ValidateBean$ValidateBeanCallback.invoke(ValidateBean.java:430) ~[omnifaces-2.1.jar:2.1]
    ... 43 common frames omitted
@BalusC

This comment has been minimized.

Show comment
Hide comment
@BalusC

BalusC Aug 10, 2015

Member

Can you please try today's snapshot to see if that fixes the current problem? (and probably also indirectly #152 — if that doesn't, then we'd still like to see a reproducer for 152)

Member

BalusC commented Aug 10, 2015

Can you please try today's snapshot to see if that fixes the current problem? (and probably also indirectly #152 — if that doesn't, then we'd still like to see a reproducer for 152)

@BalusC

This comment has been minimized.

Show comment
Hide comment
@BalusC

BalusC Aug 30, 2015

Member

Any feedback?

Member

BalusC commented Aug 30, 2015

Any feedback?

@exabrial

This comment has been minimized.

Show comment
Hide comment
@exabrial

exabrial Aug 31, 2015

We've been running our patch :) I'll try yours and get back to you

exabrial commented Aug 31, 2015

We've been running our patch :) I'll try yours and get back to you

@exabrial

This comment has been minimized.

Show comment
Hide comment
@exabrial

exabrial Sep 16, 2015

Seems to be fixed. Thanks!

exabrial commented Sep 16, 2015

Seems to be fixed. Thanks!

@BalusC BalusC added the bug label Oct 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment