dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
864 stars 468 forks source link

[core] Site copy fails when there are templates using themes from other sites #15765

Closed dsolistorres closed 5 years ago

dsolistorres commented 5 years ago

Reported via support ticket: 97184 Reproducible in dotCMS 4.4.1, 5.0.3

Copying a site fails when there's a template using a theme from other site

Expected Behavior

When creating a new site from an existing one, templates should be copied to the new site pointing to the same theme if the theme is from a separate site.

Current Behavior

When copying a site, if there is a template pointing to a theme from other site, the copying fails and throws an exception.

Possible Solution

Change the copying site code to handle the scenario when the theme is from other site: in that case, the copied templates should point to the same theme.

Known Workarounds

Use themes from the same site before creating the new site, then change the templates to point to the themes from the other site after creating the new one.

Steps to Reproduce (for bugs)

  1. Log into dotCMS 5.0.3
  2. Change a template in the source site to point to a theme from another site.
  3. Copy the source site into a new site.
  4. Check the logs: copying sites should fail with the following error message:
    [03/01/19 11:58:45:374 CST] ERROR priv.HostAssetsJobImpl: A general error as ocurred on the copy host process, the whole process will stop
    java.lang.NullPointerException: null
    at com.dotcms.enterprise.priv.HostAssetsJobImpl.copyHostAssets(HostAssetsJobImpl.java:313) ~[ee_clean.jar:?]
    at com.dotcms.enterprise.priv.HostAssetsJobImpl.run(HostAssetsJobImpl.java:112) ~[ee_clean.jar:?]
    at com.dotcms.enterprise.HostAssetsJobProxy.run(HostAssetsJobProxy.java:17) ~[ee_clean.jar:?]
    at com.dotmarketing.quartz.DotJob.execute(DotJob.java:42) ~[dotcms_5.0.0_999999.jar:?]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:223) ~[dot.quartz-all-1.8.6_2.jar:?]
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) ~[dot.quartz-all-1.8.6_2.jar:?]

Context

This bug prevents a site for being copied to a new one when there are templates pointing to global themes from another site. This was reported by client in this support issue: 97184

Your Environment

dsolistorres commented 5 years ago

PR: dotCMS/enterprise-2.x#650

bryanboza commented 5 years ago

Unable to reproduce after the last changes