-
Bug
-
Resolution: Duplicate
-
P4
-
fx2.0
Neither PasswordField nor TextField documents whether the setText method accepts null values. Personally, I would expect that someTextField.setText(null) would clear the field. However when invoking setText(null) on a password field I got the exception below.
For coding efficiency's sake, I recommend you implement a simple check for null parameter values and automatically replace null parameters with the empty string, rather than requiring developers to figure out that you do not accept null values in the setText method.
java.lang.NullPointerException
at javafx.scene.control.TextInputControl$TextProperty.set(Unknown Source)
at javafx.scene.control.TextInputControl.setText(Unknown Source)
at javafx.scene.control.TextField.setText(Unknown Source)
at com.intuism.ui.validation.validator.PasswordMatchValidator$1.changed(PasswordMatchValidator.java:37)
at com.intuism.ui.validation.validator.PasswordMatchValidator$1.changed(PasswordMatchValidator.java:33)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.access$100(Unknown Source)
at javafx.beans.property.BooleanPropertyBase$Listener.invalidated(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.set(Unknown Source)
at com.intuism.ui.form.FormPasswordField.validate(FormPasswordField.java:58)
at com.intuism.ui.form.Form.isValid(Form.java:74)
at com.intuism.ui.form.Form.formChanged(Form.java:49)
at com.intuism.ui.form.Form.access$000(Form.java:15)
at com.intuism.ui.form.Form$1.changed(Form.java:36)
at com.sun.javafx.binding.ExpressionHelper$MultipleChange.fireValueChangedEvent(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.fireValueChangedEvent(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.access$400(Unknown Source)
at javafx.scene.control.TextInputControl.replaceText(Unknown Source)
at com.sun.javafx.scene.control.skin.TextInputControlSkin.handleKeyTypedEvent(Unknown Source)
at com.sun.javafx.scene.control.skin.TextInputControlSkin$8.handle(Unknown Source)
at com.sun.javafx.scene.control.skin.TextInputControlSkin$8.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$KeyHandler.process(Unknown Source)
at javafx.scene.Scene$KeyHandler.access$1500(Unknown Source)
at javafx.scene.Scene.impl_processKeyEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.keyEvent(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(Unknown Source)
at com.sun.glass.ui.View.handleKeyEvent(Unknown Source)
at com.sun.glass.ui.View.notifyKey(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
For coding efficiency's sake, I recommend you implement a simple check for null parameter values and automatically replace null parameters with the empty string, rather than requiring developers to figure out that you do not accept null values in the setText method.
java.lang.NullPointerException
at javafx.scene.control.TextInputControl$TextProperty.set(Unknown Source)
at javafx.scene.control.TextInputControl.setText(Unknown Source)
at javafx.scene.control.TextField.setText(Unknown Source)
at com.intuism.ui.validation.validator.PasswordMatchValidator$1.changed(PasswordMatchValidator.java:37)
at com.intuism.ui.validation.validator.PasswordMatchValidator$1.changed(PasswordMatchValidator.java:33)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.access$100(Unknown Source)
at javafx.beans.property.BooleanPropertyBase$Listener.invalidated(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.set(Unknown Source)
at com.intuism.ui.form.FormPasswordField.validate(FormPasswordField.java:58)
at com.intuism.ui.form.Form.isValid(Form.java:74)
at com.intuism.ui.form.Form.formChanged(Form.java:49)
at com.intuism.ui.form.Form.access$000(Form.java:15)
at com.intuism.ui.form.Form$1.changed(Form.java:36)
at com.sun.javafx.binding.ExpressionHelper$MultipleChange.fireValueChangedEvent(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.fireValueChangedEvent(Unknown Source)
at javafx.scene.control.TextInputControl$TextProperty.access$400(Unknown Source)
at javafx.scene.control.TextInputControl.replaceText(Unknown Source)
at com.sun.javafx.scene.control.skin.TextInputControlSkin.handleKeyTypedEvent(Unknown Source)
at com.sun.javafx.scene.control.skin.TextInputControlSkin$8.handle(Unknown Source)
at com.sun.javafx.scene.control.skin.TextInputControlSkin$8.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at javafx.scene.Scene$KeyHandler.process(Unknown Source)
at javafx.scene.Scene$KeyHandler.access$1500(Unknown Source)
at javafx.scene.Scene.impl_processKeyEvent(Unknown Source)
at javafx.scene.Scene$ScenePeerListener.keyEvent(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(Unknown Source)
at com.sun.glass.ui.View.handleKeyEvent(Unknown Source)
at com.sun.glass.ui.View.notifyKey(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
- duplicates
-
JDK-8128745 Text controls need to handle null strings gracefully
- Closed