[jboss-jira] [JBoss JIRA] (AS7-4072) Method asList called on an empty ModelNode should return an empty list

Rostislav Svoboda (JIRA) jira-events at lists.jboss.org
Thu Mar 8 11:05:36 EST 2012


    [ https://issues.jboss.org/browse/AS7-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675206#comment-12675206 ] 

Rostislav Svoboda commented on AS7-4072:
----------------------------------------

Hi Brian and Jan.

I don't understand why is IAE thrown when no argument is passed to that method (op.asList()). I'd expect empty list too. 
JavaDoc says "Objects will return a list of properties corresponding to the mappings within the object.  Other types will return an empty list.".

I understand it's critical component but this method should be fixed (after careful consideration) to return empty list.
                
> Method asList called on an empty ModelNode should return an empty list
> ----------------------------------------------------------------------
>
>                 Key: AS7-4072
>                 URL: https://issues.jboss.org/browse/AS7-4072
>             Project: Application Server 7
>          Issue Type: Enhancement
>          Components: Domain Management
>    Affects Versions: 7.0.0.Final, 7.1.0.Final
>            Reporter: Jan Martiska
>            Priority: Minor
>
> {noformat}
> ModelNode op = new ModelNode();
> op.get("foo").add("bar");
> for(ModelNode child : op.asList()) {
>             System.out.println(child.toString());
> }
> {noformat}
> .. if you omit the second line of this snippet, that means call asList on an empty node (empty, not null of course), an IllegalArgumentException will be thrown. I think this behavior is not appropriate. It should rather return an empty list.
> If I picked the wrong component or assignee, fell free to change it :)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list