From dd3d0d4597710c3457a301ba411bca982b7c9ab8 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 21 Feb 2022 13:41:36 +0100 Subject: [PATCH] Issue #7613 Override Configurations.add(Configuration) 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 3aba9bf13632..588f3599ecfa 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 Configurations(Configurations classlist) .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 Iterator iterator() 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 @@ private void addConfiguration(Configuration configuration) 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