TextField#setText(null)?

Christian Schudt christian.schudt at gmx.de
Tue Jul 17 00:30:06 PDT 2012


Hi,

this is a known bug, existing several times in Jira already:

http://javafx-jira.kenai.com/browse/RT-20845

Originally was planned for Lombard, but fortunately is fixed since yesterday in 2.2.

Regards,
Christian

-------- Original-Nachricht --------
> Datum: Mon, 16 Jul 2012 23:05:52 +0200
> Von: Tom Schindl <tom.schindl at bestsolution.at>
> An: "openjfx-dev at openjdk.java.net" <openjfx-dev at openjdk.java.net>
> Betreff: TextField#setText(null)?

> Hi,
> 
> Is it a problem in the JavaDoc but calling TextField#setText(null)
> results not directly in an error but an NPE once you try to type
> something into the control:
> 
> -----------8<-----------
> TextField f = new TextField();
> f.setText(null);
> primaryStage.setScene(new Scene(b));
> primaryStage.setWidth(200);
> primaryStage.setHeight(200);
> primaryStage.show();
> -----------8<-----------
> 
> The line with the NPE is in TextInputControlBehavior.defaultKeyTyped
> line 219
> 
> > undoManager.addChange(start, textInput.getText().substring(start, end),
> character, true);
> 
> textInput.getText() is null, the problem is when binding e.g. a bean
> where the value is NULL initially one gets NPEs so this is a major bug.
> If NULL is not allowed for f.setText() it should throw an
> IllegalArgumentException immediately I think, not?
> 
> Tom
> 
> -- 
> B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
> ------------------------------------------------------------------------
> tom schindl                 geschäftsführer/CEO
> ------------------------------------------------------------------------
> eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833
> http://www.BestSolution.at                      phone    ++43 512 935834
> 


More information about the openjfx-dev mailing list