diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-11-25 09:09:59 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-11-25 09:09:59 +0000 |
commit | c5c45989b9de477960ae66a2503ae11dedc3e851 (patch) | |
tree | 30c5506ba5a2935b7268890cb25afd3d6a3be5dc /src | |
parent | b6199e9647773f06405e370e2d3f24954c66ca84 (diff) | |
download | vaadin-framework-c5c45989b9de477960ae66a2503ae11dedc3e851.tar.gz vaadin-framework-c5c45989b9de477960ae66a2503ae11dedc3e851.zip |
Fix for #5994 - Entering null value representation in TextField throws NPE
svn changeset:16143/svn branch:6.5
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/ui/TextField.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/com/vaadin/ui/TextField.java b/src/com/vaadin/ui/TextField.java index 64dbf933b2..0f0758c4a9 100644 --- a/src/com/vaadin/ui/TextField.java +++ b/src/com/vaadin/ui/TextField.java @@ -461,17 +461,27 @@ public class TextField extends AbstractTextField implements @Override protected void setInternalValue(Object newValue) { - if (changingVariables - && !newValue.toString().equals(lastKnownTextContent)) { + if (changingVariables) { /* * Fire text change event before value change event if change is * coming from the client side. */ - lastKnownTextContent = newValue.toString(); - textChangeEventPending = true; - firePendingTextChangeEvent(); - } + if (newValue == null && lastKnownTextContent != null + && !lastKnownTextContent.equals(getNullRepresentation())) { + // Value was changed from something to null representation + lastKnownTextContent = getNullRepresentation(); + textChangeEventPending = true; + } else if (newValue != null + && !newValue.toString().equals(lastKnownTextContent)) { + // Value was changed to something else than null representation + lastKnownTextContent = newValue.toString(); + textChangeEventPending = true; + } + if (textChangeEventPending) { + firePendingTextChangeEvent(); + } + } super.setInternalValue(newValue); } |