diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-05-31 13:36:20 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-05-31 12:20:55 +0000 |
commit | 0f9b689130aa1fc1405cc10cf2d840bc98298eec (patch) | |
tree | faf018537cb2febfb173a1624273376b6970ada9 /server | |
parent | cccff37c0c679515491a2cdd4244dbcd7e038629 (diff) | |
download | vaadin-framework-0f9b689130aa1fc1405cc10cf2d840bc98298eec.tar.gz vaadin-framework-0f9b689130aa1fc1405cc10cf2d840bc98298eec.zip |
Throw exception if VaadinService has not been initialized (#11961)
Change-Id: I754c73790aae197a262d6cc8b88751290efbe127
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/server/VaadinService.java | 11 |
1 files changed, 11 insertions, 0 deletions
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 @@ -110,6 +110,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 * * @param deploymentConfiguration @@ -148,6 +153,8 @@ public abstract class VaadinService implements Serializable { List<RequestHandler> 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()); } |