diff options
author | Fabian Lange <lange.fabian@gmail.com> | 2013-06-13 14:51:08 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-07-09 08:23:56 +0000 |
commit | 775c9693e0778894498ff45cac4512fa69e8cb3d (patch) | |
tree | 76c8bd2f68e1d77dbafe8725eaa73c0f8346bc86 /server/src | |
parent | 4a04f0068793428484b7afdc245ae766b13439f5 (diff) | |
download | vaadin-framework-775c9693e0778894498ff45cac4512fa69e8cb3d.tar.gz vaadin-framework-775c9693e0778894498ff45cac4512fa69e8cb3d.zip |
Make UploadInterruptedException visible (#12070)
When another threads interrupts the Upload, the UploadInterruptedException is
thrown. The respective StreamVariable will receive
streamingFailed(StreamingErrorEvent event) which contains the causing exception
via event.getException(). When the UploadInterruptedException is not public, it
is impossible to react on it in the StreamVariable (e.g. treating an
IOException differently from an UploadInterruptedException).
Change-Id: I9098e70e6750c420fcc0978340544e545e237b26
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/com/vaadin/server/communication/FileUploadHandler.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/server/src/com/vaadin/server/communication/FileUploadHandler.java b/server/src/com/vaadin/server/communication/FileUploadHandler.java index e9569d45a1..3f6bfd9267 100644 --- a/server/src/com/vaadin/server/communication/FileUploadHandler.java +++ b/server/src/com/vaadin/server/communication/FileUploadHandler.java @@ -38,6 +38,7 @@ import com.vaadin.server.VaadinResponse; import com.vaadin.server.VaadinSession; import com.vaadin.ui.Component; import com.vaadin.ui.UI; +import com.vaadin.ui.Upload.FailedEvent; /** * Handles a file upload request submitted via an Upload component. @@ -197,7 +198,19 @@ public class FileUploadHandler implements RequestHandler { } } - private static class UploadInterruptedException extends Exception { + /** + * An UploadInterruptedException will be thrown by an ongoing upload if + * {@link StreamVariable#isInterrupted()} returns <code>true</code>. + * + * By checking the exception of an {@link StreamingErrorEvent} or + * {@link FailedEvent} against this class, it is possible to determine if an + * upload was interrupted by code or aborted due to any other exception. + */ + public static class UploadInterruptedException extends Exception { + + /** + * Constructs an instance of <code>UploadInterruptedException</code>. + */ public UploadInterruptedException() { super("Upload interrupted by other thread"); } |