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

Scott Lewis reopened KARAF-5750:
--------------------------------

I'm not sure this is the same issue but I suspect that it may be related to 
this fix.

In karaf 4.3.1 I'm observing the following behavior in Karaf's console with 
*two Converters* (one from a ecf rsa console command, and another from an ecf 
grpc distribution provider console command that has recently been added).

When a grpc command is given, the appropriate method is executed and returns 
list of element type GRPCHostContainer...i.e. List<GRPCHostContainer>  You can 
see the listservers method here:

[https://github.com/ECF/grpc-RemoteServicesProvider/blob/master/bundles/org.eclipse.ecf.provider.grpc.console/src/org/eclipse/ecf/provider/grpc/console/GrpcConsole.java#L89]

So far so good.   However, the karaf impl then calls format/3 with 
List<GRPCHostContainer> as target parameter, and this returns null (expecting 
that the elements of the list will be subsequently converted via Converter).

The Karaf implementation, however, calls all the converters via this code in 
CommandSessionImpl:line 276

for (Converter c : processor.converters)
 {
 CharSequence s = c.format(target, level, this);
 if (s != null)
 {
 return s;
 }
 }

But *since all the converters get a shot at returning something non-null for 
target** the *wrong* Converter service is selected (because GRPCHostContainer 
is also an IContainer, which is the type recognized by the ecf core 
ContainerCommand Converter.

Thus the wrong Converter is selected (the container command converter rather 
than the grpc command converter).

This works correctly on gogo console impl...that is the grpc command converter 
gets the call to format first, and handles the formatting correctly.  

Thanksinadvance for taking a look at this.

 

> Karaf console not calling Converter for custom gogo commands
> ------------------------------------------------------------
>
>                 Key: KARAF-5750
>                 URL: https://issues.apache.org/jira/browse/KARAF-5750
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>    Affects Versions: 4.2.0
>         Environment: windows, java8, karaf 4.2.0
>            Reporter: Scott Lewis
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.2.1
>
>
> The karaf shell does not call the org.apache.felix.service.command.Converter 
> service implementations as expected for processing custom gogo commands.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to