You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Ignasi Barrera (JIRA)" <ji...@apache.org> on 2016/11/09 16:02:58 UTC

[jira] [Created] (JCLOUDS-1199) jclouds-cli throws NPE in compute list commands

Ignasi Barrera created JCLOUDS-1199:
---------------------------------------

             Summary: jclouds-cli throws NPE in compute list commands
                 Key: JCLOUDS-1199
                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1199
             Project: jclouds
          Issue Type: Bug
          Components: jclouds-cli
    Affects Versions: 2.0.0
            Reporter: Ignasi Barrera


In [this commit in jclouds-karaf|https://github.com/jclouds/jclouds-karaf/commit/df7d4de364e7ccf4288c50ff44616e0cd691a4ae] we changed the way in which the {{ScriptEngineManager}} was loaded.

Before that commit, the script engine manager was hardcoded to an instance that did not work properly in OSGI environments, so we changed the way it was initialised to let it be injected the right instance.

While this works well in Karaf, this breaks the jclouds-cli when not using the interactive mode. When using the shell script, the CLI [directly creates the Command instances|https://github.com/jclouds/jclouds-cli/blob/master/runner/src/main/java/org/jclouds/cli/runner/Main.java#L347], and those instances are now missing the {{ScriptEngineManager}} object, resulting in the mentioned NPE.

My proposed fix would be to manually set the {{new ScriptEngineManager()}} in the CLI, just after creating the command. This way the CLI keeps the legacy behavior while we don't couple jclouds-karaf to a script engine that does not work well in OSGi environments.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)