Program: 72336
Project: 72336
Buggy source:
/** 
 * Update the HLA attribute <i>attributeName</i> with the containment of the token <i>in</i>. The updated attribute is sent to the HLA/CERTI Federation.
 * @param hp The HLA publisher actor (HLA attribute) to update.
 * @param in The updated value of the HLA attribute to update.
 * @param senderName the name of the federate that sent the attribute.
 * @exception IllegalActionException If a CERTI exception is raised thendisplayed it to the user.
 */
public void updateHlaAttribute(HlaPublisher hp,Token in,String senderName) throws IllegalActionException {
  SuperdenseTime currentSuperdenseTime=_getModelSuperdenseTime();
  Time currentTime=new Time(_director,currentSuperdenseTime.timestamp().getDoubleValue());
  int microstep=currentSuperdenseTime.index();
  Object[] tObj=_hlaAttributesToPublish.get(hp.getName());
  byte[] valAttribute=MessageProcessing.encodeHlaValue(hp,in);
  if (_debugging) {
    _debug("String_Node_Str" + _printTimes(currentTime) + "String_Node_Str"+ _federateAmbassador.logicalTimeHLA+ "String_Node_Str"+ "String_Node_Str");
  }
  SuppliedAttributes suppAttributes=null;
  try {
    suppAttributes=RtiFactoryFactory.getRtiFactory().createSuppliedAttributes();
  }
 catch (  RTIinternalError e) {
    throw new IllegalActionException(this,e,"String_Node_Str");
  }
  suppAttributes.add(_getAttributeHandleFromTab(tObj),valAttribute);
  byte[] tag=EncodingHelpers.encodeString(_getPortFromTab(tObj).getContainer().getName());
  Time uavTimeStamp=null;
  if (_eventBased) {
    uavTimeStamp=currentTime.add(_hlaLookAHead);
  }
 else {
    CertiLogicalTime certiCurrentTime=(CertiLogicalTime)_federateAmbassador.logicalTimeHLA;
    Time hlaCurrentTime=_convertToPtolemyTime(certiCurrentTime);
    if (hlaCurrentTime.add(_hlaLookAHead).compareTo(currentTime) > 0) {
      uavTimeStamp=hlaCurrentTime.add(_hlaLookAHead);
    }
 else {
      uavTimeStamp=currentTime;
    }
  }
  CertiLogicalTime ct=_convertToCertiLogicalTime(uavTimeStamp);
  if (_debugging) {
    _debug("String_Node_Str" + _getPortFromTab(tObj).getContainer().getName() + "String_Node_Str"+ ct.getTime()+ "String_Node_Str"+ in.toString()+ "String_Node_Str");
  }
  try {
    int id=_registeredObject.get(_federateName + "String_Node_Str" + senderName);
    int indexOfAttribute=0;
    String attributeName=_getPortFromTab(tObj).getContainer().getName();
    for (int i=0; i < _numberOfAttributesToPublish; i++) {
      if (attributeName.equals(_nameOfTheAttributesToPublish[i])) {
        indexOfAttribute=i;
        break;
      }
    }
    String pUAVTimeStamp=ct.getTime() + "String_Node_Str";
    ;
    String preUAVTimeStamp="String_Node_Str" + _printTimes(currentTime) + "String_Node_Str"+ microstep+ "String_Node_Str";
    _storeTimes("String_Node_Str" + _getPortFromTab(tObj).getContainer().getName());
    if (_numberOfUAVs > 0 && (_preUAVsTimes.length() - _preUAVsTimes.lastIndexOf(preUAVTimeStamp)) == preUAVTimeStamp.length() && (_pUAVsTimes.length() - _pUAVsTimes.lastIndexOf(pUAVTimeStamp)) == pUAVTimeStamp.length()) {
      _UAVsValues[indexOfAttribute].replace(_UAVsValues[indexOfAttribute].length() - 2,_UAVsValues[indexOfAttribute].length(),in.toString() + "String_Node_Str");
    }
 else {
      _preUAVsTimes.append(preUAVTimeStamp);
      _pUAVsTimes.append(pUAVTimeStamp);
      for (int i=0; i < _numberOfAttributesToPublish; i++) {
        if (i == indexOfAttribute) {
          _UAVsValues[i].append(in.toString() + "String_Node_Str");
        }
 else {
          _UAVsValues[i].append("String_Node_Str");
        }
      }
    }
    _rtia.updateAttributeValues(id,suppAttributes,tag,ct);
    _numberOfUAVs++;
  }
 catch (  Exception e) {
    throw new IllegalActionException(this,e,e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Update the HLA attribute <i>attributeName</i> with the containment of the token <i>in</i>. The updated attribute is sent to the HLA/CERTI Federation.
 * @param hp The HLA publisher actor (HLA attribute) to update.
 * @param in The updated value of the HLA attribute to update.
 * @param senderName the name of the federate that sent the attribute.
 * @exception IllegalActionException If a CERTI exception is raised thendisplayed it to the user.
 */
public void updateHlaAttribute(HlaPublisher hp,Token in,String senderName) throws IllegalActionException {
  SuperdenseTime currentSuperdenseTime=_getModelSuperdenseTime();
  Time currentTime=new Time(_director,currentSuperdenseTime.timestamp().getDoubleValue());
  int microstep=currentSuperdenseTime.index();
  Object[] tObj=_hlaAttributesToPublish.get(hp.getName());
  byte[] valAttribute=MessageProcessing.encodeHlaValue(hp,in);
  if (_debugging) {
    _debug("String_Node_Str" + _printTimes(currentTime) + "String_Node_Str"+ _federateAmbassador.logicalTimeHLA+ "String_Node_Str"+ "String_Node_Str");
  }
  SuppliedAttributes suppAttributes=null;
  try {
    suppAttributes=RtiFactoryFactory.getRtiFactory().createSuppliedAttributes();
  }
 catch (  RTIinternalError e) {
    throw new IllegalActionException(this,e,"String_Node_Str");
  }
  suppAttributes.add(_getAttributeHandleFromTab(tObj),valAttribute);
  byte[] tag=EncodingHelpers.encodeString(_getPortFromTab(tObj).getContainer().getName());
  Time uavTimeStamp=null;
  if (_eventBased) {
    uavTimeStamp=currentTime.add(_hlaLookAHead);
  }
 else {
    CertiLogicalTime certiCurrentTime=(CertiLogicalTime)_federateAmbassador.logicalTimeHLA;
    Time hlaCurrentTime=_convertToPtolemyTime(certiCurrentTime);
    if (hlaCurrentTime.add(_hlaLookAHead).compareTo(currentTime) > 0) {
      uavTimeStamp=hlaCurrentTime.add(_hlaLookAHead);
    }
 else {
      uavTimeStamp=currentTime;
    }
  }
  CertiLogicalTime ct=_convertToCertiLogicalTime(uavTimeStamp);
  if (_debugging) {
    _debug("String_Node_Str" + _getPortFromTab(tObj).getContainer().getName() + "String_Node_Str"+ ct.getTime()+ "String_Node_Str"+ in.toString()+ "String_Node_Str");
  }
  try {
    int id=_registeredObject.get(_federateName + "String_Node_Str" + senderName);
    int indexOfAttribute=0;
    String attributeName=_getPortFromTab(tObj).getContainer().getName();
    for (int i=0; i < _numberOfAttributesToPublish; i++) {
      if (attributeName.equals(_nameOfTheAttributesToPublish[i])) {
        indexOfAttribute=i;
        break;
      }
    }
    String pUAVTimeStamp=ct.getTime() + "String_Node_Str";
    ;
    String preUAVTimeStamp="String_Node_Str" + _printTimes(currentTime) + "String_Node_Str"+ microstep+ "String_Node_Str";
    _storeTimes("String_Node_Str" + _getPortFromTab(tObj).getContainer().getName());
    if (_numberOfUAVs > 0 && (_preUAVsTimes.length() - _preUAVsTimes.lastIndexOf(preUAVTimeStamp)) == preUAVTimeStamp.length() && (_pUAVsTimes.length() - _pUAVsTimes.lastIndexOf(pUAVTimeStamp)) == pUAVTimeStamp.length()) {
      _UAVsValues[indexOfAttribute].replace(_UAVsValues[indexOfAttribute].length() - 2,_UAVsValues[indexOfAttribute].length(),in.toString() + "String_Node_Str");
    }
 else {
      _preUAVsTimes.append(preUAVTimeStamp);
      _pUAVsTimes.append(pUAVTimeStamp);
      for (int i=0; i < _numberOfAttributesToPublish; i++) {
        if (i == indexOfAttribute) {
          _UAVsValues[i].append(in.toString() + "String_Node_Str");
        }
 else {
          _UAVsValues[i].append("String_Node_Str");
        }
      }
    }
    _rtia.updateAttributeValues(id,suppAttributes,tag,ct);
    _numberOfUAVs++;
  }
 catch (  RuntimeException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IllegalActionException(this,e,e.getMessage());
  }
}