tango-controls / JTango

TANGO kernel Java implementation. JTango moved to https://gitlab.com/tango-controls/JTango
http://tango-controls.org
8 stars 14 forks source link

TangoDevice.getCommand fails to create a new TangoCommand #63

Closed Ingvord closed 2 years ago

Ingvord commented 5 years ago

Test case:

//env.TANGO_HOST=localhost:10000

DeviceProxy proxy = DeviceProxyFactory.get("tango://172.17.0.3:10000/test/debian8/10");

TangoDevice device = new TangoDevice(proxy);

device.getTangoCommand("IOState").execute(DevState.RUNNING);

the last line produces the following exception:

fr.esrf.TangoApi.ConnectionFailed
    at fr.esrf.TangoDs.Except.throw_connection_failed(Except.java:616)
    at fr.esrf.TangoDs.Except.throw_connection_failed(Except.java:569)
    at fr.esrf.TangoApi.ConnectionDAODefaultImpl.command_inout(ConnectionDAODefaultImpl.java:923)
    at fr.esrf.TangoApi.DatabaseDAODefaultImpl.import_device(DatabaseDAODefaultImpl.java:483)
    at fr.esrf.TangoApi.Database.import_device(Database.java:456)
    at fr.esrf.TangoApi.ConnectionDAODefaultImpl.get_exported_ior(ConnectionDAODefaultImpl.java:505)
    at fr.esrf.TangoApi.ConnectionDAODefaultImpl.init(ConnectionDAODefaultImpl.java:164)
    at fr.esrf.TangoApi.Connection.<init>(Connection.java:198)
    at fr.esrf.TangoApi.DeviceProxy.<init>(DeviceProxy.java:144)
    at fr.esrf.TangoApi.DeviceProxyFactory.get(DeviceProxyFactory.java:112)
    at fr.esrf.TangoApi.DeviceProxyFactory.get(DeviceProxyFactory.java:85)
    at fr.soleil.tango.clientapi.factory.ProxyFactory.createDeviceProxy(ProxyFactory.java:57)
    at fr.soleil.tango.clientapi.command.RealCommand$1.call(RealCommand.java:49)
    at fr.soleil.tango.clientapi.command.RealCommand$1.call(RealCommand.java:46)
    at fr.soleil.tango.errorstrategy.RetriableTask.execute(RetriableTask.java:57)
    at fr.soleil.tango.clientapi.command.RealCommand.<init>(RealCommand.java:56)
    at fr.soleil.tango.clientapi.TangoCommand.<init>(TangoCommand.java:94)
    at fr.soleil.tango.clientapi.TangoDevice.getTangoCommand(TangoDevice.java:47)

This is due to TangoDevice.java#47:

tc = new TangoCommand(deviceName, commandName);

as deviceName is a short name e.g. test/debian8/10 TangoCommand constructor ignores actual Tango host and fails to connect (or even worse - may return TangoCommand that is from env.TANGO_HOST/test/debian8/10)

FIX: use proxy instead of deviceName

Ingvord commented 5 years ago

@gwen-soleil, I have this fixed in our fork should I back-port it here?