karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-4376) Make grep return the list of results rather than null
Date Wed, 07 Sep 2016 16:08:20 GMT

    [ https://issues.apache.org/jira/browse/KARAF-4376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15471020#comment-15471020
] 

ASF subversion and git services commented on KARAF-4376:
--------------------------------------------------------

Commit 7660ee68ca903f0531f6fb2ae902bb37c4754dd3 in karaf's branch refs/heads/master from [~gnt]
[ https://git-wip-us.apache.org/repos/asf?p=karaf.git;h=7660ee6 ]

[KARAF-4273] Add -o (--only-matching) option to grep command
[KARAF-4376] Make grep return the list of results rather than null
Also refactor grep command using the gogo jline grep implementation which uses the AttributedString
for ease of use.


> Make grep return the list of results rather than null
> -----------------------------------------------------
>
>                 Key: KARAF-4376
>                 URL: https://issues.apache.org/jira/browse/KARAF-4376
>             Project: Karaf
>          Issue Type: Improvement
>          Components: karaf-shell
>            Reporter: Jim Sermersheim
>            Assignee: Guillaume Nodet
>             Fix For: 4.1.0
>
>
> It seems natural to run 'each' over the result of grep, but this causes a NullPointerException.
I suppose because GrepAction.execute() returns null rather than list (the ArrayList holding
the filtered results).
> For example:
> {noformat}
> > a = [ben bart pen]
> ben
> bart
> pen
> > echo $a
> [ben, bart, pen]
> > b = ($a | grep en)
> ben
> pen
> > each ($b) { echo $it }
> Error: java.lang.NullPointerException
> > echo $b
> Error: java.lang.NullPointerException
> > echo ($a size)
> 3
> > echo ($b size)
> Error: Command name evaluates to null: $b
> {noformat}



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

Mime
View raw message