Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-2013

Validators and enumerators can not use others components such as JSONUtils

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.9.4, 4.10.0
    • None
    • None
    • None

      Unable to use JSONUtils in a Validator when we are in safe-mode and the configuration is invalid

      org.apache.avalon.framework.service.ServiceException: Could not find component (key [org.ametys.core.util.JSONUtils]) (Key='org.ametys.core.util.JSONUtils')
      	at org.apache.avalon.framework.service.WrapperServiceManager.lookup(WrapperServiceManager.java:81)
      	at org.ametys.runtime.parameter.DefaultValidator.saxJsonConfig(DefaultValidator.java:167)
      	at org.ametys.runtime.parameter.DefaultValidator.saxConfiguration(DefaultValidator.java:193)
      	at org.ametys.core.datasource.SQLDatabaseTypeValidator.saxConfiguration(SQLDatabaseTypeValidator.java:148)
      	at org.ametys.runtime.parameter.ParameterHelper.toSAXValidator(ParameterHelper.java:340)
      	at org.ametys.runtime.parameter.ParameterHelper.toSAXParameterInternal(ParameterHelper.java:282)
      	at org.ametys.runtime.plugins.admin.configuration.ConfigGenerator._saxConfiguration(ConfigGenerator.java:161)
      	at org.ametys.runtime.plugins.admin.configuration.ConfigGenerator.generate(ConfigGenerator.java:64)
      ...
      Caused by: org.apache.avalon.framework.component.ComponentException: Could not find component (key [org.ametys.core.util.JSONUtils])
      	at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:265)
      	at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:354)
      	at org.ametys.runtime.plugin.component.PluginsComponentManager.lookup(PluginsComponentManager.java:82)
      	at org.apache.avalon.framework.service.WrapperServiceManager.lookup(WrapperServiceManager.java:69)
      

          [RUNTIME-2013] Validators and enumerators can not use others components such as JSONUtils

          Laurence Aumeunier added a comment - - edited

          The validators and enumerators of configuration parameters are initialized before validating configuration.
          The components (safe or not) are loaded after validating configuration (See #init method of PluginsComponentManager).

          So the a validator or enumerator used by a configuration parameter can not a used another component such as JSONUtils.

          Two possible solutions:

          • Declared the components such as JSONUtils in cocoon.xconf
          • Add a "super-safe" mode, and components of "super-safe" mode will be loaded before validating configuration

          Laurence Aumeunier added a comment - - edited The validators and enumerators of configuration parameters are initialized before validating configuration. The components (safe or not) are loaded after validating configuration (See #init method of PluginsComponentManager ). So the a validator or enumerator used by a configuration parameter can not a used another component such as JSONUtils. Two possible solutions: Declared the components such as JSONUtils in cocoon.xconf Add a "super-safe" mode, and components of "super-safe" mode will be loaded before validating configuration

            cedric Cédric Damioli
            laurence Laurence Aumeunier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: