Program: 72801
Project: 72801
Buggy source:
/** 
 * Modify parameter(s) and variable(s) of the Modelica model before building the Modelica model.
 * @param values The new values to change the value of the components.
 * @param modelName The (base-)model that should be built.
 * @param components The name of the components to change.
 * @exception ConnectException If commands couldn'tbe sent to the (OpenModelica Compiler)OMC.
 * @exception IllegalActionException
 */
public void modifyComponents(String values,String modelName,String components) throws IllegalActionException, ConnectException {
  String childModel=modelName;
  String childKey=null;
  String loggerInfo=null;
  boolean found=false;
  HashMap<String,String> baseIndividualComponent=null;
  HashMap<String,String> childIndividualComponent=null;
  CompilerResult getComponentModifierNames=null;
  CompilerResult getNthInheritanceClassResult=null;
  String parameterDelimiter="String_Node_Str";
  String valueDelimiter="String_Node_Str";
  String[] parameterList=components.split(parameterDelimiter);
  String[] valueList=values.split(valueDelimiter);
  String[] variableList=null;
  try {
    childIndividualComponent=getModelComponent(childModel);
    if (childIndividualComponent != null) {
      if (parameterList.length == valueList.length) {
        for (int i=0; i < parameterList.length; i++) {
          if (getInheritanceCount(childModel)) {
            for (int j=1; j <= 2; j++) {
              getNthInheritanceClassResult=sendCommand("String_Node_Str" + childModel + "String_Node_Str"+ j+ "String_Node_Str");
              if (getNthInheritanceClassResult.getError().isEmpty() && !getNthInheritanceClassResult.getFirstResult().trim().toString().contains("String_Node_Str")) {
                baseIndividualComponent=getModelComponent(getNthInheritanceClassResult.getFirstResult().toString());
                if (baseIndividualComponent != null) {
                  Iterator baseIterator=baseIndividualComponent.keySet().iterator();
                  while (baseIterator.hasNext()) {
                    String key=baseIterator.next().toString();
                    if (parameterList[i].equalsIgnoreCase(key)) {
                      found=true;
                      CompilerResult extendModifierValueResult=sendCommand("String_Node_Str" + childModel + "String_Node_Str"+ getNthInheritanceClassResult.getFirstResult().trim().toString()+ "String_Node_Str"+ key+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                      if (extendModifierValueResult.getError().isEmpty() && !extendModifierValueResult.getFirstResult().trim().toString().contains("String_Node_Str")) {
                        loggerInfo="String_Node_Str" + key + "String_Node_Str"+ getNthInheritanceClassResult.getFirstResult().trim().toString()+ "String_Node_Str"+ valueList[i]+ "String_Node_Str";
                        _omcLogger.getInfo(loggerInfo);
                      }
 else {
                        loggerInfo=extendModifierValueResult.getError();
                        _omcLogger.getInfo(loggerInfo);
                        throw new ConnectException(loggerInfo);
                      }
                    }
                  }
                }
              }
            }
          }
          Iterator childIterator=childIndividualComponent.keySet().iterator();
          while (childIterator.hasNext()) {
            childKey=childIterator.next().toString();
            if (childKey.equalsIgnoreCase(parameterList[i])) {
              found=true;
              if (childIndividualComponent.get(childKey).compareTo("String_Node_Str") == 0) {
                getComponentModifierNames=sendCommand("String_Node_Str" + modelName + "String_Node_Str"+ childKey+ "String_Node_Str");
                if (!getComponentModifierNames.getError().toString().isEmpty()) {
                  _omcLogger.getInfo(getComponentModifierNames.getError().toString());
                }
                if (getComponentModifierNames.getFirstResult().trim().compareTo("String_Node_Str") == 0) {
                  CompilerResult unspecifiedModifier=sendCommand("String_Node_Str" + modelName + "String_Node_Str"+ childKey+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                  if (unspecifiedModifier.getError().toString().isEmpty()) {
                    _omcLogger.getInfo("String_Node_Str" + childKey + "String_Node_Str"+ modelName+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                  }
                }
 else {
                  StringBuffer componentsBuffer=new StringBuffer(getComponentModifierNames.getFirstResult().trim().toString());
                  componentsBuffer.deleteCharAt(0);
                  String variableNames=componentsBuffer.deleteCharAt(componentsBuffer.length() - 1).toString();
                  variableList=variableNames.split(valueDelimiter);
                  for (                  String variables : variableList) {
                    String tempParameter=childKey + "String_Node_Str" + variables;
                    CompilerResult setComponentModifierValueResult=sendCommand("String_Node_Str" + modelName + "String_Node_Str"+ tempParameter+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                    if (setComponentModifierValueResult.getError().toString().isEmpty()) {
                      loggerInfo="String_Node_Str" + childKey + "String_Node_Str"+ variables+ "String_Node_Str"+ modelName+ "String_Node_Str"+ valueList[i]+ "String_Node_Str";
                      _omcLogger.getInfo(loggerInfo);
                    }
 else {
                      loggerInfo=setComponentModifierValueResult.getError();
                      _omcLogger.getInfo(loggerInfo);
                    }
                  }
                }
              }
              if (childIndividualComponent.get(childKey).compareTo("String_Node_Str") == 0) {
                CompilerResult parameterChange=sendCommand("String_Node_Str" + modelName + "String_Node_Str"+ childKey+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                if (parameterChange.getError().toString().isEmpty()) {
                  loggerInfo="String_Node_Str" + childKey + "String_Node_Str"+ modelName+ "String_Node_Str"+ valueList[i]+ "String_Node_Str";
                  _omcLogger.getInfo(loggerInfo);
                }
 else {
                  loggerInfo=getNthInheritanceClassResult.getError();
                  _omcLogger.getInfo(loggerInfo);
                }
              }
 else               if (childIndividualComponent.get(childKey).compareTo("String_Node_Str") == 0) {
                _omcLogger.getInfo("String_Node_Str" + components + "String_Node_Str"+ modelName+ "String_Node_Str");
              }
            }
          }
        }
        if (!found) {
          _omcLogger.getInfo(components + "String_Node_Str" + modelName+ "String_Node_Str");
        }
      }
 else {
        _omcLogger.getInfo("String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    throw new IllegalActionException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Modify parameter(s) and variable(s) of the Modelica model before building the model.
 * @param values The new values to change the value of the components.
 * @param modelName The (base-)model that should be built.
 * @param components The name of the components to change.
 * @exception ConnectException If commands couldn'tbe sent to the (OpenModelica Compiler)OMC.
 * @exception IllegalActionException
 */
public void modifyComponents(String values,String modelName,String components) throws IllegalActionException, ConnectException {
  String childModel=modelName;
  String childKey=null;
  String loggerInfo=null;
  boolean found=false;
  HashMap<String,String> baseIndividualComponent=null;
  HashMap<String,String> childIndividualComponent=null;
  CompilerResult getComponentModifierNames=null;
  CompilerResult getNthInheritanceClassResult=null;
  String parameterDelimiter="String_Node_Str";
  String valueDelimiter="String_Node_Str";
  String[] parameterList=components.split(parameterDelimiter);
  String[] valueList=values.split(valueDelimiter);
  String[] variableList=null;
  try {
    childIndividualComponent=getModelComponent(childModel);
    if (childIndividualComponent != null) {
      if (parameterList.length == valueList.length) {
        for (int i=0; i < parameterList.length; i++) {
          if (getInheritanceCount(childModel)) {
            for (int j=1; j <= 2; j++) {
              getNthInheritanceClassResult=sendCommand("String_Node_Str" + childModel + "String_Node_Str"+ j+ "String_Node_Str");
              if (getNthInheritanceClassResult.getError().isEmpty() && !getNthInheritanceClassResult.getFirstResult().trim().toString().contains("String_Node_Str")) {
                baseIndividualComponent=getModelComponent(getNthInheritanceClassResult.getFirstResult().toString());
                if (baseIndividualComponent != null) {
                  Iterator baseIterator=baseIndividualComponent.keySet().iterator();
                  while (baseIterator.hasNext()) {
                    String key=baseIterator.next().toString();
                    if (parameterList[i].equalsIgnoreCase(key)) {
                      found=true;
                      CompilerResult extendModifierValueResult=sendCommand("String_Node_Str" + childModel + "String_Node_Str"+ getNthInheritanceClassResult.getFirstResult().trim().toString()+ "String_Node_Str"+ key+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                      if (extendModifierValueResult.getError().isEmpty() && !extendModifierValueResult.getFirstResult().trim().toString().contains("String_Node_Str")) {
                        loggerInfo="String_Node_Str" + key + "String_Node_Str"+ getNthInheritanceClassResult.getFirstResult().trim().toString()+ "String_Node_Str"+ valueList[i]+ "String_Node_Str";
                        _omcLogger.getInfo(loggerInfo);
                      }
 else {
                        loggerInfo=extendModifierValueResult.getError();
                        _omcLogger.getInfo(loggerInfo);
                        throw new ConnectException(loggerInfo);
                      }
                    }
                  }
                }
              }
            }
          }
          Iterator childIterator=childIndividualComponent.keySet().iterator();
          while (childIterator.hasNext()) {
            childKey=childIterator.next().toString();
            if (childKey.equalsIgnoreCase(parameterList[i])) {
              found=true;
              if (childIndividualComponent.get(childKey).compareTo("String_Node_Str") == 0) {
                getComponentModifierNames=sendCommand("String_Node_Str" + modelName + "String_Node_Str"+ childKey+ "String_Node_Str");
                if (!getComponentModifierNames.getError().toString().isEmpty()) {
                  _omcLogger.getInfo(getComponentModifierNames.getError().toString());
                }
                if (getComponentModifierNames.getFirstResult().trim().compareTo("String_Node_Str") == 0) {
                  CompilerResult unspecifiedModifier=sendCommand("String_Node_Str" + modelName + "String_Node_Str"+ childKey+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                  if (unspecifiedModifier.getError().toString().isEmpty()) {
                    _omcLogger.getInfo("String_Node_Str" + childKey + "String_Node_Str"+ modelName+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                  }
                }
 else {
                  StringBuffer componentsBuffer=new StringBuffer(getComponentModifierNames.getFirstResult().trim().toString());
                  componentsBuffer.deleteCharAt(0);
                  String variableNames=componentsBuffer.deleteCharAt(componentsBuffer.length() - 1).toString();
                  variableList=variableNames.split(valueDelimiter);
                  for (                  String variables : variableList) {
                    String tempParameter=childKey + "String_Node_Str" + variables;
                    CompilerResult setComponentModifierValueResult=sendCommand("String_Node_Str" + modelName + "String_Node_Str"+ tempParameter+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                    if (setComponentModifierValueResult.getError().toString().isEmpty()) {
                      loggerInfo="String_Node_Str" + childKey + "String_Node_Str"+ variables+ "String_Node_Str"+ modelName+ "String_Node_Str"+ valueList[i]+ "String_Node_Str";
                      _omcLogger.getInfo(loggerInfo);
                    }
 else {
                      loggerInfo=setComponentModifierValueResult.getError();
                      _omcLogger.getInfo(loggerInfo);
                    }
                  }
                }
              }
              if (childIndividualComponent.get(childKey).compareTo("String_Node_Str") == 0) {
                CompilerResult parameterChange=sendCommand("String_Node_Str" + modelName + "String_Node_Str"+ childKey+ "String_Node_Str"+ valueList[i]+ "String_Node_Str");
                if (parameterChange.getError().toString().isEmpty()) {
                  loggerInfo="String_Node_Str" + childKey + "String_Node_Str"+ modelName+ "String_Node_Str"+ valueList[i]+ "String_Node_Str";
                  _omcLogger.getInfo(loggerInfo);
                }
 else {
                  loggerInfo=getNthInheritanceClassResult.getError();
                  _omcLogger.getInfo(loggerInfo);
                }
              }
 else               if (childIndividualComponent.get(childKey).compareTo("String_Node_Str") == 0) {
                _omcLogger.getInfo("String_Node_Str" + components + "String_Node_Str"+ modelName+ "String_Node_Str");
              }
            }
          }
        }
        if (!found) {
          _omcLogger.getInfo(components + "String_Node_Str" + modelName+ "String_Node_Str");
        }
      }
 else {
        _omcLogger.getInfo("String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    throw new IllegalActionException(e.getMessage());
  }
}