[jboss-jira] [JBoss JIRA] (WFCORE-3484) Nonintuitive error message when for loop is used inside of if/try/batch constructs
Jean-Francois Denise (JIRA)
issues at jboss.org
Tue Jan 2 05:14:00 EST 2018
[ https://issues.jboss.org/browse/WFCORE-3484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jean-Francois Denise moved WFLY-9621 to WFCORE-3484:
----------------------------------------------------
Project: WildFly Core (was: WildFly)
Key: WFCORE-3484 (was: WFLY-9621)
Component/s: CLI
(was: CLI)
Affects Version/s: 4.0.0.Alpha5
(was: 11.0.0.Final)
> Nonintuitive error message when for loop is used inside of if/try/batch constructs
> ----------------------------------------------------------------------------------
>
> Key: WFCORE-3484
> URL: https://issues.jboss.org/browse/WFCORE-3484
> Project: WildFly Core
> Issue Type: Bug
> Components: CLI
> Affects Versions: 4.0.0.Alpha5
> Reporter: Erich Duda
> Assignee: Jean-Francois Denise
>
> CLI enables to use for loop construct for looping over commands or operations. See WFCORE-3236 for details. Because of design limitations of CLI, using of for loop is not supported inside of if, try, for and batch constructs. However if you try to do that, error message is not intuitive in all cases and it is difficult to find out why the code does not work.
> Let's see on real examples.
> {code:title=Using for inside if}
> [standalone at embedded /] if (outcome != success) of /system-property=test:read-resource
> [standalone at embedded /] for propName in :read-children-names(child-type=system-property)
> [standalone at embedded /] echo $propName
> Unrecognized variable propName
> {code}
> As you can see in the example, when you write aforementioned commands into the CLI, no error is thrown until you use the variable declared in the for construct. Additionally the error message is not saying anything about that using of "for" is not allowed inside of "if".
> {code:title=Using for inside try}
> [standalone at embedded /] try
> [standalone at embedded /] for propName in :read-children-names(child-type=system-property)
> [standalone at embedded /] echo $propName
> Unrecognized variable propName
> {code}
> The same applies here as for "if" case.
> {code:title=Using for inside batch}
> [standalone at embedded /] batch
> [standalone at embedded / #] for propName in :read-children-names(child-type=system-property)
> The command is not available in the current context (e.g. required subsystems or connection to the controller might be unavailable).
> {code}
> In the batch case, the error message is better (it says that command is not available), but still it is not clear why the command is not available.
> {code:title=Using for inside for}
> [standalone at embedded /] for propName in :read-children-names(child-type=system-property)
> [standalone at embedded /] for propName in :read-children-names(child-type=system-property)
> for is not allowed while in for block
> {code}
> Using of nested for loops generates nice error message which clearly explains what is wrong. All other cases should throw similar error.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list