[
https://issues.apache.org/jira/browse/KARAF-4376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Guillaume Nodet resolved KARAF-4376.
------------------------------------
Resolution: Fixed
> 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)