From 0965ca62e286479ccaa8efcf8e19257504f8d9f8 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 8 Apr 2013 09:58:08 +1000 Subject: [PATCH] 404906 servlets with load-on-startup = 0 are not fired up on jetty 9 startup --- .../main/java/org/eclipse/jetty/servlet/ServletHolder.java | 5 ++--- .../org/eclipse/jetty/servlet/ServletContextHandlerTest.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java index 6de3b7e48bf..1e50dd1249d 100644 --- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java +++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java @@ -71,7 +71,7 @@ public class ServletHolder extends Holder implements UserIdentity.Scope private static final Logger LOG = Log.getLogger(ServletHolder.class); /* ---------------------------------------------------------------- */ - private int _initOrder; + private int _initOrder = -1; private boolean _initOnStartup=false; private Map _roleMap; private String _forcedPath; @@ -179,7 +179,7 @@ public class ServletHolder extends Holder implements UserIdentity.Scope */ public void setInitOrder(int order) { - _initOnStartup=order>0; + _initOnStartup=order>=0; _initOrder = order; } @@ -329,7 +329,6 @@ public class ServletHolder extends Holder implements UserIdentity.Scope throws Exception { super.initialize(); - if (_extInstance || _initOnStartup) { try diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletContextHandlerTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletContextHandlerTest.java index 4c06368b4bd..b923e53d8cb 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletContextHandlerTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/ServletContextHandlerTest.java @@ -130,8 +130,8 @@ public class ServletContextHandlerTest holder0.setInitOrder(0); _server.start(); - assertEquals(2,__testServlets.get()); - assertThat(holder0.getServletInstance(),nullValue()); + assertEquals(3,__testServlets.get()); + assertThat(holder0.getServletInstance(),notNullValue(Servlet.class)); _server.stop(); assertEquals(0,__testServlets.get());