Skip to content
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

b:inputText null object not working till 3rd level #851

Closed
Tobias5 opened this issue Aug 29, 2017 · 6 comments
Closed

b:inputText null object not working till 3rd level #851

Tobias5 opened this issue Aug 29, 2017 · 6 comments
Assignees
Milestone

Comments

@Tobias5
Copy link

Tobias5 commented Aug 29, 2017

Hi,
please see the following example:

<b:inputText id="terminologyId" value="#{allowedTerminologiesBean.terminologyToEdit.terminologyKey.terminologyId}"/>

The "terminologyToEdit" is null.

With h:inputText it is working fine. It also works if I remove the last field, but sure, that is not what I need:

<b:inputText id="terminologyId" value="#{allowedTerminologiesBean.terminologyToEdit.terminologyKey}"/>

But it seems to be dependent on the level of accessing fields.

The following exception is thrown:

10:17:13,439 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-66) Error Rendering View[/apps/npr/releasemanager/AllowedTerminologies.xhtml]: javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null
	at com.sun.el.parser.AstValue.getTarget(AstValue.java:191)
	at com.sun.el.parser.AstValue.getValueReference(AstValue.java:100)
	at com.sun.el.ValueExpressionImpl.getValueReference(ValueExpressionImpl.java:213)
	at org.jboss.weld.util.el.ForwardingValueExpression.getValueReference(ForwardingValueExpression.java:86)
	at org.jboss.weld.util.el.ForwardingValueExpression.getValueReference(ForwardingValueExpression.java:86)
	at net.bootsfaces.beans.ELTools.evalAsObject(ELTools.java:120)
	at net.bootsfaces.beans.ELTools.getField(ELTools.java:202)
	at net.bootsfaces.beans.ELTools.readAnnotations(ELTools.java:354)
	at net.bootsfaces.beans.ELTools.readAnnotations(ELTools.java:376)
	at net.bootsfaces.render.CoreRenderer.getErrorAndRequiredClass(CoreRenderer.java:187)
	at net.bootsfaces.component.inputText.InputTextRenderer.generateStyleClass(InputTextRenderer.java:472)
	at net.bootsfaces.component.inputText.InputTextRenderer.encodeEnd(InputTextRenderer.java:211)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:920)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
	at org.omnifaces.viewhandler.OmniViewHandler.renderView(OmniViewHandler.java:119)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
	at io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
	at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

10:17:13,448 ERROR [io.undertow.request] (default task-66) UT005023: Exception handling request to /NewTools/apps/npr/releasemanager/AllowedTerminologies.xhtml: javax.servlet.ServletException: Target Unreachable, 'null' returned null
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
	at io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
	at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null
	at com.sun.el.parser.AstValue.getTarget(AstValue.java:191)
	at com.sun.el.parser.AstValue.getValueReference(AstValue.java:100)
	at com.sun.el.ValueExpressionImpl.getValueReference(ValueExpressionImpl.java:213)
	at org.jboss.weld.util.el.ForwardingValueExpression.getValueReference(ForwardingValueExpression.java:86)
	at org.jboss.weld.util.el.ForwardingValueExpression.getValueReference(ForwardingValueExpression.java:86)
	at net.bootsfaces.beans.ELTools.evalAsObject(ELTools.java:120)
	at net.bootsfaces.beans.ELTools.getField(ELTools.java:202)
	at net.bootsfaces.beans.ELTools.readAnnotations(ELTools.java:354)
	at net.bootsfaces.beans.ELTools.readAnnotations(ELTools.java:376)
	at net.bootsfaces.render.CoreRenderer.getErrorAndRequiredClass(CoreRenderer.java:187)
	at net.bootsfaces.component.inputText.InputTextRenderer.generateStyleClass(InputTextRenderer.java:472)
	at net.bootsfaces.component.inputText.InputTextRenderer.encodeEnd(InputTextRenderer.java:211)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:920)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
	at org.omnifaces.viewhandler.OmniViewHandler.renderView(OmniViewHandler.java:119)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
	... 41 more

Regards,
Tobias

@stephanrauh
Copy link
Collaborator

BootsFaces tries to read the JSF303 annotations. That's only possible if the field is not null. Do you really need it to be null?

@Tobias5
Copy link
Author

Tobias5 commented Aug 30, 2017

Thanks for the information, that makes sense. So no bug but a feature?
I have to restructure my code to avoid that exception. I have a modal to edit/modify an existing object that was selected by the user. If there is no selected object, it's not displayed and the objects are null.

@stephanrauh
Copy link
Collaborator

I wouldn't call the bug a feature, but it's caused by a feature. Until now, we got away with it. If more people vote for avoiding the NPE, we'd certainly do so.

@ggam
Copy link
Collaborator

ggam commented Aug 30, 2017 via email

@stephanrauh stephanrauh changed the title b:inputBox null object not working till 3rd level b:inputText null object not working till 3rd level Sep 2, 2017
stephanrauh added a commit that referenced this issue Sep 2, 2017
stephanrauh added a commit that referenced this issue Sep 2, 2017
stephanrauh added a commit that referenced this issue Sep 2, 2017
@stephanrauh
Copy link
Collaborator

As a side-effect of #846, I've been able to solve this ticket, too. I've uploaded a new developer snapshot of BootsFaces 1.2.0 to Maven Central. See #369 on how to get it.

Please test if your bug is fixed by this update and report back.

Thanks in advance!
Stephan

@stephanrauh stephanrauh added this to the v1.2.0 milestone Sep 2, 2017
@ggam
Copy link
Collaborator

ggam commented Sep 2, 2017

Great @stephanrauh thanks!

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

No branches or pull requests

3 participants