(Swallowed) Nullpointer access in TextFormatter.updateValue

Jens Auer Jens.Auer at h-d-gmbh.de
Wed Mar 22 15:36:42 UTC 2017


I am using a TextField with a TextFormatter constructed with a predicate:
private TextFormatter.Change validateText(TextFormatter.Change c) { ... }
this.textInput.setTextFormatter(new TextFormatter<>(this::validateText));

While debugging some other problem I realized that the Debugger stops with a Nullpointer access in TextFormatter.updateValue:
    void updateValue(String text) {
        if (!value.isBound()) {
            try {
                V v = valueConverter.fromString(text);
            } catch (Exception e) {
                updateText(); // Set the text with the latest value

The member valueConverter may not be initialized in the constructor and thus can be null. Even though the exception is caught and swallowed, I would consider this an issue.


Jens Auer
Unternehmensberatung H & D GmbH
Niederlassung Weißenthurm
Werftstr. 5 - 56575 Weißenthurm
Tel.:            02637/94238 -110
Fax:            02637/94238 -149
jens.auer at h-d-gmbh.de<mailto:jens.auer at h-d-gmbh.de>

More information about the openjfx-dev mailing list