Skip to content

Writing to a DBR_LONG PV from a Text Entry widget results in an exception when using the EPICS Jackie backend #3603

@smarsching

Description

@smarsching

In Phoebus 5.0.2, there is a problem when using the EPICS Jackie backend and writing to a PV of type DBR_LONG from a Text Entry widget (and potentially other widgets). The write operation fails with an exception:

025-10-23 15:31:58 WARNING [org.csstudio.display.builder.runtime] Widget Text Entry write error for value 2
java.lang.Exception: Cannot write 2 to PV TEST:Longout
	at org.csstudio.display.builder.runtime.pv.RuntimePV.write(RuntimePV.java:114)
	at org.csstudio.display.builder.runtime.WidgetRuntime.writePrimaryPV(WidgetRuntime.java:381)
	at org.csstudio.display.builder.runtime.RuntimeUtil$1.handleWrite(RuntimeUtil.java:52)
	at org.csstudio.display.builder.representation.ToolkitRepresentation.fireWrite(ToolkitRepresentation.java:682)
	at org.csstudio.display.builder.representation.javafx.widgets.TextEntryRepresentation.submit(TextEntryRepresentation.java:247)
	at org.csstudio.display.builder.representation.javafx.widgets.TextEntryRepresentation.lambda$createJFXNode$0(TextEntryRepresentation.java:141)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Scene.processKeyEvent(Scene.java:2194)
	at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2715)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:218)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:150)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$1(GlassViewEventHandler.java:250)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:249)
	at com.sun.glass.ui.View.handleKeyEvent(View.java:542)
	at com.sun.glass.ui.View.notifyKey(View.java:966)
Caused by: java.lang.IllegalArgumentException: Cannot convert object of type java.lang.Long: 2
	at org.phoebus.pv.jackie.util.ValueConverter.objectToChannelAccessSimpleOnlyValue(ValueConverter.java:399)
	at org.phoebus.pv.jackie.JackiePV.write(JackiePV.java:306)
	at org.csstudio.display.builder.runtime.pv.RuntimePV.write(RuntimePV.java:110)
	... 42 more

The problem is that FormatOptionHandler generates an object of type Long, but the ValueConverter of the EPICS Jackie PV provider currently only handled Byte, Short, and Integer. While the Channel Access protocol does not support 64-bit integer values (as represented by the Java Long type), the PV provider should be able to handle the Long type as long as the actual value fits into the limits of the Integer type. It could even be argued that values outside this limit should be supported, implicitly converting them to DBR_DOUBLE and thus losing precision, like the JCA provider does.

I am going to take care of the necessary changes to the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions