Program: 73474
Project: 73474
Buggy source:
/** 
 * Update the container of this importer with the design pattern. If a design pattern is previously added to the container, the importer first tries to undo the importation before importing the new design pattern.
 */
public void update(){
  List<Parameter> parameters=attributeList(Parameter.class);
  HashMap<String,Token> table=new HashMap<String,Token>();
  String value=null;
  DesignPatternGetMoMLAction action=new DesignPatternGetMoMLAction();
  for (  Parameter parameter : parameters) {
    try {
      Token token=parameter.getToken();
      table.put(parameter.getName(),token);
      if (parameter == designPatternFile) {
        value=((StringToken)token).stringValue();
      }
 else {
        action.overrideParameter(parameter.getName(),parameter.getExpression());
      }
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException(this,e,"String_Node_Str" + "String_Node_Str" + parameter.getName());
    }
  }
  if (table.equals(_lastValues)) {
    return;
  }
 else {
    _lastValues=table;
  }
  if (_lastUndoStack != null) {
    try {
      _lastUndoStack.undo();
    }
 catch (    Exception e) {
      throw new InternalErrorException(this,e,"String_Node_Str");
    }
 finally {
      _lastUndoStack=null;
    }
  }
  if (value == null || value.equals("String_Node_Str")) {
    return;
  }
  final MoMLParser parser=new MoMLParser();
  NamedObj model;
  try {
    Reader reader=designPatternFile.openForReading();
    URI baseDirectory=designPatternFile.getBaseDirectory();
    model=parser.parse(baseDirectory == null ? null : baseDirectory.toURL(),value,reader);
  }
 catch (  Exception e) {
    throw new InternalErrorException(this,e,"String_Node_Str" + "String_Node_Str" + value + "String_Node_Str");
  }
  final String moml=action.getMoml(model,null);
  parser.reset();
  final NamedObj container=getContainer();
  final UndoStackAttribute undoStack;
  try {
    undoStack=new UndoStackAttribute(container,container.uniqueName("String_Node_Str"));
    undoStack.moveToFirst();
  }
 catch (  KernelException e) {
    throw new InternalErrorException(this,e,"String_Node_Str" + "String_Node_Str");
  }
  boolean isModified=MoMLParser.isModified();
  final MoMLContentFilter filter=new MoMLContentFilter();
  parser.setContext(container);
  parser.setUndoable(true);
  try {
    MoMLParser.addMoMLFilter(filter);
    parser.parse(moml);
  }
 catch (  Exception e) {
    throw new InternalErrorException(this,e,"String_Node_Str" + "String_Node_Str" + value + "String_Node_Str");
  }
 finally {
    MoMLParser.getMoMLFilters().remove(filter);
    MoMLParser.setModified(isModified);
    _lastUndoStack=undoStack;
    try {
      undoStack.setContainer(null);
    }
 catch (    KernelException e) {
    }
    Attribute after=container.getAttribute("String_Node_Str");
    if (after instanceof TransformationAttribute) {
      final TransformationAttribute attribute=(TransformationAttribute)after;
      attribute.addExecutionListener(new ExecutionListener(){
        public void executionError(        Manager manager,        Throwable throwable){
        }
        public void executionFinished(        Manager manager){
        }
        public void managerStateChanged(        Manager manager){
          if (manager.getState() == Manager.PREINITIALIZING) {
            MoMLParser.addMoMLFilter(filter);
            _isModified=MoMLParser.isModified();
            try {
              _lastUndoStack.setContainer(container);
              _lastUndoStack.moveToFirst();
            }
 catch (            KernelException e) {
              e.printStackTrace();
            }
          }
 else           if (manager.getState() == Manager.IDLE) {
            MoMLParser.getMoMLFilters().remove(filter);
            MoMLParser.setModified(_isModified);
            _lastUndoStack=undoStack;
            try {
              undoStack.setContainer(null);
            }
 catch (            KernelException e) {
            }
            attribute.removeExecutionListener(this);
          }
        }
        private boolean _isModified;
      }
);
    }
  }
}

Fixed version (ground truth):
/** 
 * Update the container of this importer with the design pattern. If a design pattern is previously added to the container, the importer first tries to undo the importation before importing the new design pattern.
 */
public void update(){
  List<Parameter> parameters=attributeList(Parameter.class);
  HashMap<String,Token> table=new HashMap<String,Token>();
  String value=null;
  DesignPatternGetMoMLAction action=new DesignPatternGetMoMLAction();
  for (  Parameter parameter : parameters) {
    try {
      Token token=parameter.getToken();
      table.put(parameter.getName(),token);
      if (parameter == designPatternFile) {
        value=((StringToken)token).stringValue();
      }
 else {
        action.overrideParameter(parameter.getName(),parameter.getExpression());
      }
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException(this,e,"String_Node_Str" + "String_Node_Str" + parameter.getName());
    }
  }
  if (table.equals(_lastValues)) {
    return;
  }
 else {
    _lastValues=table;
  }
  if (_lastUndoStack != null) {
    try {
      _lastUndoStack.undo();
    }
 catch (    Exception e) {
      throw new InternalErrorException(this,e,"String_Node_Str");
    }
 finally {
      _lastUndoStack=null;
    }
  }
  if (value == null || value.equals("String_Node_Str")) {
    return;
  }
  final MoMLParser parser=new MoMLParser();
  NamedObj model;
  try {
    Reader reader=designPatternFile.openForReading();
    URI baseDirectory=designPatternFile.getBaseDirectory();
    model=parser.parse(baseDirectory == null ? null : baseDirectory.toURL(),value,reader);
  }
 catch (  Exception e) {
    throw new InternalErrorException(this,e,"String_Node_Str" + "String_Node_Str" + value + "String_Node_Str");
  }
  final String moml=action.getMoml(model,null);
  parser.reset();
  final NamedObj container=getContainer();
  final UndoStackAttribute undoStack;
  try {
    undoStack=new UndoStackAttribute(container,container.uniqueName("String_Node_Str"));
    undoStack.moveToFirst();
  }
 catch (  KernelException e) {
    throw new InternalErrorException(this,e,"String_Node_Str" + "String_Node_Str");
  }
  boolean isModified=MoMLParser.isModified();
  final MoMLContentFilter filter=new MoMLContentFilter();
  parser.setContext(container);
  parser.setUndoable(true);
  try {
    MoMLParser.addMoMLFilter(filter);
    parser.parse(moml);
  }
 catch (  Exception e) {
    throw new InternalErrorException(this,e,"String_Node_Str" + "String_Node_Str" + value + "String_Node_Str");
  }
 finally {
    MoMLParser.getMoMLFilters().remove(filter);
    MoMLParser.setModified(isModified);
    _lastUndoStack=undoStack;
    try {
      undoStack.setContainer(null);
    }
 catch (    KernelException e) {
    }
    Attribute after=container.getAttribute("String_Node_Str");
    if (after instanceof TransformationAttribute) {
      final TransformationAttribute attribute=(TransformationAttribute)after;
      attribute.addExecutionListener(new ExecutionListener(){
        @Override public void executionError(        Manager manager,        Throwable throwable){
        }
        @Override public void executionFinished(        Manager manager){
        }
        @Override public void managerStateChanged(        Manager manager){
          if (manager.getState() == Manager.PREINITIALIZING) {
            MoMLParser.addMoMLFilter(filter);
            _isModified=MoMLParser.isModified();
            try {
              _lastUndoStack.setContainer(container);
              _lastUndoStack.moveToFirst();
            }
 catch (            KernelException e) {
              e.printStackTrace();
            }
          }
 else           if (manager.getState() == Manager.IDLE) {
            MoMLParser.getMoMLFilters().remove(filter);
            MoMLParser.setModified(_isModified);
            _lastUndoStack=undoStack;
            try {
              undoStack.setContainer(null);
            }
 catch (            KernelException e) {
            }
            attribute.removeExecutionListener(this);
          }
        }
        private boolean _isModified;
      }
);
    }
  }
}