Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-40530

Not able to disable a plugin V1

    XMLWordPrintable

Details

    Description

      During some tests for a Plugin in V1, I need to disable one of my plugin v1, and surprise I was not able to do it, since JIRA Plugin Manager raises the error "org.picocontainer.PicoCompositionException: Duplicate Keys not allowed. Duplicate for 'xxxx'".

      I have finally made some tests wigth older versions ... It appears that I was not able to disable plugin V1 since JIRA 6.2.

      I made some search in source code and found this ....

      Before 6.2, the method *ComponentModuleDescriptor.unregisterComponents() *was :

          public void unregisterComponents(final MutablePicoContainer container)
          {
              // Check that we have classloaded the interface if required.
              if (interfaceClazzName != null && interfaceClazz == null)
              {
                  throw new PluginException("Cannot unregister component '" + interfaceClazzName + "' in plugin '" + getKey() +
                      "' because we haven't loaded the class. This means that this plugin has not been successfully enabled.");
              }
      
              if (container.getComponentAdapter(interfaceClazz) != null)
              {
                  container.unregisterComponent(interfaceClazz);
              }
              // TODO: Should this be in an else clause? It is probably harmless, but also pointless.
              container.unregisterComponent(getModuleClass());
          }
      

      Since 6.2, the method ComponentModuleDescriptor.unregisterComponents() is now :

          public void unregisterComponents(final MutablePicoContainer container)
          {
              // Check that we have classloaded the interface if required.
              if (interfaceClazzName != null && interfaceClazz == null)
              {
                  throw new PluginException("Cannot unregister component '" + interfaceClazzName + "' in plugin '" + getKey() +
                      "' because we haven't loaded the class. This means that this plugin has not been successfully enabled.");
              }
      
              if (container.getComponentAdapter(interfaceClazz) != null)
              {
                  container.removeComponent(interfaceClazz);
              }
              // TODO: Should this be in an else clause? It is probably harmless, but also pointless.
              container.addComponent(getModuleClass());
          }
      

      I did not invest more about the cause of this change (probably due to some change the Container), but it is strange that the last lien :

      container.unregisterComponent(getModuleClass());

      is replaced by

      container.addComponent(getModuleClass());

      It seems to be a wrong Copy/Paste !

      Regards
      Vincent

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              5d77aaa81033 Vincent Thoulé
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: