Program: 73206
Project: 73206
Buggy source:
/** 
 * Import a FMUFile.
 * @param originator The originator of the change request.
 * @param fmuFileName The .fmuFile
 * @param context The context in which the FMU actor is created.
 * @param x The x-axis value of the actor to be created.
 * @param y The y-axis value of the actor to be created.
 * @exception IllegalActionException If there is a problem instantiating the actor.
 * @exception IOException If there is a problem parsing the fmu file.
 */
public static void importFMU(Object originator,String fmuFileName,NamedObj context,double x,double y) throws IllegalActionException, IOException {
  FMIModelDescription fmiModelDescription=FMUFile.parseFMUFile(fmuFileName);
  String source="String_Node_Str";
  if (fmuFileName.startsWith("String_Node_Str")) {
    source="String_Node_Str" + fmuFileName.trim() + "String_Node_Str";
  }
  String rootName=new File(fmuFileName).getName();
  int index=rootName.lastIndexOf('.');
  if (index != -1) {
    rootName=rootName.substring(0,index);
  }
  int maximumNumberOfPortsToDisplay=20;
  int modelVariablesLength=fmiModelDescription.modelVariables.size();
  String hide="String_Node_Str";
  if (modelVariablesLength > maximumNumberOfPortsToDisplay) {
    MessageHandler.message("String_Node_Str" + fmuFileName + "String_Node_Str"+ modelVariablesLength+ "String_Node_Str"+ "String_Node_Str");
    hide="String_Node_Str" + "String_Node_Str";
  }
  int portCount=0;
  StringBuffer parameterMoML=new StringBuffer();
  StringBuffer portMoML=new StringBuffer();
  for (  FMIScalarVariable scalar : fmiModelDescription.modelVariables) {
    if (scalar.variability == FMIScalarVariable.Variability.parameter) {
      parameterMoML.append("String_Node_Str" + StringUtilities.sanitizeName(scalar.name) + "String_Node_Str"+ scalar.type+ "String_Node_Str");
    }
 else {
      String causality="String_Node_Str";
switch (scalar.causality) {
case internal:
        System.out.println("String_Node_Str" + fmuFileName + "String_Node_Str"+ scalar.causality+ "String_Node_Str"+ scalar.name);
      continue;
case input:
    causality="String_Node_Str";
  break;
case output:
case none:
causality="String_Node_Str";
break;
}
portMoML.append("String_Node_Str" + StringUtilities.sanitizeName(scalar.name) + "String_Node_Str"+ "String_Node_Str"+ causality+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ _fmiType2PtolemyType(scalar.type)+ "String_Node_Str"+ (portCount++ > maximumNumberOfPortsToDisplay ? hide : "String_Node_Str")+ "String_Node_Str");
}
}
String moml="String_Node_Str" + "String_Node_Str" + rootName + "String_Node_Str"+ source+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ fmuFileName+ "String_Node_Str"+ parameterMoML+ portMoML+ "String_Node_Str";
MoMLChangeRequest request=new MoMLChangeRequest(originator,context,moml);
context.requestChange(request);
}

Fixed version (ground truth):
/** 
 * Import a FMUFile.
 * @param originator The originator of the change request.
 * @param fmuFileName The .fmuFile
 * @param context The context in which the FMU actor is created.
 * @param x The x-axis value of the actor to be created.
 * @param y The y-axis value of the actor to be created.
 * @exception IllegalActionException If there is a problem instantiating the actor.
 * @exception IOException If there is a problem parsing the fmu file.
 */
public static void importFMU(Object originator,String fmuFileName,NamedObj context,double x,double y) throws IllegalActionException, IOException {
  FMIModelDescription fmiModelDescription=FMUFile.parseFMUFile(fmuFileName);
  String source="String_Node_Str";
  if (fmuFileName.startsWith("String_Node_Str")) {
    source="String_Node_Str" + fmuFileName.trim() + "String_Node_Str";
  }
  String rootName=new File(fmuFileName).getName();
  int index=rootName.lastIndexOf('.');
  if (index != -1) {
    rootName=rootName.substring(0,index);
  }
  int maximumNumberOfPortsToDisplay=20;
  int modelVariablesLength=fmiModelDescription.modelVariables.size();
  String hide="String_Node_Str";
  if (modelVariablesLength > maximumNumberOfPortsToDisplay) {
    MessageHandler.message("String_Node_Str" + fmuFileName + "String_Node_Str"+ modelVariablesLength+ "String_Node_Str"+ "String_Node_Str");
  }
  int portCount=0;
  StringBuffer parameterMoML=new StringBuffer();
  StringBuffer portMoML=new StringBuffer();
  for (  FMIScalarVariable scalar : fmiModelDescription.modelVariables) {
    if (scalar.variability == FMIScalarVariable.Variability.parameter) {
      parameterMoML.append("String_Node_Str" + StringUtilities.sanitizeName(scalar.name) + "String_Node_Str"+ scalar.type+ "String_Node_Str");
    }
 else {
      String internalHide="String_Node_Str";
      String causality="String_Node_Str";
switch (scalar.causality) {
case input:
        causality="String_Node_Str";
      break;
case none:
    continue;
case output:
case internal:
  causality="String_Node_Str";
break;
}
portMoML.append("String_Node_Str" + StringUtilities.sanitizeName(scalar.name) + "String_Node_Str"+ "String_Node_Str"+ causality+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ _fmiType2PtolemyType(scalar.type)+ "String_Node_Str"+ (portCount++ > maximumNumberOfPortsToDisplay || scalar.causality == Causality.internal ? hide : "String_Node_Str")+ "String_Node_Str");
}
}
String moml="String_Node_Str" + "String_Node_Str" + rootName + "String_Node_Str"+ source+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ fmuFileName+ "String_Node_Str"+ "String_Node_Str"+ parameterMoML+ portMoML+ "String_Node_Str";
MoMLChangeRequest request=new MoMLChangeRequest(originator,context,moml);
context.requestChange(request);
}