[ 
https://issues.apache.org/jira/browse/FELIX-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Derek Baum resolved FELIX-2446.
-------------------------------

    Resolution: Fixed

The context commands are registered into a scope - the first argument of 
addcommand is the scope:

addcommand context ${.context}

I have however fixed gosh_profile to explicitly use this scope when referencing 
the bundle command:

# add methods on System object as commands
addcommand system ((context:bundle 0) loadclass java.lang.System


since the bundle context is also set as a session variable, we could have 
written the above as:
addcommand system (${.context} bundle 0) loadclass java.lang.System

We could protect errors in the whole gosh_profile from aborting startup by 
enclosing them in a try block, as is used for displaying the message of the day 
- rather than test whether the file exists, we just eclose it in a try block:

# print welcome message
try {
  cat ($0 resolve motd)
}

> [Gogo] The bundle context command is not registered with a scope in 
> gosh_profile
> --------------------------------------------------------------------------------
>
>                 Key: FELIX-2446
>                 URL: https://issues.apache.org/jira/browse/FELIX-2446
>             Project: Felix
>          Issue Type: Bug
>          Components: Gogo Shell
>    Affects Versions: gogo-0.6.0
>            Reporter: Richard S. Hall
>            Assignee: Derek Baum
>             Fix For: gogo-0.8.0
>
>
> The default gosh_profile shell registers the bundle context as a command, but 
> it is not assigned any scope. This apparently is problematic for anyone else 
> registering a command with overlapping names as what is on bundle context. 
> For example, registering a command named "bundle" causes the following 
> gosh_profile line to fail:
>     addcommand system ((bundle 1) loadclass java.lang.System)
> I am not sure why or how it is shadowing it, since it seems like the order 
> should favor the built-in commands, but apparently. Regardless, if we had a 
> scope assigned to this we could be precise in our gosh_profile shell (e.g., 
> gogo:bundle) to avoid this issue altogether.
> To make matters worse, this causes the entire shell bundle to die...it might 
> be nice if it continued to function even if there are errors in the 
> gosh_profile.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to