]> source.dussan.org Git - vaadin-framework.git/commitdiff
Throw exception if VaadinService has not been initialized (#11961)
authorLeif Åstrand <leif@vaadin.com>
Fri, 31 May 2013 10:36:20 +0000 (13:36 +0300)
committerVaadin Code Review <review@vaadin.com>
Fri, 31 May 2013 12:20:55 +0000 (12:20 +0000)
Change-Id: I754c73790aae197a262d6cc8b88751290efbe127

server/src/com/vaadin/server/VaadinService.java

index 2cb7f9059eee51eab27e981619d0e3d9dadd8823..f9b17537dfab9c11f1ebaf994bb72bd5d0d528f8 100644 (file)
@@ -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<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());
     }