Skip to content

Warning messages from indexOf function #3755

@rjwills28

Description

@rjwills28

When using the indexOf() formula function we see the following warning message:

WARNING [org.csstudio.apputil.formula] Formula function error for indexOf(current:test2)
java.lang.Exception: Function indexOf requires an enum argument [VDouble[NaN, NONE(NONE) - None, 2026-03-30T14:28:43.178639698Z]]
	at org.csstudio.apputil.formula.enums.IndexOfFunction.compute(IndexOfFunction.java:64)
	at org.csstudio.apputil.formula.node.SPIFuncNode.eval(SPIFuncNode.java:54)
	at org.csstudio.apputil.formula.Formula.eval(Formula.java:181)
	at org.phoebus.pv.formula.FormulaPV.<init>(FormulaPV.java:59)
	at org.phoebus.pv.formula.FormulaPVFactory.createPV(FormulaPVFactory.java:31)
	at org.phoebus.pv.PVPool.createPV(PVPool.java:223)
	at org.phoebus.pv.PVPool.lambda$getPV$0(PVPool.java:214)
	at org.phoebus.pv.RefCountMap.createOrGet(RefCountMap.java:101)
	at org.phoebus.pv.PVPool.getPV(PVPool.java:214)

This is because the PV has not yet connected and as soon as it does we get a valid value. It seems like we shouldn't be trying to evaluate the formula expression until the PV has connected.

I am wondering whether we really need to call the formula.eval() here, which occurs before trying to connect to the PV? Could we remove these two lines and only call eval() after trying to connect to the PV?

The other option would be to catch the case where the PV is not disconnected in the indexOf code and not throw the exception in this case?

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