diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-06-06 07:42:00 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-06-06 07:42:00 +0000 |
commit | f8cb0b8eefb3e3f173b4168782324c9e8887d8a7 (patch) | |
tree | 0f0fc0d8a0c8f225226a6619d0f652ee4cb828c1 /src/com/vaadin | |
parent | 17c14316649b191bedc5cf2c0cc58cd49ad74a03 (diff) | |
download | vaadin-framework-f8cb0b8eefb3e3f173b4168782324c9e8887d8a7.tar.gz vaadin-framework-f8cb0b8eefb3e3f173b4168782324c9e8887d8a7.zip |
Show better error message when variable change decoding fails (#8914)
svn changeset:23888/svn branch:6.8
Diffstat (limited to 'src/com/vaadin')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index b001b52918..fe848e50f2 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -1369,15 +1369,11 @@ public abstract class AbstractCommunicationManager implements // we have more than one value changes in row for // one variable owner, collect them in HashMap m = new HashMap<String, Object>(); - m.put(variable[VAR_NAME], - convertVariableValue(variable[VAR_TYPE].charAt(0), - variable[VAR_VALUE])); + m.put(variable[VAR_NAME], decodeVariable(variable)); } else { // use optimized single value map - m = Collections.singletonMap( - variable[VAR_NAME], - convertVariableValue(variable[VAR_TYPE].charAt(0), - variable[VAR_VALUE])); + m = Collections.singletonMap(variable[VAR_NAME], + decodeVariable(variable)); } // collect following variable changes for this owner @@ -1390,9 +1386,7 @@ public abstract class AbstractCommunicationManager implements } else { nextVariable = null; } - m.put(variable[VAR_NAME], - convertVariableValue(variable[VAR_TYPE].charAt(0), - variable[VAR_VALUE])); + m.put(variable[VAR_NAME], decodeVariable(variable)); } try { changeVariables(source, owner, m); @@ -1560,6 +1554,19 @@ public abstract class AbstractCommunicationManager implements } + private Object decodeVariable(String[] variable) { + try { + return convertVariableValue(variable[VAR_TYPE].charAt(0), + variable[VAR_VALUE]); + } catch (Exception e) { + String pid = variable[VAR_PID]; + VariableOwner variableOwner = getVariableOwner(pid); + throw new RuntimeException("Could not convert variable \"" + + variable[VAR_NAME] + "\" for " + + variableOwner.getClass().getName() + " (" + pid + ")", e); + } + } + private Object convertVariableValue(char variableType, String strValue) { Object val = null; switch (variableType) { |