Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5715

VersionHandlers must not install delta's for future version

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 4.5.18, 5.2.4, 5.3
    • 4.5.17
    • None
    • Yes

      The module descriptor file contains the version number of the module being installed. If the VersionHandler registers deltas for versions later than the version being installed then those deltas should not be executed.

      Consider the scenario:

      • I have version 1.0 installed in my webapp
      • I install version 2.0 which contains deltas for future versions

      For example my version handler for 2.0 looks like this:

      public class TestModuleVersionHandler extends DefaultModuleVersionHandler {
      
      	public TestModuleVersionHandler() {
      		register(DeltaBuilder.update("999.0.0", "Updates for version 999.0.0")
                      .addTask(new AbstractRepositoryTask("", "") {
                          @Override
                          protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException {
                              installContext.error("error", new IllegalStateException("this should not be executed..."));
                          }
                      })
              );
      	}
      }
      

      My test.xml looks like this:

      <module>
        <name>test</name>
        <displayName>${project.name}</displayName>
        <description>${project.description}</description>
        <class&gt;info.magnolia.TestModule</class&gt;
        <versionHandler>info.magnolia.setup.TestModuleVersionHandler</versionHandler>
        <version>1.2.0</version>
      

      When I start up magnolia I see:

      In configuration I have:

        Acceptance criteria

              dlipp Daniel Lipp
              rgange Richard Gange
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD