Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to push State attribute #70

Ingvord opened this issue Apr 18, 2019 · 0 comments


None yet
2 participants
Copy link

commented Apr 18, 2019

Trying to push State attribute change event (deviceManager.pushEvent("State", value, EventType.CHANGE_EVENT);) fails due to:

ERROR 2019-04-18 10:21:27,988 [main - development/hq/main - o.t.u.DevFailedUtils] org.tango.utils.DevFailedUtils.newDevFailed:22 - API_AttrOptProp, org.tango.DeviceState is not of the good type
ERROR 2019-04-18 10:21:27,989 [main - development/hq/main - o.t.u.DevFailedUtils] org.tango.utils.DevFailedUtils.newDevFailed:24 - 
fr.esrf.Tango.DevFailed: API_AttrOptProp
	at org.tango.utils.DevFailedUtils.newDevFailed(
	at org.tango.server.idl.CleverAttrValUnion.set(
	at org.tango.server.idl.TangoIDLAttributeUtil.toAttributeValue5(
	at org.tango.server.attribute.AttributeImpl.updateValue(
	at org.tango.server.device.DeviceManager.pushEvent(
	at de.hzg.wpi.xenv.hq.HeadQuarter.setState(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.tango.server.device.StateImpl.stateMachine(
	at org.tango.server.device.InitImpl.doInit(
	at org.tango.server.device.InitImpl.execute(
	at org.tango.server.servant.DeviceImpl.doInit(
	at org.tango.server.servant.DeviceImpl.initDevice(
	at org.tango.server.export.TangoExporter.buildDevice(
	at org.tango.server.export.TangoExporter.exportDevices(
	at org.tango.server.export.TangoExporter.exportAll(
	at org.tango.server.ServerManager.init(
	at org.tango.server.ServerManager.start(
	at de.hzg.wpi.xenv.hq.HeadQuarter.main(

I have inspected the following in

// put in an array before inserting for scalars
            array = Array.newInstance(AttributeTangoType.getTypeFromTango(tangoType).getType(), 1);
            try {
                Array.set(array, 0, value);
            } catch (final IllegalArgumentException e) {
                throw DevFailedUtils.newDevFailed(ExceptionMessages.ATTR_OPT_PROP, value.getClass().getCanonicalName()
                        + " is not of the good type");

Here value.getClass == org.tango.DeviceState, while AttributeTangoType.getTypeFromTango(tangoType).getType() == fr.esrf.tango.DevState i.e. fr.esrf.tango.DevState[0] = org.tango.DeviceState which obviously leads to IAE

Temporary workaround: transform DeviceState to DevState before pushing e.g. deviceManager.pushEvent("State", value.getDevState(), EventType.CHANGE_EVENT);.

Solution: encapsulate transformation into the library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.