From 0f9b689130aa1fc1405cc10cf2d840bc98298eec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Fri, 31 May 2013 13:36:20 +0300 Subject: [PATCH] Throw exception if VaadinService has not been initialized (#11961) Change-Id: I754c73790aae197a262d6cc8b88751290efbe127 --- server/src/com/vaadin/server/VaadinService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index 2cb7f9059e..f9b17537df 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -109,6 +109,11 @@ public abstract class VaadinService implements Serializable { */ private boolean pushWarningEmitted = false; + /** + * Has {@link #init()} been run? + */ + private boolean initialized = false; + /** * Creates a new vaadin service based on a deployment configuration * @@ -148,6 +153,8 @@ public abstract class VaadinService implements Serializable { List handlers = createRequestHandlers(); Collections.reverse(handlers); requestHandlers = Collections.unmodifiableCollection(handlers); + + initialized = true; } /** @@ -1224,6 +1231,10 @@ public abstract class VaadinService implements Serializable { * The response */ public void requestStart(VaadinRequest request, VaadinResponse response) { + if (!initialized) { + throw new IllegalStateException( + "Can not process requests before init() has been called"); + } setCurrentInstances(request, response); request.setAttribute(REQUEST_START_TIME_ATTRIBUTE, System.nanoTime()); } -- 2.39.5