[ 
https://issues.apache.org/jira/browse/MYFACES-4655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17827039#comment-17827039
 ] 

Nicola Isotta edited comment on MYFACES-4655 at 3/14/24 10:36 AM:
------------------------------------------------------------------

Reproducer attached. Needs Java 17 bc of Jetty 12.

To run with Mojarra:
{noformat}
mvn jetty:run -Pmojarra40{noformat}
 for MyFaces:
{noformat}
mvn jetty:run -Pmyfaces40{noformat}
 

Seems like MyFaces can't find the validator if the value attribute isn's 
specified:
{code:java}
@FacesValidator(managed = true)
public class MyCdiValidator implements Validator {{code}
according to the specs it should default to class.getSimpleName()

 


was (Author: nicolaisotta):
Reproducer attached. Needs Java 17 bc of Jetty 12.

To run: 
{noformat}
mvn jetty:run -Pmojarra40{noformat}
 for mojarra and 
{noformat}
mvn jetty:run -Pmyfaces40{noformat}
for Myfaces

Seems like MyFaces can't find the validator if the value attribute isn's 
specified:
{code:java}
@FacesValidator(managed = true)
public class MyCdiValidator implements Validator {{code}
according to the specs it should default to class.getSimpleName()

 

> NPE in FacesValidatorCDIWrapper
> -------------------------------
>
>                 Key: MYFACES-4655
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4655
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 4.0.2
>         Environment: Eclipse Adoptium jdk-11.0.14.101-hotspot
> Apache Tomcat 10.1.2
> MyFaces 4.0.2
> Weld 4.0.3.Final
>            Reporter: Nicola Isotta
>            Priority: Major
>             Fix For: 5.0.0, 4.1.0-RC2, 4.0.3
>
>         Attachments: primefaces-test.zip
>
>
> I'm moving one application from Mojarra to MyFaces.
> One of the page fails on submit because of a NullPointerException in 
> FacesValidatorCDIWrapper.
> Debugging I found out it happens on a validator attached to a composite 
> component using the for attribute.
> I'll try to arrange a standalone reproducer, meanwhile here's the stack trace:
> {code:java}
> java.lang.NullPointerException: null
>     at 
> org.apache.myfaces.cdi.wrapper.FacesValidatorCDIWrapper.validate(FacesValidatorCDIWrapper.java:59)
>  ~[myfaces-impl-4.0.2.jar:4.0.2]
>     at 
> org.apache.myfaces.core.api.shared.ComponentUtils.callValidators(ComponentUtils.java:245)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at jakarta.faces.component.UIInput.validateValue(UIInput.java:463) 
> ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UISelectOne.validateValue(UISelectOne.java:166) 
> ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> org.primefaces.component.selectonemenu.SelectOneMenu.validateValue(SelectOneMenu.java:197)
>  ~[primefaces-13.0.7-jakarta.jar:13.0.7]
>     at jakarta.faces.component.UIInput.validate(UIInput.java:717) 
> ~[myfaces-api-4.0.2.jar:4.0.2]
>     at jakarta.faces.component.UIInput.processValidators(UIInput.java:297) 
> ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UISelectOne.processValidators(UISelectOne.java:116) 
> ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1379)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1372)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1379)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1379)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at jakarta.faces.component.UIForm.processValidators(UIForm.java:200) 
> ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1379)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1379)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIViewRoot._processValidatorsDefault(UIViewRoot.java:1758)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIViewRoot$ProcessValidatorPhaseProcessor.process(UIViewRoot.java:1866)
>  ~[myfaces-api-4.0.2.jar:4.0.2]
>     at jakarta.faces.component.UIViewRoot._process(UIViewRoot.java:1714) 
> ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> jakarta.faces.component.UIViewRoot.processValidators(UIViewRoot.java:972) 
> ~[myfaces-api-4.0.2.jar:4.0.2]
>     at 
> org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:39)
>  ~[myfaces-impl-4.0.2.jar:4.0.2]
>     at 
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:172)
>  [myfaces-impl-4.0.2.jar:4.0.2]
>     at 
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:125) 
> [myfaces-impl-4.0.2.jar:4.0.2]
>     at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:223) 
> [myfaces-api-4.0.2.jar:4.0.2] {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to