Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8101245

StringExpression limation when ObjectProperty is set to null.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • fx2.0
    • javafx
    • JavaFX 2.0 b32

      When using binding with a StringExpression from an ObjectProperty an null pointer exception appears when the ObjectProperty value is set to null.

      Caused by: java.lang.NullPointerException
      at com.sun.javafx.binding.StringFormatter$1.computeValue(StringFormatter.java:53)
      at javafx.beans.binding.StringBinding.get(StringBinding.java:107)
      at javafx.beans.binding.StringBinding.get(StringBinding.java:38)
      at javafx.beans.binding.ObjectExpression.getValue(ObjectExpression.java:25)
      at javafx.beans.value.ObservableValueBase$ChangeListenerWrapper.invalidated(ObservableValueBase.java:127)
      at javafx.beans.value.ObservableValueBase.fireValueChangedEvent(ObservableValueBase.java:107)
      at javafx.beans.binding.StringBinding.invalidate(StringBinding.java:124)
      at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:26)
      at javafx.beans.value.ObservableValueBase.fireValueChangedEvent(ObservableValueBase.java:107)
      at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:57)
      at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:107)
      at javafxsamples.BidingTest.testStringExpression(BidingTest.java:34)
      at javafxsamples.BidingTest.start(BidingTest.java:19)
      at com.sun.javafx.application.LauncherImpl$3.run(LauncherImpl.java:127)
      at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:87)
      at com.sun.javafx.application.PlatformImpl$2.run(PlatformImpl.java:65)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
      at com.sun.glass.ui.win.WinApplication$1$1.run(WinApplication.java:49)
      ... 1 more

      It's a limitation of using binding, for example when we want to bind a Label with the selected Object of a ListView.

      The StringFormatter should handle null value.

            mheinrichs Michael Heinrichs (Inactive)
            alexjfx alex (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: