Program: 74214
Project: 74214
Buggy source:
/** 
 * Read the input, if there is any, and issue a change request to apply the MoML in the input to the displayed model.
 * @exception IllegalActionException If there is an error readingthe input.
 */
public void fire() throws IllegalActionException {
  super.fire();
  title.update();
  String titleValue=((StringToken)title.getToken()).stringValue();
  for (int i=0; i < input.getWidth(); i++) {
    if (input.hasToken(i)) {
synchronized (this) {
        ActorToken token=(ActorToken)input.get(i);
        MoMLParser parser=new MoMLParser(new Workspace());
        Entity model;
        try {
          StringWriter writer=new StringWriter();
          token.getMoML(writer);
          model=(Entity)parser.parse(writer.getBuffer().toString());
        }
 catch (        Exception e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
        Effigy effigy=Configuration.findEffigy(toplevel());
        if (effigy == null) {
          return;
        }
        Configuration configuration=(Configuration)effigy.toplevel();
        try {
          IntMatrixToken size=(IntMatrixToken)screenSize.getToken();
          int width=size.getElementAt(0,0);
          int height=size.getElementAt(0,1);
          Dimension newSize=null;
          if (width >= 0 && height >= 0) {
            newSize=new Dimension(width,height);
            SizeAttribute sizeAttribute=(SizeAttribute)model.getAttribute("String_Node_Str",SizeAttribute.class);
            if (sizeAttribute == null) {
              sizeAttribute=new SizeAttribute(model,"String_Node_Str");
            }
            sizeAttribute.setExpression("String_Node_Str" + newSize.width + "String_Node_Str"+ newSize.height+ "String_Node_Str");
          }
          Tableau tableau=_tableaus[i];
          boolean reopen=((BooleanToken)reopenWindow.getToken()).booleanValue();
          boolean modelChanged;
          if (tableau == null || reopen || !(tableau.getFrame() instanceof BasicGraphFrame)) {
            if (tableau != null) {
              tableau.close();
            }
            tableau=configuration.openInstance(model,effigy);
            ((Effigy)tableau.getContainer()).uri.setURI(null);
            _tableaus[i]=tableau;
            modelChanged=false;
          }
 else {
            GTFrameTools.changeModel((BasicGraphFrame)tableau.getFrame(),(CompositeEntity)model,true,true);
            modelChanged=true;
          }
          if (!modelChanged) {
            JFrame frame=tableau.getFrame();
            IntMatrixToken location=(IntMatrixToken)screenLocation.getToken();
            int x=location.getElementAt(0,0);
            int y=location.getElementAt(0,1);
            Point newLocation;
            if (x >= 0 && y >= 0) {
              newLocation=new Point(x,y);
            }
 else {
              newLocation=frame.getLocation();
            }
            if (newSize == null) {
              newSize=frame.getSize();
            }
            Toolkit toolkit=Toolkit.getDefaultToolkit();
            Dimension screenSize=toolkit.getScreenSize();
            newLocation.x=Math.min(newLocation.x,screenSize.width - newSize.width);
            newLocation.y=Math.min(newLocation.y,screenSize.height - newSize.height);
            frame.setLocation(newLocation);
            frame.addWindowListener(this);
          }
          String titleString=null;
          String modelName=model.getName();
          URI uri=URIAttribute.getModelURI(model);
          if (titleValue.equals("String_Node_Str")) {
            if (uri == null || modelName.equals("String_Node_Str")) {
              titleString="String_Node_Str";
            }
 else {
              titleString=uri.toString();
            }
            titleString+="String_Node_Str" + getName() + "String_Node_Str";
          }
 else {
            titleString=titleValue;
          }
          tableau.setTitle(titleString);
          model.setDeferringChangeRequests(false);
          output.send(i,token);
        }
 catch (        NameDuplicationException e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
catch (        Exception e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Read the input, if there is any, and issue a change request to apply the MoML in the input to the displayed model.
 * @exception IllegalActionException If there is an error readingthe input.
 */
public void fire() throws IllegalActionException {
  super.fire();
  title.update();
  String titleValue=((StringToken)title.getToken()).stringValue();
  for (int i=0; i < input.getWidth(); i++) {
    if (input.hasToken(i)) {
synchronized (this) {
        ActorToken token=(ActorToken)input.get(i);
        MoMLParser parser=new MoMLParser(new Workspace());
        Entity model;
        try {
          StringWriter writer=new StringWriter();
          token.getMoML(writer);
          model=(Entity)parser.parse(writer.getBuffer().toString());
        }
 catch (        Exception e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
        Effigy effigy=GTEntityUtils.findToplevelEffigy(this);
        if (effigy == null) {
          return;
        }
        Configuration configuration=(Configuration)effigy.toplevel();
        try {
          IntMatrixToken size=(IntMatrixToken)screenSize.getToken();
          int width=size.getElementAt(0,0);
          int height=size.getElementAt(0,1);
          Dimension newSize=null;
          if (width >= 0 && height >= 0) {
            newSize=new Dimension(width,height);
            SizeAttribute sizeAttribute=(SizeAttribute)model.getAttribute("String_Node_Str",SizeAttribute.class);
            if (sizeAttribute == null) {
              sizeAttribute=new SizeAttribute(model,"String_Node_Str");
            }
            sizeAttribute.setExpression("String_Node_Str" + newSize.width + "String_Node_Str"+ newSize.height+ "String_Node_Str");
          }
          Tableau tableau=_tableaus[i];
          boolean reopen=((BooleanToken)reopenWindow.getToken()).booleanValue();
          boolean modelChanged;
          if (tableau == null || reopen || !(tableau.getFrame() instanceof BasicGraphFrame)) {
            if (tableau != null) {
              tableau.close();
            }
            tableau=configuration.openInstance(model,effigy);
            ((Effigy)tableau.getContainer()).uri.setURI(null);
            _tableaus[i]=tableau;
            modelChanged=false;
          }
 else {
            GTFrameTools.changeModel((BasicGraphFrame)tableau.getFrame(),(CompositeEntity)model,true,true);
            modelChanged=true;
          }
          if (!modelChanged) {
            JFrame frame=tableau.getFrame();
            IntMatrixToken location=(IntMatrixToken)screenLocation.getToken();
            int x=location.getElementAt(0,0);
            int y=location.getElementAt(0,1);
            Point newLocation;
            if (x >= 0 && y >= 0) {
              newLocation=new Point(x,y);
            }
 else {
              newLocation=frame.getLocation();
            }
            if (newSize == null) {
              newSize=frame.getSize();
            }
            Toolkit toolkit=Toolkit.getDefaultToolkit();
            Dimension screenSize=toolkit.getScreenSize();
            newLocation.x=Math.min(newLocation.x,screenSize.width - newSize.width);
            newLocation.y=Math.min(newLocation.y,screenSize.height - newSize.height);
            frame.setLocation(newLocation);
            frame.addWindowListener(this);
          }
          String titleString=null;
          String modelName=model.getName();
          URI uri=URIAttribute.getModelURI(model);
          if (titleValue.equals("String_Node_Str")) {
            if (uri == null || modelName.equals("String_Node_Str")) {
              titleString="String_Node_Str";
            }
 else {
              titleString=uri.toString();
            }
            titleString+="String_Node_Str" + getName() + "String_Node_Str";
          }
 else {
            titleString=titleValue;
          }
          tableau.setTitle(titleString);
          model.setDeferringChangeRequests(false);
          output.send(i,token);
        }
 catch (        NameDuplicationException e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
catch (        Exception e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
      }
    }
  }
}