[MAGNOLIA-5031] MetaData.getLastActionDate() throws NullPointerException when lastaction property does not exist. Created: 14/May/13 Updated: 28/May/14 Resolved: 27/May/14 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | core |
| Affects Version/s: | 4.5.8 |
| Fix Version/s: | 4.5.20 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Charles Jones | Assignee: | Karel Nedoma |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | maintenance, trivial | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
| Date of First Response: |
| Description |
|
MetaData.getLastActionDate() throws NullPointerException when lastaction property does not exist. This is probably true for other properties as well. The exception is being thrown in DelegatePropertyWrapper, implying that the property wrapper is wrapping a null property. I don't understand the purpose or use of the property wrappers well enough to know what the proper fix is. Partial Stack trace Caused by: java.lang.NullPointerException at info.magnolia.jcr.wrapper.DelegatePropertyWrapper.getDate(DelegatePropertyWrapper.java:193) at info.magnolia.cms.core.MetaData.getDateProperty(MetaData.java:420) at info.magnolia.cms.core.MetaData.getLastActionDate(MetaData.java:255) at org.apache.jsp.templates.gato.includes.meta_jsp._jspService(meta_jsp.java:91) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at info.magnolia.cms.filters.MgnlFilterDispatcher.doDispatch(MgnlFilterDispatcher.java:75) at info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:108) at info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:94) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488) at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:296) at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:161) at org.apache.jsp.templates.gato.main_002d2009.includes.head_002dcommon_jsp._jspx_meth_c_005fimport_005f1(head_002dcommon_jsp.java:196) at org.apache.jsp.templates.gato.main_002d2009.includes.head_002dcommon_jsp._jspService(head_002dcommon_jsp.java:80) ... 188 more |
| Comments |
| Comment by Karel Nedoma [ 23/May/14 ] |
|
I could not find any problem with trowing NullPointerException |
| Comment by Roman Kovařík [ 23/May/14 ] |
|
The problem here is not in MetaData class but in the DelegatePropertyWrapper. It's probably possible to wrap a null property (this.wrapped = null) according to the stack trace above. |
| Comment by Jan Haderka [ 23/May/14 ] |
|
Come on, it is trivial. Inside the wrapper, Check if getWrappedProperty() returns null and if so, return null too ... or throw INFE ... whichever jcr spec mandates. |
| Comment by Roman Kovařík [ 27/May/14 ] |
|