xwikisas / application-diagram

Create various types of diagrams using draw.io
GNU Lesser General Public License v2.1
0 stars 8 forks source link

Error in EM while upgrading on farm the application, leading to unapplied migration #170

Closed oanalavinia closed 3 years ago

oanalavinia commented 3 years ago

Steps to reproduce

  1. Have Diagram Application (Pro) 1.10 installed on farm
  2. Create a diagram with clipart shapes from_diagram
  3. Upgrade on farm the application to version 1.15.2
  4. Observe the progress displayed in Extension Manager
  5. Observe the created diagram page

Results The following error appears, but the application is upgraded correctly:

Failed to send event [org.xwiki.extension.event.ExtensionUpgradedEvent@4cd30ffd] to listener [com.xwiki.diagram.internal.DiagramApplicationListener@766a17a5]
class java.lang.NullPointerException: null
    at com.xwiki.diagram.internal.DiagramApplicationListener.getTargetWikis(DiagramApplicationListener.java:80)
    at com.xwiki.diagram.internal.DiagramApplicationListener.onEvent(DiagramApplicationListener.java:75)
    at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:304)
    at org.xwiki.observation.internal.DefaultObservationManager.notify(DefaultObservationManager.java:269)
    at org.xwiki.extension.job.internal.AbstractExtensionJob.installExtension(AbstractExtensionJob.java:339)
    at org.xwiki.extension.job.internal.AbstractExtensionJob.applyAction(AbstractExtensionJob.java:209)
    at org.xwiki.extension.job.internal.AbstractExtensionJob.applyActions(AbstractExtensionJob.java:157)
    at org.xwiki.extension.job.internal.InstallJob.runInternal(InstallJob.java:154)
    at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:206)
    at org.xwiki.job.AbstractJob.run(AbstractJob.java:189)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

This error appears in EM despite the version from which the upgrade is done.

After upgrade, the created page is broken: to_diagram

oanalavinia commented 3 years ago

The unapplied migration will affect only diagrams created before Diagram Application version 1.11, but the error in EM will appear for any upgrade

oanalavinia commented 3 years ago

Note that to have the fix to the problem, two diagram upgrades will be needed, where the first upgrade is to a version >= 1.15.3 (the fix version).

The reason is that a component that listens to the upgrade operation is the provider of the error, and while doing the first upgrade the old component will be the one registered. Only on a second upgrade the new listener (that was fixed in the previous upgrade) will be the one registered.