- if (groupIdStrings != null) {
- for (var groupId : CommandUtil.getGroupIds(groupIdStrings)) {
- try {
- m.setGroupBlocked(groupId, true);
- } catch (NotMasterDeviceException e) {
- throw new UserErrorException("This command doesn't work on linked devices.");
- } catch (GroupNotFoundException e) {
- logger.warn("Group not found {}: {}", groupId.toBase64(), e.getMessage());
- } catch (IOException e) {
- throw new UnexpectedErrorException("Failed to sync block to linked devices: " + e.getMessage(), e);
- }
- }
+ final var groupIds = CommandUtil.getGroupIds(groupIdStrings);
+ try {
+ m.setGroupsBlocked(groupIds, true);
+ } catch (NotPrimaryDeviceException e) {
+ throw new UserErrorException("This command doesn't work on linked devices.");
+ } catch (GroupNotFoundException e) {
+ logger.warn("Unknown group id: {}", e.getMessage());
+ } catch (IOException e) {
+ throw new UnexpectedErrorException("Failed to sync block to linked devices: " + e.getMessage(), e);