[
https://issues.apache.org/jira/browse/KARAF-4184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15054978#comment-15054978
]
ASF GitHub Bot commented on KARAF-4184:
---------------------------------------
GitHub user oscerd opened a pull request:
https://github.com/apache/karaf/pull/117
[KARAF-4184] ArgumentCompleter has incorrect check for enum type
Hi all,
This PR is related to:
https://issues.apache.org/jira/browse/KARAF-4184
Andrea
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/oscerd/karaf KARAF-4184
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/karaf/pull/117.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #117
----
commit bba70a3e63211749e78a6c14940af6c58bc951ec
Author: Andrea Cosentino <[email protected]>
Date: 2015-12-13T13:50:14Z
[KARAF-4184] ArgumentCompleter has incorrect check for enum type
----
> ArgumentCompleter has incorrect check for enum type
> ---------------------------------------------------
>
> Key: KARAF-4184
> URL: https://issues.apache.org/jira/browse/KARAF-4184
> Project: Karaf
> Issue Type: Bug
> Components: karaf-shell
> Affects Versions: 4.0.3
> Reporter: Stuart McCulloch
>
> https://github.com/apache/karaf/blob/karaf-4.0.3/shell/core/src/main/java/org/apache/karaf/shell/impl/action/command/ArgumentCompleter.java#L180
> {code}
> if (type.isAssignableFrom(Enum.class)) {
> {code}
> should really be:
> {code}
> if (type.isEnum()) {
> {code}
> because otherwise the only time that branch will be taken is when 'type' is
> exactly Enum.class or a superclass, as per the spec of isAssignableFrom. It
> won't be taken when the field is a concrete enum class with actual values.
> If you want to stick with "isAssignableFrom" then the Enum check should be:
> {code}
> if (Enum.class.isAssignableFrom(type)) {
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)