[ https://issues.apache.org/jira/browse/CLOUDSTACK-9631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15710633#comment-15710633 ]
ASF GitHub Bot commented on CLOUDSTACK-9631: -------------------------------------------- Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1798#discussion_r90372709 --- Diff: api/src/org/apache/cloudstack/api/command/user/affinitygroup/UpdateVMAffinityGroupCmd.java --- @@ -96,6 +96,10 @@ public Long getId() { throw new InvalidParameterValueException("affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter"); } + if (affinityGroupNameList == null && affinityGroupIdList == null) { + throw new InvalidParameterValueException("affinitygroupids parameter or affinitygroupnames parameter must be given"); + } + --- End diff -- Lines 95-102 should be at the beginning of the `execute` method rather than in an accessor. > updateVMAffinityGroup must require one of the list parameter > ------------------------------------------------------------ > > Key: CLOUDSTACK-9631 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9631 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: API > Reporter: Marc-Aurèle Brothier > Assignee: Marc-Aurèle Brothier > > The command updateVMAffinityGroup does not check that one of the parameter is > provided, therefore if both are null a NPE is raised later on in > AffinityGroupServiceImpl > (https://github.com/apache/cloudstack/blob/master/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java#L429). > The command should check both cases: both list are not given, and one is > given. -- This message was sent by Atlassian JIRA (v6.3.4#6332)