Program: 74025
Project: 74025
Buggy source:
/** 
 * Resolve the property values for the toplevel entity that contains this solver, given the model analyzer that invokes this.
 * @param analyzer The given model analyzer.
 */
protected void _resolveProperties(NamedObj analyzer) throws KernelException {
  super._resolveProperties(analyzer);
  NamedObj toplevel=_toplevel();
  PropertyConstraintHelper toplevelHelper=(PropertyConstraintHelper)getHelper(toplevel);
  toplevelHelper.reinitialize();
  toplevelHelper._addDefaultConstraints(_getConstraintType(actorConstraintType.stringValue()));
  toplevelHelper._setConnectionConstraintType(_getConstraintType(connectionConstraintType.stringValue()),_getConstraintType(compositeConnectionConstraintType.stringValue()),_getConstraintType(fsmConstraintType.stringValue()),_getConstraintType(expressionASTNodeConstraintType.stringValue()));
  Writer writer=null;
  try {
    List<Inequality> conflicts=new LinkedList<Inequality>();
    List<Inequality> unacceptable=new LinkedList<Inequality>();
    List<Inequality> constraintList=toplevelHelper.constraintList();
    if (constraintList.size() > 0) {
      CPO cpo=getLattice();
      InequalitySolver solver=new InequalitySolver(cpo,this);
      Iterator constraints=constraintList.iterator();
      solver.addInequalities(constraints);
      _constraintManager.setConstraints(constraintList);
      getStats().put("String_Node_Str",constraintList.size());
      getStats().put("String_Node_Str",_propertyTermManager.terms().size());
      File file=null;
      Date date=new Date();
      String timestamp=date.toString().replace("String_Node_Str","String_Node_Str");
      String logFilename=getContainer().getName() + "String_Node_Str" + getUseCaseName()+ "String_Node_Str"+ timestamp.replace("String_Node_Str","String_Node_Str")+ "String_Node_Str";
      if (super.isResolve() && isLogMode()) {
        String directoryPath=logDirectory.getExpression();
        directoryPath+=directoryPath.endsWith("String_Node_Str") || directoryPath.endsWith("String_Node_Str") ? "String_Node_Str" : "String_Node_Str";
        if (directoryPath.startsWith("String_Node_Str")) {
          URI directory=new File(URIAttribute.getModelURI(this)).getParentFile().toURI();
          file=FileUtilities.nameToFile(directoryPath.substring(11) + logFilename,directory);
        }
 else {
          if (!logDirectory.asFile().exists()) {
            logDirectory.asFile().mkdirs();
          }
          file=FileUtilities.nameToFile(logFilename,logDirectory.asFile().toURI());
        }
        try {
          if (!file.exists()) {
            if (!file.getParentFile().exists()) {
              file.getParentFile().mkdirs();
            }
            file.createNewFile();
          }
          writer=new FileWriter(file);
          writer.write(_getStatsAsString("String_Node_Str"));
          writer.write(_getConstraintsAsLogFileString(constraintList,"String_Node_Str"));
        }
 catch (        IOException ex) {
          throw new PropertyResolutionException(this,ex,"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
        }
      }
      if (super.isResolve() && isLogMode()) {
        String constraintFilename=_getTrainedConstraintFilename() + "String_Node_Str";
        _logHelperConstraints(toplevelHelper);
        _updateConstraintFile(constraintFilename);
      }
      if (!isCollectConstraints()) {
        if (solvingFixedPoint.stringValue().equals("String_Node_Str")) {
          solver.solveGreatest(isInitializeSolver());
        }
 else {
          solver.solveLeast(isInitializeSolver());
        }
      }
      if (super.isResolve() && isLogMode()) {
        try {
          writer.write(_getConstraintsAsLogFileString(constraintList,"String_Node_Str"));
          writer.close();
        }
 catch (        IOException ex) {
          throw new PropertyResolutionException(this,ex,"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
        }
      }
      for (      Inequality inequality : constraintList) {
        if (!inequality.isSatisfied(_lattice)) {
          conflicts.add(inequality);
        }
 else {
          boolean isAcceptable=true;
          InequalityTerm[] lesserVariables=inequality.getLesserTerm().getVariables();
          InequalityTerm[] greaterVariables=inequality.getGreaterTerm().getVariables();
          for (          InequalityTerm variable : lesserVariables) {
            if (!variable.isValueAcceptable() && ((PropertyTerm)variable).isEffective()) {
              unacceptable.add(inequality);
              isAcceptable=false;
              break;
            }
          }
          if (isAcceptable) {
            for (            InequalityTerm variable : greaterVariables) {
              if (!variable.isValueAcceptable() && ((PropertyTerm)variable).isEffective()) {
                unacceptable.add(inequality);
                break;
              }
            }
          }
        }
      }
    }
    if (!isInitializeSolver() && !isCollectConstraints()) {
      if (conflicts.size() > 0) {
        throw new PropertyResolutionException(this,toplevel(),"String_Node_Str" + toplevel().getFullName() + "String_Node_Str"+ conflicts);
      }
      if (unacceptable.size() > 0) {
        throw new TypeConflictException(unacceptable,"String_Node_Str" + toplevel.getFullName() + "String_Node_Str");
      }
    }
  }
 catch (  IllegalActionException ex) {
    throw new PropertyResolutionException(this,toplevel,ex,"String_Node_Str" + "String_Node_Str");
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException ex) {
        throw new PropertyResolutionException(this,toplevel(),ex,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Resolve the property values for the toplevel entity that contains this solver, given the model analyzer that invokes this.
 * @param analyzer The given model analyzer.
 */
protected void _resolveProperties(NamedObj analyzer) throws KernelException {
  super._resolveProperties(analyzer);
  NamedObj toplevel=_toplevel();
  PropertyConstraintHelper toplevelHelper=(PropertyConstraintHelper)getHelper(toplevel);
  toplevelHelper.reinitialize();
  toplevelHelper._addDefaultConstraints(_getConstraintType(actorConstraintType.stringValue()));
  toplevelHelper._setConnectionConstraintType(_getConstraintType(connectionConstraintType.stringValue()),_getConstraintType(compositeConnectionConstraintType.stringValue()),_getConstraintType(fsmConstraintType.stringValue()),_getConstraintType(expressionASTNodeConstraintType.stringValue()));
  Writer writer=null;
  try {
    List<Inequality> conflicts=new LinkedList<Inequality>();
    List<Inequality> unacceptable=new LinkedList<Inequality>();
    List<Inequality> constraintList=toplevelHelper.constraintList();
    if (constraintList.size() > 0) {
      CPO cpo=getLattice();
      InequalitySolver solver=new InequalitySolver(cpo,this);
      Iterator constraints=constraintList.iterator();
      solver.addInequalities(constraints);
      _constraintManager.setConstraints(constraintList);
      getStats().put("String_Node_Str",constraintList.size());
      getStats().put("String_Node_Str",_propertyTermManager.terms().size());
      File file=null;
      Date date=new Date();
      String timestamp=date.toString().replace("String_Node_Str","String_Node_Str");
      String logFilename=getContainer().getName() + "String_Node_Str" + getUseCaseName()+ "String_Node_Str"+ timestamp.replace("String_Node_Str","String_Node_Str")+ "String_Node_Str";
      if (super.isResolve() && isLogMode()) {
        String directoryPath=logDirectory.getExpression();
        directoryPath+=directoryPath.endsWith("String_Node_Str") || directoryPath.endsWith("String_Node_Str") ? "String_Node_Str" : "String_Node_Str";
        if (directoryPath.startsWith("String_Node_Str")) {
          URI directory=new File(URIAttribute.getModelURI(this)).getParentFile().toURI();
          file=FileUtilities.nameToFile(directoryPath.substring(11) + logFilename,directory);
        }
 else {
          if (!logDirectory.asFile().exists()) {
            if (!logDirectory.asFile().mkdirs()) {
              throw new IllegalActionException(this,"String_Node_Str" + logDirectory.asFile().getAbsolutePath() + "String_Node_Str");
            }
          }
          file=FileUtilities.nameToFile(logFilename,logDirectory.asFile().toURI());
        }
        try {
          if (!file.exists()) {
            if (!file.getParentFile().exists()) {
              if (!file.getParentFile().mkdirs()) {
                throw new IllegalActionException(this,"String_Node_Str" + file.getParentFile().getAbsolutePath() + "String_Node_Str");
              }
            }
            if (!file.createNewFile()) {
              throw new IllegalActionException(this,"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
            }
          }
          writer=new FileWriter(file);
          writer.write(_getStatsAsString("String_Node_Str"));
          writer.write(_getConstraintsAsLogFileString(constraintList,"String_Node_Str"));
        }
 catch (        IOException ex) {
          throw new PropertyResolutionException(this,ex,"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
        }
      }
      if (super.isResolve() && isLogMode()) {
        String constraintFilename=_getTrainedConstraintFilename() + "String_Node_Str";
        _logHelperConstraints(toplevelHelper);
        _updateConstraintFile(constraintFilename);
      }
      if (!isCollectConstraints()) {
        if (solvingFixedPoint.stringValue().equals("String_Node_Str")) {
          solver.solveGreatest(isInitializeSolver());
        }
 else {
          solver.solveLeast(isInitializeSolver());
        }
      }
      if (super.isResolve() && isLogMode()) {
        try {
          writer.write(_getConstraintsAsLogFileString(constraintList,"String_Node_Str"));
          writer.close();
        }
 catch (        IOException ex) {
          throw new PropertyResolutionException(this,ex,"String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
        }
      }
      for (      Inequality inequality : constraintList) {
        if (!inequality.isSatisfied(_lattice)) {
          conflicts.add(inequality);
        }
 else {
          boolean isAcceptable=true;
          InequalityTerm[] lesserVariables=inequality.getLesserTerm().getVariables();
          InequalityTerm[] greaterVariables=inequality.getGreaterTerm().getVariables();
          for (          InequalityTerm variable : lesserVariables) {
            if (!variable.isValueAcceptable() && ((PropertyTerm)variable).isEffective()) {
              unacceptable.add(inequality);
              isAcceptable=false;
              break;
            }
          }
          if (isAcceptable) {
            for (            InequalityTerm variable : greaterVariables) {
              if (!variable.isValueAcceptable() && ((PropertyTerm)variable).isEffective()) {
                unacceptable.add(inequality);
                break;
              }
            }
          }
        }
      }
    }
    if (!isInitializeSolver() && !isCollectConstraints()) {
      if (conflicts.size() > 0) {
        throw new PropertyResolutionException(this,toplevel(),"String_Node_Str" + toplevel().getFullName() + "String_Node_Str"+ conflicts);
      }
      if (unacceptable.size() > 0) {
        throw new TypeConflictException(unacceptable,"String_Node_Str" + toplevel.getFullName() + "String_Node_Str");
      }
    }
  }
 catch (  IllegalActionException ex) {
    throw new PropertyResolutionException(this,toplevel,ex,"String_Node_Str" + "String_Node_Str");
  }
 finally {
    if (writer != null) {
      try {
        writer.close();
      }
 catch (      IOException ex) {
        throw new PropertyResolutionException(this,toplevel(),ex,"String_Node_Str");
      }
    }
  }
}