From: Leif Åstrand Date: Fri, 31 May 2013 10:36:20 +0000 (+0300) Subject: Throw exception if VaadinService has not been initialized (#11961) X-Git-Tag: 7.1.0~90^2~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f9b689130aa1fc1405cc10cf2d840bc98298eec;p=vaadin-framework.git Throw exception if VaadinService has not been initialized (#11961) Change-Id: I754c73790aae197a262d6cc8b88751290efbe127 --- 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()); }