Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
None
Description
If you now have something like:
<c:if test="${hst:isReadable(document, 'address.street')}">
<h2>${document.address.street}</h2>
</c:if>
this test returns true if the current document has a getAddress, and the returned object has a getStreet. However, if document has a getAddress but the returned object is null, then we get an NPE. It is much easier if instead of the NPE, we get false back. We should hook into the org.apache.commons.beanutils.PropertyUtilsBean and override this, or extend the class and catch the NestedNullException exception.
[WARNING] [talledLocalContainer] org.apache.commons.beanutils.NestedNullException: Null property value for 'address' on bean class 'class com.now.beans.NewsDocument'
[WARNING] [talledLocalContainer] at org.apache.commons.beanutils.PropertyUtilsBean.isReadable(PropertyUtilsBean.java:1400)
[WARNING] [talledLocalContainer] at org.apache.commons.beanutils.PropertyUtils.isReadable(PropertyUtils.java:652)
[WARNING] [talledLocalContainer] at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
[WARNING] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[WARNING] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:597)
[WARNING] [talledLocalContainer] at org.apache.el.parser.AstFunction.getValue(AstFunction.java:110)
[WARNING] [talledLocalContainer] at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
[WARNING] [talledLocalContainer] at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:938)
[WARNING] [talledLocalContainer] at org.apache.jsp.WEB_002dINF.jsp.news.main.content_jsp._jspx_meth_c_005fif_005f1(content_jsp.java:293)
[WARNING] [talledLocalContainer] at org.apache.jsp.WEB_002dINF.jsp.news.main.content_jsp._jspService(content_jsp.java:159)
[WARNING] [talledLocalContainer] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
[WARNING] [talledLocalContainer] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
[WARNING] [talledLocalContainer] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
[WARNING] [talledLocalContainer] at org.apache.jasper.servlet.JspServlet._serviceJspFile(JspServlet.java:313)
[WARNING] [talledLocalContainer] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java)
[WARNING] [talledLocalContainer] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
[WARNING] [talledLocalContainer] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
[WARNING] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
[WARNING] [talledLocalContainer] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
[WARNING] [talledLocalContainer] at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
[WARNING] [talledLocalContainer] at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
[WARNING] [talledLocalContainer] at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
[WARNING] [talledLocalContainer] at org.hippoecm.hst.core.container.HstComponentInvokerImpl.invokeDispatcher(HstComponentInvokerImpl.java:414)
[WARNING] [talledLocalContainer] at org.hippoecm.hst.core.container.HstComponentInvokerImpl.invokeRender(HstComponentInvokerImpl.java:218)
[WARNING] [talledLocalContainer] at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
[WARNING] [talledLocalContainer] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[WARNING] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:597)
[WARNING] [talledLocalContainer] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
[WARNING] [talledLocalContainer] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)