[jboss-jira] [JBoss JIRA] (WFLY-3705) read-resource recursive-depth has no effect when recursive=true
Brian Stansberry (JIRA)
issues at jboss.org
Tue Aug 5 12:44:29 EDT 2014
[ https://issues.jboss.org/browse/WFLY-3705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990500#comment-12990500 ]
Brian Stansberry commented on WFLY-3705:
----------------------------------------
A compromise behavior I'm just writing down so I don't forget is to treat treat recursive-depth differently when recursive is undefined. Treat recursive=undefined as meaning 'true' if recursive-depth>0.
I suspect the current behavior crept in because this is overly verbose at the command line:
:read-resource(recursive=true, recursive-depth=2)
compared to
:read-resource(recursive-depth=2)
This "compromise" is pretty ugly. To have it be coherent at all we'd also have to change the behavior in the "recursive=true" case to have it respect the recursive-depth value. That would be an incompatible change but I'm less concerned about that, since someone doing ':read-resource(recursive=true, recursive-depth=2)' but then actually expecting to get recursion beyond 2 strikes me as unlikely.
> read-resource recursive-depth has no effect when recursive=true
> ---------------------------------------------------------------
>
> Key: WFLY-3705
> URL: https://issues.jboss.org/browse/WFLY-3705
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Documentation, Domain Management
> Affects Versions: 8.1.0.Final
> Environment: Linux aimobile-sm.servicemesh.com 3.15.7-200.fc20.x86_64 #1 SMP Mon Jul 28 18:50:26 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
> Reporter: Arcadiy Ivanov
> Assignee: Brian Stansberry
>
> The code inside ReadResourceHandler.doExecuteInternal(OperationContext context, ModelNode operation) goes as follows:
> {noformat}
> final int recursiveDepth = operation.get(ModelDescriptionConstants.RECURSIVE_DEPTH).asInt(0);
> final boolean recursive = recursiveDepth > 0 || operation.get(ModelDescriptionConstants.RECURSIVE).asBoolean(false);
> {noformat}
> The [documentation|https://docs.jboss.org/author/display/WFLY8/Global+operations] states:
> recursive-depth – (int) – The depth to which information about child resources should be included *if recursive is {{true}*. If not set, the depth will be unlimited; i.e. all descendant resources will be included.
> The logic, however, as implemented goes - either recursive-depth is greater than zero OR recursive is true.
> The proper implementation should be:
> {noformat}
> final int recursiveDepth = operation.get(ModelDescriptionConstants.RECURSIVE_DEPTH).asInt(0);
> final boolean recursive = operation.get(ModelDescriptionConstants.RECURSIVE).asBoolean(false) &&
> (!operation.get(ModelDescriptionConstants.RECURSIVE_DEPTH).isDefined() || recursiveDepth > 0);
> {noformat}
> The above snippet works as follows: recurs IF recursive is set AND (either recursive-depth is not defined OR recursive-depth is greater than 0).
>
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
More information about the jboss-jira
mailing list