Program: 72731
Project: 72731
Buggy source:
/** 
 * Instantiate the slave FMU component.
 * @exception IllegalActionException if it cannot be instantiated.
 */
public void preinitialize() throws IllegalActionException {
  if (_fmiModelDescription == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  super.preinitialize();
  if (_debugging) {
    _debugToStdOut("String_Node_Str");
  }
  try {
    _nativeLibrary=_fmiModelDescription.getNativeLibrary();
  }
 catch (  IOException e1) {
    throw new IllegalActionException(this,e1,"String_Node_Str");
  }
  if (_nativeLibrary == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  _checkFmiCommon();
  try {
    if (_fmiModelDescription.modelExchange) {
      try {
        if (_fmiVersion < 2.0 || !_completedIntegratorStepNotNeeded()) {
          _fmiCompletedIntegratorStepFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        }
      }
 catch (      Throwable throwable) {
        throw new IllegalActionException(this,throwable,"String_Node_Str" + _fmuFileName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
      if (_fmiVersion < 2.0) {
        _fmiFreeModelInstanceFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      _fmiGetContinuousStatesFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      _fmiSetContinuousStates=_fmiModelDescription.getFmiFunction("String_Node_Str");
      _fmiGetDerivativesFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      try {
        _fmiGetEventIndicatorsFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 catch (      UnsatisfiedLinkError ex) {
        _fmiGetEventIndicatorsFunction=null;
      }
      if (_fmiVersion < 2.0) {
        _fmiInitializeFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiInstantiateModelFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 else {
        _fmiEnterInitializationModeFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiExitInitializationModeFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiInstantiateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      _fmiSetTimeFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      _fmiTerminateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      _checkFmiModelExchange();
    }
 else {
      _fmiDoStepFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      if (_fmiVersion < 2.0) {
        try {
          _fmiFreeSlaveInstanceFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        }
 catch (        UnsatisfiedLinkError ex) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
        }
      }
 else {
        try {
          _fmiFreeInstanceFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        }
 catch (        UnsatisfiedLinkError ex) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
        }
      }
      if (_fmiVersion < 2.0) {
        _fmiInitializeSlaveFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiInstantiateSlaveFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 else {
        _fmiInstantiateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      if (_fmiVersion < 2.0) {
        _fmiTerminateSlaveFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 else {
        _fmiTerminateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      try {
        _fmiGetRealStatusFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 catch (      UnsatisfiedLinkError ex) {
        _fmiGetRealStatusFunction=null;
      }
      if (_fmiModelDescription.canGetAndSetFMUstate) {
        _fmiFreeFMUstateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiGetFMUstateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiSetFMUstate=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 else {
        _fmiFreeFMUstateFunction=null;
        _fmiGetFMUstateFunction=null;
        _fmiSetFMUstate=null;
      }
      _checkFmiCoSimulation();
    }
  }
 catch (  IOException ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str");
  }
  String modelIdentifier=_fmiModelDescription.modelIdentifier;
  String mimeType="String_Node_Str";
  double timeout=1000;
  byte toBeVisible=0;
  if (((BooleanToken)visible.getToken()).booleanValue()) {
    toBeVisible=1;
  }
  byte interactive=0;
  byte loggingOn=_debugging ? (byte)1 : (byte)0;
  if (_fmiVersion < 1.5) {
    _callbacks=new FMICallbackFunctions.ByValue(new FMULibrary.FMULogger(_fmiModelDescription),new FMULibrary.FMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
    if (_fmiModelDescription.modelExchange) {
      if (_debugging) {
        _debugToStdOut("String_Node_Str" + modelIdentifier + "String_Node_Str");
      }
      _fmiComponent=(Pointer)_fmiInstantiateModelFunction.invoke(Pointer.class,new Object[]{getFullName(),_fmiModelDescription.guid,_callbacks,loggingOn});
    }
 else {
      if (_debugging) {
        _debugToStdOut("String_Node_Str" + modelIdentifier + "String_Node_Str");
      }
      _fmiComponent=(Pointer)_fmiInstantiateSlaveFunction.invoke(Pointer.class,new Object[]{getFullName(),_fmiModelDescription.guid,_fmiModelDescription.fmuResourceLocation,mimeType,timeout,toBeVisible,interactive,_callbacks,loggingOn});
    }
  }
 else {
    _callbacks=new FMICallbackFunctions(new FMULibrary.FMULogger(_fmiModelDescription),new FMULibrary.FMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
    if (_debugging) {
      _debugToStdOut("String_Node_Str" + modelIdentifier + "String_Node_Str");
    }
    int fmiType=1;
    if (_fmiModelDescription.modelExchange) {
      fmiType=0;
    }
    if (_fmiVersion < 2.0) {
      if (_fmiModelDescription.modelExchange) {
        throw new IllegalActionException(this,"String_Node_Str" + _fmiVersion);
      }
 else {
        _fmiComponent=(Pointer)_fmiInstantiateSlaveFunction.invoke(Pointer.class,new Object[]{getFullName(),_fmiModelDescription.guid,_fmiModelDescription.fmuResourceLocation,_callbacks,toBeVisible,loggingOn});
      }
    }
 else     if (_fmiVersion >= 2.0) {
      _fmiComponent=(Pointer)_fmiInstantiateFunction.invoke(Pointer.class,new Object[]{getFullName(),fmiType,_fmiModelDescription.guid,_fmiModelDescription.fmuResourceLocation,_callbacks,toBeVisible,loggingOn});
      if (_fmiComponent != null && _fmiComponent.equals(Pointer.NULL)) {
        int fmiFlag=((Integer)_fmiEnterInitializationModeFunction.invoke(Integer.class,new Object[]{_fmiComponent})).intValue();
        if (fmiFlag != FMILibrary.FMIStatus.fmiOK) {
          throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + _fmiStatusDescription(fmiFlag));
        }
        fmiFlag=((Integer)_fmiExitInitializationModeFunction.invoke(Integer.class,new Object[]{_fmiComponent})).intValue();
        if (fmiFlag != FMILibrary.FMIStatus.fmiOK) {
          throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + _fmiStatusDescription(fmiFlag));
        }
      }
    }
  }
  if (_fmiComponent == null || _fmiComponent.equals(Pointer.NULL)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Instantiate the slave FMU component.
 * @exception IllegalActionException if it cannot be instantiated.
 */
public void preinitialize() throws IllegalActionException {
  if (_fmiModelDescription == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  super.preinitialize();
  if (_debugging) {
    _debugToStdOut("String_Node_Str");
  }
  try {
    _nativeLibrary=_fmiModelDescription.getNativeLibrary();
  }
 catch (  IOException e1) {
    throw new IllegalActionException(this,e1,"String_Node_Str");
  }
  if (_nativeLibrary == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  _checkFmiCommon();
  try {
    if (_fmiModelDescription.modelExchange) {
      try {
        if (_fmiVersion < 2.0 || !_completedIntegratorStepNotNeeded()) {
          _fmiCompletedIntegratorStepFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        }
      }
 catch (      Throwable throwable) {
        throw new IllegalActionException(this,throwable,"String_Node_Str" + _fmuFileName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
      if (_fmiVersion < 2.0) {
        try {
          _fmiFreeModelInstanceFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        }
 catch (        UnsatisfiedLinkError ex) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
        }
      }
 else {
        try {
          _fmiFreeInstanceFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        }
 catch (        UnsatisfiedLinkError ex) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
        }
      }
      _fmiGetContinuousStatesFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      _fmiSetContinuousStates=_fmiModelDescription.getFmiFunction("String_Node_Str");
      _fmiGetDerivativesFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      try {
        _fmiGetEventIndicatorsFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 catch (      UnsatisfiedLinkError ex) {
        _fmiGetEventIndicatorsFunction=null;
      }
      if (_fmiVersion < 2.0) {
        _fmiInitializeFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiInstantiateModelFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 else {
        _fmiEnterInitializationModeFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiExitInitializationModeFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiInstantiateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      _fmiSetTimeFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      _fmiTerminateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      _checkFmiModelExchange();
    }
 else {
      _fmiDoStepFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      if (_fmiVersion < 2.0) {
        try {
          _fmiFreeSlaveInstanceFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        }
 catch (        UnsatisfiedLinkError ex) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
        }
      }
 else {
        try {
          _fmiFreeInstanceFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        }
 catch (        UnsatisfiedLinkError ex) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
        }
      }
      if (_fmiVersion < 2.0) {
        _fmiInitializeSlaveFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiInstantiateSlaveFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 else {
        _fmiInstantiateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      if (_fmiVersion < 2.0) {
        _fmiTerminateSlaveFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 else {
        _fmiTerminateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      try {
        _fmiGetRealStatusFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 catch (      UnsatisfiedLinkError ex) {
        _fmiGetRealStatusFunction=null;
      }
      if (_fmiModelDescription.canGetAndSetFMUstate) {
        _fmiFreeFMUstateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiGetFMUstateFunction=_fmiModelDescription.getFmiFunction("String_Node_Str");
        _fmiSetFMUstate=_fmiModelDescription.getFmiFunction("String_Node_Str");
      }
 else {
        _fmiFreeFMUstateFunction=null;
        _fmiGetFMUstateFunction=null;
        _fmiSetFMUstate=null;
      }
      _checkFmiCoSimulation();
    }
  }
 catch (  IOException ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str");
  }
  String modelIdentifier=_fmiModelDescription.modelIdentifier;
  String mimeType="String_Node_Str";
  double timeout=1000;
  byte toBeVisible=0;
  if (((BooleanToken)visible.getToken()).booleanValue()) {
    toBeVisible=1;
  }
  byte interactive=0;
  byte loggingOn=_debugging ? (byte)1 : (byte)0;
  if (_fmiVersion < 1.5) {
    _callbacks=new FMICallbackFunctions.ByValue(new FMULibrary.FMULogger(_fmiModelDescription),new FMULibrary.FMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
    if (_fmiModelDescription.modelExchange) {
      if (_debugging) {
        _debugToStdOut("String_Node_Str" + modelIdentifier + "String_Node_Str");
      }
      _fmiComponent=(Pointer)_fmiInstantiateModelFunction.invoke(Pointer.class,new Object[]{getFullName(),_fmiModelDescription.guid,_callbacks,loggingOn});
    }
 else {
      if (_debugging) {
        _debugToStdOut("String_Node_Str" + modelIdentifier + "String_Node_Str");
      }
      _fmiComponent=(Pointer)_fmiInstantiateSlaveFunction.invoke(Pointer.class,new Object[]{getFullName(),_fmiModelDescription.guid,_fmiModelDescription.fmuResourceLocation,mimeType,timeout,toBeVisible,interactive,_callbacks,loggingOn});
    }
  }
 else {
    _callbacks=new FMICallbackFunctions(new FMULibrary.FMULogger(_fmiModelDescription),new FMULibrary.FMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
    if (_debugging) {
      _debugToStdOut("String_Node_Str" + modelIdentifier + "String_Node_Str");
    }
    int fmiType=1;
    if (_fmiModelDescription.modelExchange) {
      fmiType=0;
    }
    if (_fmiVersion < 2.0) {
      if (_fmiModelDescription.modelExchange) {
        throw new IllegalActionException(this,"String_Node_Str" + _fmiVersion);
      }
 else {
        _fmiComponent=(Pointer)_fmiInstantiateSlaveFunction.invoke(Pointer.class,new Object[]{getFullName(),_fmiModelDescription.guid,_fmiModelDescription.fmuResourceLocation,_callbacks,toBeVisible,loggingOn});
      }
    }
 else     if (_fmiVersion >= 2.0) {
      _fmiComponent=(Pointer)_fmiInstantiateFunction.invoke(Pointer.class,new Object[]{getFullName(),fmiType,_fmiModelDescription.guid,_fmiModelDescription.fmuResourceLocation,_callbacks,toBeVisible,loggingOn});
      if (_fmiComponent != null && _fmiComponent.equals(Pointer.NULL)) {
        int fmiFlag=((Integer)_fmiEnterInitializationModeFunction.invoke(Integer.class,new Object[]{_fmiComponent})).intValue();
        if (fmiFlag != FMILibrary.FMIStatus.fmiOK) {
          throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + _fmiStatusDescription(fmiFlag));
        }
        fmiFlag=((Integer)_fmiExitInitializationModeFunction.invoke(Integer.class,new Object[]{_fmiComponent})).intValue();
        if (fmiFlag != FMILibrary.FMIStatus.fmiOK) {
          throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + _fmiStatusDescription(fmiFlag));
        }
      }
    }
  }
  if (_fmiComponent == null || _fmiComponent.equals(Pointer.NULL)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
}