Skip to content

Commit

Permalink
Fix to cope with null fields.
Browse files Browse the repository at this point in the history
The string handling has never been great with null fields, but this
must have previously worked? The default value has been null for
years and the string editor hasn't recently changed either. Java 8?

It continues to be not great: this will denull a field as soon as
the user accidentally presses a key in it.
  • Loading branch information
Ray J. Greenwell committed May 22, 2016
1 parent 137fbc2 commit 721319a
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -34,6 +34,8 @@
import javax.swing.event.DocumentListener;
import javax.swing.text.JTextComponent;

import com.google.common.base.Objects;

import com.samskivert.swing.util.SwingUtil;
import com.samskivert.util.StringUtil;

Expand Down Expand Up @@ -62,7 +64,7 @@ public void removeUpdate (DocumentEvent event)
public void changedUpdate (DocumentEvent event)
{
String text = StringUtil.trim(_field.getText());
if (!_property.get(_object).equals(text)) {
if (!Objects.equal(_property.get(_object), text)) {
_property.set(_object, text);
fireStateChanged();
}
Expand Down

0 comments on commit 721319a

Please sign in to comment.