Page to Content Migration - Fix for tab-divider field to avoid exception/error
When migrating pages to content for a specific Client, exception was thrown during an attempt to validate a tab-divider field. In this particular case, validation for tab-divider field should be skipped (should not be validated) because they hold no value at the contentlet level.
Following is the exception thrown, which caused the Page to Content migration to break:
[23/02/17 13:27:47:620 CST] ERROR business.HTMLPageAssetAPIImpl: There was a problem migrating Pages to Contents: Unknown field type
com.dotmarketing.portlets.contentlet.business.DotContentletStateException: Unknown field type
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.validateContentlet(ESContentletAPIImpl.java:3976) ~[dotcms_3.7.1_8d1e90a.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.validateContentlet(ESContentletAPIImpl.java:4227) ~[dotcms_3.7.1_8d1e90a.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:2686) ~[dotcms_3.7.1_8d1e90a.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:2556) ~[dotcms_3.7.1_8d1e90a.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:2551) ~[dotcms_3.7.1_8d1e90a.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:2501) ~[dotcms_3.7.1_8d1e90a.jar:?]
at com.dotmarketing.portlets.contentlet.business.ContentletAPIInterceptor.checkin(ContentletAPIInterceptor.java:259) ~[dotcms_3.7.1_8d1e90a.jar:?]
at com.dotmarketing.portlets.htmlpageasset.business.HTMLPageAssetAPIImpl.migrateLegacyPage(HTMLPageAssetAPIImpl.java:493) ~[dotcms_3.7.1_8d1e90a.jar:?]
at com.dotmarketing.portlets.htmlpageasset.business.HTMLPageAssetAPIImpl.migrateAllLegacyPages(HTMLPageAssetAPIImpl.java:416) [dotcms_3.7.1_8d1e90a.jar:?]
at com.dotmarketing.portlets.cmsmaintenance.ajax.CMSMaintenanceAjax.migrateHTMLPagesToContent(CMSMaintenanceAjax.java:311) [dotcms_3.7.1_8d1e90a.jar:?]
Following was the fix made, which may be incorporated as part of dotCMS's core (Added "|| "tab_divider".equalsIgnoreCase(field.getFieldType())" as part of the else-if condition): https://github.com/dotCMS/core/blob/3.7.1/src/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java#L3972
@Override
public void validateContentlet(Contentlet contentlet,List<Category> cats)throws DotContentletValidationException {
...
}else if(isFieldTypeSystem(field) || isFieldTypeConstant(field) || "tab_divider".equalsIgnoreCase(field.getFieldType())){
}else{
Logger.error(this,"Found an unknown field type : This should never happen!!!");
throw new DotContentletStateException("Unknown field type");
}
...
}
This issue was reproduced during Page to Content migration for a specific client which had Page Asset content-type with a Metadata tab-divider field:

PR: https://github.com/dotCMS/core/pull/10798
The fix for this issue may be borrowed from hot-fix at https://github.com/dotCMS/support/tree/master/hotfixes/hotfix-GIT-10797_v3.7.1. Also, the original Support ticket may be accessed at https://my.dotcms.com/tickets/detail.dot?id=8ec9cd6d-d829-4533-9f6f-9c7d68b6d2dd
PR: https://github.com/dotCMS/core/pull/11333