Program: 180323
Project: 180323
Buggy source:
private static OdeSystem setup(Model model){
  Map<String,Variable> variablesMemory=new HashMap<>();
  Map<String,Parameter> parametersMemory=new HashMap<>();
  List<SubstitutionValue> substitutionValues=new ArrayList<>();
  Map<Variable,List<Expression>> positives=new HashMap<>();
  Map<Variable,List<Expression>> negatives=new HashMap<>();
  List<Variable> variables=new ArrayList<>();
  List<VariableValue> variableValues=new ArrayList<>();
  List<ParameterValue> parameterValues=new ArrayList<>();
  for (  Species species : model.getListOfSpecies()) {
    if (species.getId() == null || species.getId().isEmpty()) {
      LOGGER.warn("String_Node_Str");
      continue;
    }
    Variable var=new Variable(species.getName() == null || species.getName().isEmpty() ? species.getId() : species.getName(),variables.size());
    variablesMemory.put(species.getId(),var);
    variables.add(var);
    variableValues.add(new VariableValue(var,(float)species.getInitialConcentration()));
  }
  for (  org.sbml.jsbml.Parameter p : model.getListOfParameters()) {
    if (p.getId() == null || p.getId().isEmpty()) {
      LOGGER.warn("String_Node_Str");
      continue;
    }
    if (new Double(p.getValue()).equals(Double.NaN)) {
      throw new IllegalStateException("String_Node_Str" + p.getId() + "String_Node_Str");
    }
    Parameter param=new Parameter(p.getName() == null || p.getName().isEmpty() ? p.getId() : p.getName(),variables.size() + parametersMemory.size());
    parametersMemory.put(p.getId(),param);
    ParameterValue pv=new ParameterValue(param,(float)p.getValue());
    substitutionValues.add(pv);
    parameterValues.add(pv);
  }
  for (  Reaction reaction : model.getListOfReactions()) {
    String reactionName=reaction.getName() == null || reaction.getName().isEmpty() ? reaction.getId() : reaction.getName();
    Map<String,Parameter> localParameters=new HashMap<>();
    for (    org.sbml.jsbml.LocalParameter p : reaction.getKineticLaw().getListOfLocalParameters()) {
      if (p.getId() == null || p.getId().isEmpty()) {
        LOGGER.warn("String_Node_Str");
      }
      String paramLocalName=p.getName() == null || p.getName().isEmpty() ? p.getId() : p.getName();
      String paramGloabalName=reactionName + "String_Node_Str" + paramLocalName;
      if (new Double(p.getValue()).equals(Double.NaN)) {
        throw new IllegalStateException("String_Node_Str" + paramLocalName + "String_Node_Str"+ reactionName+ "String_Node_Str");
      }
      if (parametersMemory.containsKey(paramGloabalName)) {
        throw new IllegalStateException("String_Node_Str" + paramLocalName + "String_Node_Str"+ reactionName+ "String_Node_Str"+ paramGloabalName+ "String_Node_Str");
      }
      Parameter parameter=new Parameter(paramGloabalName,variables.size() + parametersMemory.size());
      ParameterValue pv=new ParameterValue(parameter,(float)p.getValue());
      parameterValues.add(pv);
      substitutionValues.add(pv);
      localParameters.put(paramLocalName,parameter);
      parametersMemory.put(paramGloabalName,parameter);
    }
    Expression kineticLaw=createExpression(reaction.getKineticLaw().getMath(),variablesMemory,parametersMemory,localParameters);
    if (kineticLaw == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    for (    SpeciesReference speciesReference : reaction.getListOfReactants()) {
      if (speciesReference.getSpecies() == null || speciesReference.getSpecies().isEmpty()) {
        LOGGER.warn("String_Node_Str");
        continue;
      }
      Variable variable=variablesMemory.get(speciesReference.getSpecies());
      if (!negatives.containsKey(variable)) {
        negatives.put(variable,new ArrayList<Expression>());
      }
      negatives.get(variable).add(kineticLaw);
    }
    for (    SpeciesReference speciesReference : reaction.getListOfProducts()) {
      if (speciesReference.getSpecies() == null || speciesReference.getSpecies().isEmpty()) {
        LOGGER.warn("String_Node_Str");
        continue;
      }
      Variable variable=variablesMemory.get(speciesReference.getSpecies());
      if (!positives.containsKey(variable)) {
        positives.put(variable,new ArrayList<Expression>());
      }
      positives.get(variable).add(kineticLaw);
    }
    if (reaction.isReversible()) {
      LOGGER.warn("String_Node_Str");
    }
  }
  List<OdeSystemVariable> result=new ArrayList<>();
  for (  Variable variable : variables) {
    List<Expression> pos=positives.get(variable);
    List<Expression> neg=negatives.get(variable);
    Expression rs=null;
    if (pos != null) {
      for (      Expression e : pos) {
        if (rs == null) {
          rs=e;
        }
 else {
          rs=new Plus(rs,e);
        }
      }
    }
    if (neg != null) {
      for (      Expression e : neg) {
        if (rs == null) {
          rs=new Negation(e);
        }
 else {
          rs=new Minus(rs,e);
        }
      }
    }
    if (rs == null) {
      rs=new Constant(0);
    }
    result.add(new OdeSystemVariable(variable,rs.substitute(substitutionValues)));
  }
  return new SimpleOdeSystem(result,variableValues,parameterValues);
}

Fixed version (ground truth):
private static OdeSystem setup(Model model){
  Map<String,Variable> variablesMemory=new HashMap<>();
  Map<String,Parameter> parametersMemory=new HashMap<>();
  List<SubstitutionValue> substitutionValues=new ArrayList<>();
  Map<Variable,List<Expression>> positives=new HashMap<>();
  Map<Variable,List<Expression>> negatives=new HashMap<>();
  List<Variable> variables=new ArrayList<>();
  List<VariableValue> variableValues=new ArrayList<>();
  List<ParameterValue> parameterValues=new ArrayList<>();
  for (  Species species : model.getListOfSpecies()) {
    if (species.getId() == null || species.getId().isEmpty()) {
      LOGGER.warn("String_Node_Str");
      continue;
    }
    Variable var=new Variable(species.getName() == null || species.getName().isEmpty() ? species.getId() : species.getName(),variables.size());
    variablesMemory.put(species.getId(),var);
    variables.add(var);
    variableValues.add(new VariableValue(var,(float)species.getInitialConcentration()));
  }
  for (  org.sbml.jsbml.Parameter p : model.getListOfParameters()) {
    if (p.getId() == null || p.getId().isEmpty()) {
      LOGGER.warn("String_Node_Str");
      continue;
    }
    if (new Double(p.getValue()).equals(Double.NaN)) {
      throw new IllegalStateException("String_Node_Str" + p.getId() + "String_Node_Str");
    }
    Parameter param=new Parameter(p.getName() == null || p.getName().isEmpty() ? p.getId() : p.getName(),variables.size() + parametersMemory.size());
    parametersMemory.put(p.getId(),param);
    ParameterValue pv=new ParameterValue(param,(float)p.getValue());
    substitutionValues.add(pv);
    parameterValues.add(pv);
  }
  for (  Reaction reaction : model.getListOfReactions()) {
    String reactionName=reaction.getName() == null || reaction.getName().isEmpty() ? reaction.getId() : reaction.getName();
    Map<String,Parameter> localParameters=new HashMap<>();
    LOGGER.debug("String_Node_Str" + reaction.getId());
    for (    org.sbml.jsbml.LocalParameter p : reaction.getKineticLaw().getListOfLocalParameters()) {
      if (p.getId() == null || p.getId().isEmpty()) {
        LOGGER.warn("String_Node_Str" + reaction.getId() + "String_Node_Str");
      }
      String paramLocalName=p.getName() == null || p.getName().isEmpty() ? p.getId() : p.getName();
      String paramGloabalName=reactionName + "String_Node_Str" + paramLocalName;
      if (new Double(p.getValue()).equals(Double.NaN)) {
        throw new IllegalStateException("String_Node_Str" + paramLocalName + "String_Node_Str"+ reactionName+ "String_Node_Str");
      }
      if (parametersMemory.containsKey(paramGloabalName)) {
        throw new IllegalStateException("String_Node_Str" + paramLocalName + "String_Node_Str"+ reactionName+ "String_Node_Str"+ paramGloabalName+ "String_Node_Str");
      }
      Parameter parameter=new Parameter(paramGloabalName,variables.size() + parametersMemory.size());
      ParameterValue pv=new ParameterValue(parameter,(float)p.getValue());
      parameterValues.add(pv);
      substitutionValues.add(pv);
      localParameters.put(paramLocalName,parameter);
      parametersMemory.put(paramGloabalName,parameter);
    }
    Expression kineticLaw=createExpression(reaction.getKineticLaw().getMath(),variablesMemory,parametersMemory,localParameters);
    if (kineticLaw == null) {
      throw new IllegalStateException("String_Node_Str" + reaction.getId() + "String_Node_Str");
    }
    for (    SpeciesReference speciesReference : reaction.getListOfReactants()) {
      if (speciesReference.getSpecies() == null || speciesReference.getSpecies().isEmpty()) {
        LOGGER.warn("String_Node_Str" + reaction.getId() + "String_Node_Str");
        continue;
      }
      Variable variable=variablesMemory.get(speciesReference.getSpecies());
      if (!negatives.containsKey(variable)) {
        negatives.put(variable,new ArrayList<Expression>());
      }
      negatives.get(variable).add(kineticLaw);
    }
    for (    SpeciesReference speciesReference : reaction.getListOfProducts()) {
      if (speciesReference.getSpecies() == null || speciesReference.getSpecies().isEmpty()) {
        LOGGER.warn("String_Node_Str");
        continue;
      }
      Variable variable=variablesMemory.get(speciesReference.getSpecies());
      if (!positives.containsKey(variable)) {
        positives.put(variable,new ArrayList<Expression>());
      }
      positives.get(variable).add(kineticLaw);
    }
    if (reaction.isReversible()) {
      LOGGER.warn("String_Node_Str");
    }
  }
  List<OdeSystemVariable> result=new ArrayList<>();
  for (  Variable variable : variables) {
    List<Expression> pos=positives.get(variable);
    List<Expression> neg=negatives.get(variable);
    Expression rs=null;
    if (pos != null) {
      for (      Expression e : pos) {
        if (rs == null) {
          rs=e;
        }
 else {
          rs=new Plus(rs,e);
        }
      }
    }
    if (neg != null) {
      for (      Expression e : neg) {
        if (rs == null) {
          rs=new Negation(e);
        }
 else {
          rs=new Minus(rs,e);
        }
      }
    }
    if (rs == null) {
      rs=new Constant(0);
    }
    result.add(new OdeSystemVariable(variable,rs.substitute(substitutionValues)));
  }
  return new SimpleOdeSystem(result,variableValues,parameterValues);
}