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

<f:validateWholeBean> broken when referencing a bean property #4313

Closed
BalusC opened this Issue Dec 20, 2017 · 3 comments

Comments

Projects
None yet
1 participant
@BalusC
Collaborator

BalusC commented Dec 20, 2017

<f:validateWholeBean> works fine when used directly on a managed bean as documented.

<f:validateWholeBean value="#{backingBean}" />

However, it fails when used on a managed bean property.

<f:validateWholeBean value="#{backingBean.someEntity}" />

EL will throw the following exception:

Caused by: java.lang.IllegalArgumentException: Cannot convert com.sun.faces.ext.validateWholeBean of type class java.lang.String to class com.example.model.SomeEntity
	at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:428)
	at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:382)
	at com.sun.el.parser.AstValue.setValue(AstValue.java:248)
	at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:294)
	at org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:64)
	at org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:64)
	at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:137)
	at javax.faces.component.UIInput.updateModel(UIInput.java:883)
	... 53 more

It turns out that <f:validateWholeBean> unintentionally executes the update model values phase as well. This has to be skipped in UIValidateWholeBean.

@BalusC

This comment has been minimized.

Collaborator

BalusC commented Dec 20, 2017

Work around for now:

<f:validateWholeBean value="#{backingBean.someEntity}" rendered="#{facesContext.currentPhaseId.ordinal ne 4}" />
@BalusC

This comment has been minimized.

Collaborator

BalusC commented Jan 28, 2018

To do: add unit test.

BalusC added a commit that referenced this issue Feb 11, 2018

@BalusC

This comment has been minimized.

Collaborator

BalusC commented Feb 11, 2018

IT has been added

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