From 3d9f34696bde0d9df3f948e0301c259c478fa88b Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 22 Feb 2022 10:51:46 +0100 Subject: [PATCH] Issue #7613 Override Configurations.add(Configuration) (#7631) Signed-off-by: Jan Bartel --- .../org/eclipse/jetty/webapp/Configurations.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java index 3aba9bf1363..588f3599ecf 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java @@ -265,6 +265,12 @@ public class Configurations extends AbstractList implements Dumpa .map(c -> c.getClass().getName()) .toArray(String[]::new)); } + + @Override + public boolean add(Configuration configuration) + { + return addConfiguration(configuration); + } public void add(Configuration... configurations) { @@ -428,7 +434,7 @@ public class Configurations extends AbstractList implements Dumpa return getConfigurations().iterator(); } - private void addConfiguration(Configuration configuration) + private boolean addConfiguration(Configuration configuration) { String name = configuration.getClass().getName(); // Is this configuration known? @@ -462,14 +468,14 @@ public class Configurations extends AbstractList implements Dumpa if (r != null) { if (r.getName().equals(configuration.getClass().getName())) - return; //skip the addition, a replacement is already present + return false; //skip the addition, a replacement is already present } if (c.getClass().getName().equals(configuration.getClass().getName())) - return; //don't add same one twice + return false; //don't add same one twice } - _configurations.add(configuration); + return _configurations.add(configuration); } @Override