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

VersionHandlers must not install delta's for future version

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Neutral
    • Resolution: Fixed
    • Affects Version/s: 4.5.17
    • Fix Version/s: 4.5.18, 5.2.4, 5.3
    • Component/s: None
    • Labels:
    • Release notes required:
      Yes
    • Magnolia Release:
      4.5.18, 5.2.4, 5.3

      Description

      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:

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response: