Buggy code:
@ FXML private Button buttonPrintStart ; @ FXML private Button buttonPrintStop ; @ FXML private ComboBox < SerialPortDefinition > comboPort ; @ FXML private WebView htmlLog ; @ FXML private TitledPane panePort ; @ FXML private TitledPane paneFile ; @ FXML private TitledPane panePrint ; @ FXML private TitledPane controlPane ; @ FXML private ControlController controlPaneController ; @ FXML private ScalePanelController scalePaneController ; private final ObjectProperty < File > selectedFile = new SimpleObjectProperty < > ( ) ; private final List < String > logLines = new LinkedList < > ( ) ; private ObjectProperty < SerialPortDefinition > selectedPort ; private final BooleanProperty printing = new SimpleBooleanProperty ( false ) ; private File lastDirectory ; @ FXML private void reloadPorts ( ) { } @ FXML private void openPort ( ) { } @ FXML private void closePort ( ) { } @ FXML private void chooseGCodeFile ( ) { } private void addGCodeExtensionFilter ( FileChooser fileChooser ) { } @ FXML private void print ( ) { } @ FXML private void stopPrint ( ) { } @ FXML private void linkProject ( ) { } @ FXML private void linkGaetan ( ) { } @ FXML private void linkFablab ( ) { } private void goToLink ( String url ) { } @ Override public void initialize ( URL url , ResourceBundle rb ) { final ObjectProperty < PortStatus > portStatus = serialService . getPortStatus ( ) ; final BooleanBinding condOpenPort = portStatus . isEqualTo ( OPEN ) . or ( portStatus . isEqualTo ( OPENNING ) ) . or ( portStatus . isEqualTo ( WAITING_FOR_ARDUINO ) ) . or ( portStatus . isEqualTo ( CLOSING ) ) ; selectedPort = comboPort . valueProperty ( ) ; panePort . disableProperty ( ) . bind ( printing ) ; comboPort . disableProperty ( ) . bind ( condOpenPort ) ; buttonOpenPort . disableProperty ( ) . bind ( selectedPort . isNull ( ) . or ( condOpenPort ) ) ; buttonClosePort . disableProperty ( ) . bind ( portStatus . isNotEqualTo ( OPEN ) ) ; buttonReloadPort . disableProperty ( ) . bind ( condOpenPort ) ; labelPortStatus . textProperty ( ) . bind ( portStatus . asString ( ) ) ; portStatus . addListener ( ( ObservableValue < ? extends PortStatus > observable , PortStatus oldValue , PortStatus newValue ) -> { labelPortStatus . setTooltip ( new Tooltip ( newValue . getDetail ( ) ) ) ; switch ( newValue ) { case OPEN : labelPortStatus . setTextFill ( Color . GREEN ) ; break ; case ERROR : case NOT_RESPONDING : labelPortStatus . setTextFill ( Color . RED ) ; break ; default : labelPortStatus . setTextFill ( Color . BLACK ) ; } } ) ; selectedPort . addListener ( ( ObservableValue < ? extends SerialPortDefinition > observable , SerialPortDefinition oldValue , SerialPortDefinition newValue ) -> { config . setProperty ( ConfigKey . LAST_PORT , ( newValue != null ? newValue . getName ( ) : null ) ) ; } ) ; paneFile . disableProperty ( ) . bind ( printing ) ; final ObjectProperty < GcodeFileStatus > fileStatus = gcodeFileService . getFileStatus ( ) ; labelFileStatus . textProperty ( ) . bind ( fileStatus . asString ( ) ) ; fileStatus . addListener ( ( ObservableValue < ? extends GcodeFileStatus > observable , GcodeFileStatus oldValue , GcodeFileStatus newValue ) -> { switch ( newValue ) { case COMPLETE : labelFileStatus . setTextFill ( Color . GREEN ) ; break ; case ERROR : labelFileStatus . setTextFill ( Color . RED ) ; break ; case READING : labelFileStatus . setTextFill ( Color . ORANGE ) ; break ; default : labelFileStatus . setTextFill ( Color . BLACK ) ; } } ) ; selectedFile . addListener ( ( ObservableValue < ? extends File > observable , File oldValue , File newValue ) -> { <START_BUG> labelFile . setText ( Optional . ofNullable ( newValue ) . map ( ( f ) -> f . getName ( ) ) . orElse ( "No<seq2seq4repair_space>file<seq2seq4repair_space>selected<seq2seq4repair_space>yet<seq2seq4repair_space>!" ) ) ; <END_BUG> config . setProperty ( LAST_FILE , ( newValue != null ? newValue . getAbsolutePath ( ) : null ) ) ; if ( newValue != null ) { lastDirectory = newValue . getParentFile ( ) ; log . info ( ( "File<seq2seq4repair_space>selected<seq2seq4repair_space>:<seq2seq4repair_space>" + ( selectedFile . getValue ( ) ) ) ) ; } } ) ; panePrint . disableProperty ( ) . bind ( fileStatus . isNotEqualTo ( GcodeFileStatus . COMPLETE ) . or ( portStatus . isNotEqualTo ( OPEN ) ) ) ; buttonPrintStart . disableProperty ( ) . bind ( printing ) ; buttonPrintStop . disableProperty ( ) . bind ( printing . not ( ) ) ; gcodeService . addObserver ( ( GcodeNotifyMessage msg ) -> { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<div<seq2seq4repair_space>style=\"color:" ) ; sb . append ( ( ( msg . getType ( ) ) == GcodeNotifyMessage . Type . ERROR ? "red" : "black" ) ) ; sb . append ( ";\">" ) ; sb . append ( msg . getType ( ) . toString ( ) ) ; sb . append ( "<seq2seq4repair_space>" ) ; sb . append ( msg . getMessage ( ) ) ; sb . append ( "<//div>" ) ; logLines . add ( sb . toString ( ) ) ; if ( ( logLines . size ( ) ) > 1000 ) { logLines . remove ( 0 ) ; } Platform . runLater ( ( ) -> { updateLog ( ) ; if ( msg . isEndOfPrint ( ) ) { printing . set ( false ) ; } } ) ; } ) ; controlPane . disableProperty ( ) . bind ( printing . or ( portStatus . isNotEqualTo ( OPEN ) ) ) ; scalePaneController . init ( controlPaneController . getLimits ( ) , gcodeFileService . getLimits ( ) ) ; reloadPorts ( ) ;

Fix:
labelFile . setText ( Optional . ofNullable ( newValue ) . map ( ( f ) -> f . getName ( ) ) . orElse ( "" ) ) ;