From b4c75ecca8c02be9d362090bb2b5d0c632ca5e7f Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Wed, 17 Oct 2018 15:01:48 +1100 Subject: [PATCH] Issue #2985 further changes requested in pr Signed-off-by: Jan Bartel --- .../java/org/eclipse/jetty/webapp/Configurations.java | 8 +++----- .../java/org/eclipse/jetty/webapp/ConfigurationsTest.java | 6 +++--- 2 files changed, 6 insertions(+), 8 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 68ca65dbb372..90875ba4dee6 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 @@ -401,13 +401,10 @@ private void addConfiguration(Configuration configuration) if(c.getClass().getName().equals(replaces.getName()) || c.replaces()!=null && c.replaces().getName().equals(replaces.getName())) { - i.set(configuration); - return; + i.remove(); + break; } } - - _configurations.add(configuration); - return; } //check if any existing configurations replace the one we're adding @@ -424,6 +421,7 @@ private void addConfiguration(Configuration configuration) if (c.getClass().getName().equals(configuration.getClass().getName())) return; //don't add same one twice } + _configurations.add(configuration); } diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ConfigurationsTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ConfigurationsTest.java index afb40afa7d5d..7cfd5101ba92 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ConfigurationsTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ConfigurationsTest.java @@ -214,7 +214,7 @@ public void testTransitiveReplacements () throws Exception ConfigFoo.class.getName() ); - configs.add(ConfigDick.class.getName()); + configs.add(ReplacementDick.class.getName()); configs.sort(); assertThat(configs.stream().map(c->c.getClass().getName()).collect(toList()), @@ -226,14 +226,14 @@ public void testTransitiveReplacements () throws Exception ConfigZ.class.getName(), ConfigTom.class.getName(), AnotherReplacementDick.class.getName(), - ConfigDick.class.getName(), ConfigHarry.class.getName(), ConfigAdditionalHarry.class.getName() )); assertThat(configs.stream().map(c->c.getClass().getName()).collect(toList()), not(contains( - ReplacementDick.class.getName() + ReplacementDick.class.getName(), + ConfigDick.class.getName() ))); }