]> source.dussan.org Git - vaadin-framework.git/commitdiff
#5300 add default constructor for the Upload component
authorHenri Sara <henri.sara@itmill.com>
Mon, 5 Jul 2010 06:46:05 +0000 (06:46 +0000)
committerHenri Sara <henri.sara@itmill.com>
Mon, 5 Jul 2010 06:46:05 +0000 (06:46 +0000)
svn changeset:14056/svn branch:6.4

src/com/vaadin/ui/Upload.java

index a15495fbc77cfadf5e0a2e6c32d5183611a96e56..60c31fbc67beef23bb889796e34c23f678cc1326 100644 (file)
@@ -107,6 +107,14 @@ public class Upload extends AbstractComponent implements Component.Focusable {
 
     /* TODO: Add a default constructor, receive to temp file. */
 
+    /**
+     * Creates a new instance of Upload.
+     * 
+     * The receiver must be set before performing an upload.
+     */
+    public Upload() {
+    }
+
     /**
      * Creates a new instance of Upload that redirects the uploaded data to
      * stream given by the Receiver.
@@ -131,6 +139,11 @@ public class Upload extends AbstractComponent implements Component.Focusable {
      * @param upload
      */
     public void receiveUpload(UploadStream upload) throws UploadException {
+        if (receiver == null) {
+            throw new IllegalStateException(
+                    "Receiver not set for the Upload component");
+        }
+
         if (!isUploading) {
             throw new IllegalStateException("uploading not started");
         }