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

Java Servers : AttributeValue.setQuality does not work anymore in JTango-9.0.4 #23

Closed tango-controls-bot closed 4 years ago

tango-controls-bot commented 9 years ago

Hello, Since JTango9 it appeared a regression bug : some scalar attributes whose quality factor is set to invalid inside the associated get method are now displayed in atkpanel as valid attributes.

At the bottom you can find the source code for one of my invalid attributes. Note that if I start my Java Server with JTangoServer-1.1.5-all.jar in the CLASSPATH the Xpos attribute is invalid. But if I start it with JTango-9.0.4.jar in the CLASSPATH the Xpos attribute is valid.

You can see in the code below that I set the quality factor to invalid (I know that this.dipole is = true). It does not work anymore.

Could you please fix this problem as soon as posssible???

Thank you in advance.

Faranguiss

/**
 * Attribute Xpos, double, Scalar, READ
 * description:
 *     
 */
@Attribute(name="Xpos", pushArchiveEvent=true, checkArchivingEvent=true)
@AttributeProperties(unit="um", standardUnit="1", displayUnit="1.E6", format="%6.2f",
                     maxValue="5.0E-5", minValue="-5.0E-5", archiveEventPeriod="60000")
private double xpos;
/**
 * Read attribute Xpos
 * 
 * @return attribute value
 * @throws DevFailed if read attribute failed.
 */
public org.tango.server.attribute.AttributeValue getXpos() throws DevFailed {
    xlogger.entry();
    org.tango.server.attribute.AttributeValue
        attributeValue = new org.tango.server.attribute.AttributeValue();
    /*----- PROTECTED REGION ID(SrBpm.getXpos) ENABLED START -----*/

    //  Put read attribute code here
            if (this.dipole)
            {
                attributeValue.setQuality(AttrQuality.ATTR_INVALID);
            }
            else
            {
                if (this.timeStamp > 0)
                   attributeValue.setTime(this.timeStamp);                    
            }

    /*----- PROTECTED REGION END -----*/    //  SrBpm.getXpos
    attributeValue.setValue(xpos);
    xlogger.exit();
    return attributeValue;
}

Reported by: poncet ( http://sf.net/u/poncet )

Original Ticket: tango-cs/bugs/734

gwen-soleil commented 4 years ago

fixed (at least since 9.6.x).

cf test https://github.com/tango-controls/JTango/blob/8a02f1a2fdb2c7832e3c4bcde0d4844e0225c88d/server/src/test/java/org/tango/server/testserver/AlarmQualityTest.java#L155-L167