Description

When a user is creating or editing a Detail Template, they are able to duplicate an entry field and save the definition. However after saving it, when the user attempts to edit the template a Null Pointer Exception is thrown as the fields do not exist in the original list. This field should therefore be disabled when creating and editing templates.

Steps to reproduce:

Go to -> Control Panel

Click Dynamic Data Lists

Click Manage Data Definitions

Click Actions -> Manage Templates near To Do

Click Add Detail Template

Enter a Name

Click the Assigned To field

Click the Duplicate Icon

Click Save

Click Actions -> Edit

No fields are displayed and an error is thrown in the console

23:11:36,355 ERROR [IncludeTag:426] Current URL /group/control_panel/manage?p_p_id=166&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&doAsGroupId=10180&_166_struts_action=%2Fdynamic_data_mapping%2Fedit_template&_166_redirect=http%3A%2F%2Flocalhost%3A8080%2Fgroup%2Fcontrol_panel%2Fmanage%3Fp_p_id%3D166%26p_p_lifecycle%3D0%26p_p_state%3Dpop_up%26p_p_mode%3Dview%26doAsGroupId%3D10180%26_166_chooseCallback%3D%26_166_ddmResource%3Dcom.liferay.portlet.dynamicdatalists%26_166_saveCallback%3D%26_166_scopeAvailableFields%3DLiferay.FormBuilder.AVAILABLE_FIELDS.DDM_STRUCTURE%26_166_scopeStorageType%3Dxml%26_166_scopeStructureName%3Ddata-definition%26_166_scopeStructureType%3Dcom.liferay.portlet.dynamicdatalists.model.DDLRecordSet%26_166_scopeTemplateMode%3D%26_166_scopeTemplateType%3D%26_166_templateHeaderTitle%3D%26_166_backURL%3Dhttp%253A%252F%252Flocalhost%253A8080%252Fgroup%252Fcontrol_panel%252Fmanage%253Fp_p_id%253D166%2526p_p_lifecycle%253D0%2526p_p_state%253Dpop_up%2526p_p_mode%253Dview%2526doAsGroupId%253D10180%2526_166_chooseCallback%253D%2526_166_ddmResource%253Dcom.liferay.portlet.dynamicdatalists%2526_166_saveCallback%253D%2526_166_scopeAvailableFields%253DLiferay.FormBuilder.AVAILABLE_FIELDS.DDM_STRUCTURE%2526_166_scopeStorageType%253Dxml%2526_166_scopeStructureName%253Ddata-definition%2526_166_scopeStructureType%253Dcom.liferay.portlet.dynamicdatalists.model.DDLRecordSet%2526_166_scopeTemplateMode%253D%2526_166_scopeTemplateType%253D%2526_166_templateHeaderTitle%253D%2526_166_templateId%253D%2526_166_doAsGroupId%253D10180%2526_166_structureId%253D%2526_166_struts_action%253D%25252Fdynamic_data_mapping%25252Fview%26_166_structureId%3D10408%26_166_doAsGroupId%3D10180%26_166_struts_action%3D%252Fdynamic_data_mapping%252Fview_template&_166_backURL=http%3A%2F%2Flocalhost%3A8080%2Fgroup%2Fcontrol_panel%2Fmanage%3Fp_p_id%3D166%26p_p_lifecycle%3D0%26p_p_state%3Dpop_up%26p_p_mode%3Dview%26doAsGroupId%3D10180%26_166_chooseCallback%3D%26_166_ddmResource%3Dcom.liferay.portlet.dynamicdatalists%26_166_saveCallback%3D%26_166_scopeAvailableFields%3DLiferay.FormBuilder.AVAILABLE_FIELDS.DDM_STRUCTURE%26_166_scopeStorageType%3Dxml%26_166_scopeStructureName%3Ddata-definition%26_166_scopeStructureType%3Dcom.liferay.portlet.dynamicdatalists.model.DDLRecordSet%26_166_scopeTemplateMode%3D%26_166_scopeTemplateType%3D%26_166_templateHeaderTitle%3D%26_166_backURL%3Dhttp%253A%252F%252Flocalhost%253A8080%252Fgroup%252Fcontrol_panel%252Fmanage%253Fp_p_id%253D166%2526p_p_lifecycle%253D0%2526p_p_state%253Dpop_up%2526p_p_mode%253Dview%2526doAsGroupId%253D10180%2526_166_chooseCallback%253D%2526_166_ddmResource%253Dcom.liferay.portlet.dynamicdatalists%2526_166_saveCallback%253D%2526_166_scopeAvailableFields%253DLiferay.FormBuilder.AVAILABLE_FIELDS.DDM_STRUCTURE%2526_166_scopeStorageType%253Dxml%2526_166_scopeStructureName%253Ddata-definition%2526_166_scopeStructureType%253Dcom.liferay.portlet.dynamicdatalists.model.DDLRecordSet%2526_166_scopeTemplateMode%253D%2526_166_scopeTemplateType%253D%2526_166_templateHeaderTitle%253D%2526_166_templateId%253D%2526_166_doAsGroupId%253D10180%2526_166_structureId%253D%2526_166_struts_action%253D%25252Fdynamic_data_mapping%25252Fview%26_166_structureId%3D10408%26_166_doAsGroupId%3D10180%26_166_struts_action%3D%252Fdynamic_data_mapping%252Fview_template&_166_groupId=10180&_166_templateId=10528&_166_structureId=10408&_166_type=detail&_166_structureAvailableFields=_166_structureAvailableFields&_166_chooseCallback=&_166_ddmResource=com.liferay.portlet.dynamicdatalists&_166_saveCallback=&_166_scopeAvailableFields=Liferay.FormBuilder.AVAILABLE_FIELDS.DDM_STRUCTURE&_166_scopeStorageType=xml&_166_scopeStructureName=data-definition&_166_scopeStructureType=com.liferay.portlet.dynamicdatalists.model.DDLRecordSet&_166_scopeTemplateMode=&_166_scopeTemplateType=&_166_templateHeaderTitle= generates exception: null
23:11:36,358 ERROR [IncludeTag:154] java.lang.NullPointerException
at com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureImpl.getFieldProperty(DDMStructureImpl.java:134)
at com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureImpl.getFieldProperty(DDMStructureImpl.java:124)
at com.liferay.portlet.dynamicdatamapping.model.impl.DDMStructureImpl.getFieldRequired(DDMStructureImpl.java:138)
at org.apache.jsp.html.portlet.dynamic_005fdata_005fmapping.edit_005ftemplate_jsp._getFieldReadOnlyAttributes(edit_005ftemplate_jsp.java:265)
at org.apache.jsp.html.portlet.dynamic_005fdata_005fmapping.edit_005ftemplate_jsp._addDetailTemplateFieldAttributes(edit_005ftemplate_jsp.java:253)
at org.apache.jsp.html.portlet.dynamic_005fdata_005fmapping.edit_005ftemplate_jsp._jspService(edit_005ftemplate_jsp.java:1171)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at com.liferay.portal.kernel.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:45)
at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:323)
at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:418)
at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:92)
at org.apache.jsp.html.common.themes.portlet_jsp._jspService(portlet_jsp.java:3140)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)