Commit c946eaab authored by Kristof Szabados's avatar Kristof Szabados
Browse files

protect against removing from an empty notification list.


Signed-off-by: Kristof Szabados's avatarkristof <Kristof.Szabados@ericsson.com>
parent 5dd85157
......@@ -336,13 +336,20 @@ public abstract class BaseExecutor {
* @param notificationList the list of notification to add
* */
protected final void addNotifications(final List<Notification> notificationList) {
if (0 != maximumNotificationCount && notifications.size() + notificationList.size() > maximumNotificationCount * 1.2f) {
if (notificationList.size() > maximumNotificationCount) {
notifications.clear();
} else {
while (notifications.size() + notificationList.size() > maximumNotificationCount - 1) {
notifications.removeFirst();
}
if (maximumNotificationCount <= 0) {
return;
}
if (notificationList.size() > maximumNotificationCount * 1.2f) {
notifications.clear();
final List<Notification> subList = notificationList.subList(notificationList.size() - maximumNotificationCount - 1, notificationList.size() - 1);
notifications.addAll(subList);
return;
}
if (notifications.size() + notificationList.size() > maximumNotificationCount * 1.2f) {
while (notifications.size() + notificationList.size() > maximumNotificationCount) {
notifications.removeFirst();
}
}
notifications.addAll(notificationList);
......@@ -354,9 +361,13 @@ public abstract class BaseExecutor {
* @param notification the notification to add
* */
protected final void addNotification(final Notification notification) {
if (maximumNotificationCount <= 0) {
return;
}
notifications.add(notification);
if (maximumNotificationCount != 0 && notifications.size() > maximumNotificationCount * 1.2f) {
while (notifications.size() > maximumNotificationCount - 1) {
if (notifications.size() > maximumNotificationCount * 1.2f) {
while (notifications.size() > maximumNotificationCount) {
notifications.removeFirst();
}
}
......
......@@ -146,7 +146,7 @@ public abstract class BasePerformanceSettingsTab extends AbstractLaunchConfigura
lineCountSpinner = new Spinner(lineCountComposite, SWT.NONE);
lineCountSpinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
lineCountSpinner.setMinimum(0);
lineCountSpinner.setMinimum(10);
lineCountSpinner.setMaximum(1000000);
lineCountSpinner.setIncrement(100);
lineCountSpinner.setPageIncrement(10000);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment