diff --git a/jetty-ee10/jetty-ee10-quickstart/src/main/java/org/eclipse/jetty/ee10/quickstart/QuickStartConfiguration.java b/jetty-ee10/jetty-ee10-quickstart/src/main/java/org/eclipse/jetty/ee10/quickstart/QuickStartConfiguration.java index e9586c4044c..09fd0c4975c 100644 --- a/jetty-ee10/jetty-ee10-quickstart/src/main/java/org/eclipse/jetty/ee10/quickstart/QuickStartConfiguration.java +++ b/jetty-ee10/jetty-ee10-quickstart/src/main/java/org/eclipse/jetty/ee10/quickstart/QuickStartConfiguration.java @@ -100,14 +100,9 @@ public class QuickStartConfiguration extends AbstractConfiguration //Get the mode Object o = context.getAttribute(MODE); - Mode mode; - if (o instanceof Mode) - mode = (Mode)o; - else - mode = Mode.valueOf((String)o); - - if (mode != null) - _mode = mode; + _mode = (o instanceof Mode m) + ? m + : (o instanceof String s) ? Mode.valueOf(s) : _mode; _quickStart = false; diff --git a/jetty-ee10/jetty-ee10-quickstart/src/test/java/org/eclipse/jetty/ee10/quickstart/TestQuickStart.java b/jetty-ee10/jetty-ee10-quickstart/src/test/java/org/eclipse/jetty/ee10/quickstart/TestQuickStart.java index 3e9e77abe6e..df4b530d199 100644 --- a/jetty-ee10/jetty-ee10-quickstart/src/test/java/org/eclipse/jetty/ee10/quickstart/TestQuickStart.java +++ b/jetty-ee10/jetty-ee10-quickstart/src/test/java/org/eclipse/jetty/ee10/quickstart/TestQuickStart.java @@ -137,7 +137,7 @@ public class TestQuickStart // quick start WebAppContext webapp = new WebAppContext(); webapp.addConfiguration(new QuickStartConfiguration()); - quickstart.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); + webapp.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); webapp.setBaseResource(testDir.toPath()); webapp.getServerClassMatcher().exclude("org.eclipse.jetty.ee10.quickstart."); server.setHandler(webapp); @@ -178,7 +178,7 @@ public class TestQuickStart // quick start WebAppContext webapp = new WebAppContext(); webapp.addConfiguration(new QuickStartConfiguration()); - quickstart.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); + webapp.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); webapp.setBaseResource(testDir.toPath()); webapp.getServerClassMatcher().exclude("org.eclipse.jetty.ee10.quickstart."); server.setHandler(webapp); diff --git a/jetty-ee9/jetty-ee9-quickstart/src/main/java/org/eclipse/jetty/ee9/quickstart/QuickStartConfiguration.java b/jetty-ee9/jetty-ee9-quickstart/src/main/java/org/eclipse/jetty/ee9/quickstart/QuickStartConfiguration.java index 92cb4aeb9a4..372e6cf0aa9 100644 --- a/jetty-ee9/jetty-ee9-quickstart/src/main/java/org/eclipse/jetty/ee9/quickstart/QuickStartConfiguration.java +++ b/jetty-ee9/jetty-ee9-quickstart/src/main/java/org/eclipse/jetty/ee9/quickstart/QuickStartConfiguration.java @@ -100,14 +100,9 @@ public class QuickStartConfiguration extends AbstractConfiguration //Get the mode Object o = context.getAttribute(MODE); - Mode mode; - if (o instanceof Mode) - mode = (Mode)o; - else - mode = Mode.valueOf((String)o); - - if (mode != null) - _mode = mode; + _mode = (o instanceof Mode m) + ? m + : (o instanceof String s) ? Mode.valueOf(s) : _mode; _quickStart = false; diff --git a/jetty-ee9/jetty-ee9-quickstart/src/test/java/org/eclipse/jetty/ee9/quickstart/TestQuickStart.java b/jetty-ee9/jetty-ee9-quickstart/src/test/java/org/eclipse/jetty/ee9/quickstart/TestQuickStart.java index c2d1c616c4f..05193686625 100644 --- a/jetty-ee9/jetty-ee9-quickstart/src/test/java/org/eclipse/jetty/ee9/quickstart/TestQuickStart.java +++ b/jetty-ee9/jetty-ee9-quickstart/src/test/java/org/eclipse/jetty/ee9/quickstart/TestQuickStart.java @@ -137,7 +137,7 @@ public class TestQuickStart // quick start WebAppContext webapp = new WebAppContext(); webapp.addConfiguration(new QuickStartConfiguration()); - quickstart.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); + webapp.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); webapp.setResourceBase(testDir.getAbsolutePath()); webapp.getServerClassMatcher().exclude("org.eclipse.jetty.ee9.quickstart."); server.setHandler(webapp); @@ -178,7 +178,7 @@ public class TestQuickStart // quick start WebAppContext webapp = new WebAppContext(); webapp.addConfiguration(new QuickStartConfiguration()); - quickstart.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); + webapp.setAttribute(QuickStartConfiguration.MODE, QuickStartConfiguration.Mode.QUICKSTART); webapp.setResourceBase(testDir.getAbsolutePath()); webapp.getServerClassMatcher().exclude("org.eclipse.jetty.ee9.quickstart."); server.setHandler(webapp);