-
-
Save mkgl/d4f329d0961c7ec78c65 to your computer and use it in GitHub Desktop.
QA incorrect param candidates for multi-item actions when both ctors exist (Item vs. List<Item>)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 5f6e12de2a6eaa5aac2d17ac9178522fa07a2866 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Mika=C3=ABl=20Gelji=C4=87?= <mikael.geljic@magnolia-cms.com> | |
Date: Mon, 23 Feb 2015 14:48:25 +0100 | |
Subject: [PATCH] QA incorrect param candidates for multi-item actions when | |
both ctors exist (Item vs. List<Item>) | |
--- | |
.../info/magnolia/ui/contentapp/browser/BrowserPresenter.java | 10 ++++++++-- | |
1 file changed, 8 insertions(+), 2 deletions(-) | |
diff --git a/magnolia-ui-contentapp/src/main/java/info/magnolia/ui/contentapp/browser/BrowserPresenter.java b/magnolia-ui-contentapp/src/main/java/info/magnolia/ui/contentapp/browser/BrowserPresenter.java | |
index 445d84f..8ed7b5f 100644 | |
--- a/magnolia-ui-contentapp/src/main/java/info/magnolia/ui/contentapp/browser/BrowserPresenter.java | |
+++ b/magnolia-ui-contentapp/src/main/java/info/magnolia/ui/contentapp/browser/BrowserPresenter.java | |
@@ -368,8 +368,14 @@ public class BrowserPresenter implements ActionbarPresenter.Listener, BrowserVie | |
selectedItems.add(contentConnector.getItem(idIt.next())); | |
} | |
- argList.add(selectedItems); | |
- argList.add(selectedItems.isEmpty() ? new NullItem() : selectedItems.get(0)); | |
+ if (selectedItems.size() <= 1) { | |
+ // we have a simple selection; action implementation may expect either an item, either a list parameter, so we have to support both. | |
+ argList.add(selectedItems.isEmpty() ? new NullItem() : selectedItems.get(0)); | |
+ argList.add(selectedItems); | |
+ } else { | |
+ // we have a multiple selection; action implementation must support a list parameter, no way around that. | |
+ argList.add(selectedItems); | |
+ } | |
return argList.toArray(new Object[argList.size()]); | |
} | |
} | |
-- | |
1.9.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment