summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2020-12-07 16:40:15 +0200
committerGitHub <noreply@github.com>2020-12-07 16:40:15 +0200
commit49f70390add1655fc5eb846e7700d00cb57b5048 (patch)
treedcd54b24bc1778feebc6b2c3e0b30533a0548ee3 /server
parent02322d16110206ffb3cf249d1fd5a44f2aa80bd5 (diff)
downloadvaadin-framework-49f70390add1655fc5eb846e7700d00cb57b5048.tar.gz
vaadin-framework-49f70390add1655fc5eb846e7700d00cb57b5048.zip
Better error handling trying to enable HTML5 DnD for mobile from thread (#12170)
- Informative error message - Reset back to disabled state when enabling fails - Incorrect usage also detectable using non-mobile devices Fixes #12152
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/UI.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java
index 5891addca4..7430c04bb9 100644
--- a/server/src/main/java/com/vaadin/ui/UI.java
+++ b/server/src/main/java/com/vaadin/ui/UI.java
@@ -1987,6 +1987,13 @@ public abstract class UI extends AbstractSingleComponentContainer
getState().enableMobileHTML5DnD = enabled;
if (isMobileHtml5DndEnabled()) {
+ if (VaadinService.getCurrentRequest() == null) {
+ getState().enableMobileHTML5DnD = false;
+ throw new IllegalStateException("HTML5 DnD cannot be "
+ + "enabled for mobile devices when current "
+ + "VaadinRequest cannot be accessed. Call this "
+ + "method from init(VaadinRequest) to ensure access.");
+ }
loadMobileHtml5DndPolyfill();
}
}