Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 414854

Summary: [Shell] Shell assumes custom type parameters to be required
Product: [ECD] Orion Reporter: Maciej Bendkowski <maciej.bendkowski>
Component: ClientAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Maciej Bendkowski CLA 2013-08-12 06:40:15 EDT
I've created a command 'logs show [appender]'. The goal was to list all appenders on 'logs show' and on 'logs show appender-name' display some metadata. The appender parameter is a custom type created for auto-completion purposes. If I mark this parameter optional, I'm unable to use 'logs show' without the parameter. It turns out, that if I provide the optional stringify method, I'm able to use my optional parameters again, however I get an ugly command response, e. g. 'logs show [object Object]' and then the proper result.
Comment 1 Maciej Bendkowski CLA 2013-08-12 06:59:05 EDT
getCommandString which converts the command invocation into a string representation has problems with handling null objects (default value for the appender type), and that's the root cause of the ugly response.
Comment 2 Maciej Bendkowski CLA 2013-08-12 08:03:40 EDT
I think part of the job has been solved in http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=9702cfcec5858455bea5c8325f79efa8e339c24d. Grant, if you have any better solution, please notify me.
Comment 3 Grant Gayed CLA 2013-08-14 16:45:30 EDT
(In reply to comment #2)
> I think part of the job has been solved in
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/
> ?id=9702cfcec5858455bea5c8325f79efa8e339c24d

I think ideally the defaultValue value would not be null, because a defaultValue is supposed to be a valid instance for the parameter that it fills (so for a custom type, an object with values for "name" and "value").  Regardless, the change in your patch doesn't seem problematic, so it can stay.  I think your case is now fixed with this change?
Comment 4 Maciej Bendkowski CLA 2013-08-16 05:51:05 EDT
(In reply to comment #3)
> I think ideally the defaultValue value would not be null, because a
> defaultValue is supposed to be a valid instance for the parameter that it
> fills (so for a custom type, an object with values for "name" and "value"). 
> Regardless, the change in your patch doesn't seem problematic, so it can
> stay.  I think your case is now fixed with this change?

Ideally I could define truly optional parameters without defining default values. It's more a flag than an optional parameter though. I've opened a separate bug for that some time ago: bug 413230. My patch fixes the initial problem and so if you're fine with it Grant, please close this bug.
Comment 5 John Arthorne CLA 2015-05-05 16:21:50 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html