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

NPE when setting TextInputControlSkin's StyleableProperty for -fx-font

XMLWordPrintable

      The use case is to be able to reset the font that would have been set on a TextField/TextArea thanks to CSS.
      The general algorithm that is applied in this case is to:
      - Create the initialValue thanks to StyleableProperty
      - call textInputSkin.impl_cssSet(property, value);

      In the case of a Font, there is no initialValue and the Skin doesn't react well when null value is provided.

      WARNING: javafx.scene.Node impl_cssSet Failed to set css [StyleableProperty {owningClass: com.sun.javafx.scene.control.skin.TextInputControlSkin, fieldName: font, property: -fx-font, converter: FontConverter, initialValue: '', inherits: true, subProperties: ['artificial' StyleableProperty {property: -fx-font-family, converter: StringConverter, initialValue: null}, 'artificial' StyleableProperty {property: -fx-font-size, converter: SizeConverter, initialValue: null}, 'artificial' StyleableProperty {property: -fx-font-weight, converter: Font.WeightConverter, initialValue: null}, 'artificial' StyleableProperty {property: -fx-font-style, converter: Font.StyleConverter, initialValue: null}]}]

      java.lang.NullPointerException
      at com.sun.javafx.scene.control.skin.TextFieldSkin$12.computeValue(TextFieldSkin.java:224)
      at javafx.beans.binding.DoubleBinding.get(DoubleBinding.java:182)
      at javafx.beans.binding.DoubleExpression.doubleValue(DoubleExpression.java:42)
      at javafx.beans.property.DoublePropertyBase.get(DoublePropertyBase.java:109)
      at javafx.scene.text.Text.getY(Text.java:237)
      at javafx.scene.text.Text.updatePGText(Text.java:1288)
      at javafx.scene.text.Text.impl_updatePG(Text.java:1330)
      at javafx.scene.Node.impl_syncPGNodeDirect(Node.java:413)
      at com.sun.javafx.tk.quantum.PrismTextHelper.getCaretShape(PrismTextHelper.java:43)
      at javafx.scene.text.Text.getDecorationShapes(Text.java:1012)
      at javafx.scene.text.Text.impl_geomChanged(Text.java:637)
      at javafx.scene.text.Text$3.invalidated(Text.java:247)
      at javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:88)
      at javafx.beans.property.DoublePropertyBase.access$100(DoublePropertyBase.java:28)
      at javafx.beans.property.DoublePropertyBase$Listener.invalidated(DoublePropertyBase.java:210)
      at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:140)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
      at javafx.beans.binding.DoubleBinding.invalidate(DoubleBinding.java:201)
      at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:29)
      at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:140)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
      at javafx.beans.binding.ObjectBinding.invalidate(ObjectBinding.java:150)
      at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:29)
      at com.sun.javafx.binding.ExpressionHelper$MultipleInvalidation.fireValueChangedEvent(ExpressionHelper.java:301)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:64)
      at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:82)
      at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:89)
      at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:122)
      at com.sun.javafx.scene.control.skin.TextInputControlSkin.impl_cssSet(TextInputControlSkin.java:400)
      at javafx.scene.Node.impl_cssSet(Node.java:6347)
      at com.oracle.javafx.authoring.Deprecation.impl_cssSet(Deprecation.java:47)
      at com.oracle.javafx.authoring.css.CssUtils.resetStyle(CssUtils.java:143)
      at com.oracle.javafx.authoring.css.CssUtils.resetStyle(CssUtils.java:410)
      at com.oracle.javafx.authoring.css.CssUtils.resetCssState(CssUtils.java:400)
      at com.oracle.javafx.authoring.css.CssUtils.applyCss(CssUtils.java:465)
      at com.oracle.javafx.authoring.runtime.ComponentState.applyStateValuesRecursively(ComponentState.java:112)
      at com.oracle.javafx.authoring.runtime.ComponentState.refreshState(ComponentState.java:101)
      at com.oracle.javafx.authoring.runtime.ElementStates$StateTransactionListener.unknownChanges(ElementStates.java:516)
      at com.oracle.javafx.authoring.model.transactions.TransactionManager.notifyUnknownChanges(TransactionManager.java:122)
      at com.oracle.javafx.authoring.model.transactions.Transaction.close(Transaction.java:156)
      at com.oracle.javafx.authoring.stage.v2.DropOperation.positionChildrenInNextTick(DropOperation.java:180)
      at com.oracle.javafx.authoring.stage.v2.DropOperation$1$1.run(DropOperation.java:149)
      at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:108)

            dgrieve David Grieve
            jfdenise Jean-Francois Denise (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: