Program: 75607
Project: 75607
Buggy source:
/** 
 * Construct a frame to control code generation for the specified Ptolemy II model. After constructing this, it is necessary to call setVisible(true) to make the frame appear. This is typically accomplished by calling show() on enclosing tableau.
 * @param model The model to put in this frame, or null if none.
 * @param tableau The tableau responsible for this frame.
 * @exception IllegalActionException If the model rejects theconfiguration attribute.
 * @exception NameDuplicationException If a name collision occurs.
 */
public GeneratorFrame(final CompositeEntity model,Tableau tableau) throws IllegalActionException, NameDuplicationException {
  super(model,tableau);
  if (isModified()) {
    _save();
  }
  if (getEffigy() == null || getEffigy().uri == null || getEffigy().uri.getURI() == null) {
    throw new IllegalActionException(model,(Throwable)null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  JPanel caveatsPanel=new JPanel();
  caveatsPanel.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
  caveatsPanel.setLayout(new BoxLayout(caveatsPanel,BoxLayout.X_AXIS));
  JTextArea messageArea=new JTextArea("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",2,10);
  messageArea.setEditable(false);
  messageArea.setBorder(BorderFactory.createEtchedBorder());
  messageArea.setLineWrap(true);
  messageArea.setWrapStyleWord(true);
  caveatsPanel.add(messageArea);
  JButton moreInfoButton=new JButton("String_Node_Str");
  moreInfoButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      Configuration configuration=getConfiguration();
      URL infoURL=getClass().getResource("String_Node_Str");
      try {
        configuration.openModel(null,infoURL,infoURL.toExternalForm());
      }
 catch (      Exception ex) {
        throw new InternalErrorException(model,ex,"String_Node_Str");
      }
    }
  }
);
  caveatsPanel.add(moreInfoButton);
  JPanel left=new JPanel();
  left.setLayout(new BoxLayout(left,BoxLayout.Y_AXIS));
  caveatsPanel.setMaximumSize(new Dimension(500,100));
  left.add(caveatsPanel);
  JPanel buttonPanel=new JPanel();
  buttonPanel.setLayout(new GridLayout(1,4));
  JButton parametersButton=new JButton("String_Node_Str");
  parametersButton.setToolTipText("String_Node_Str" + "String_Node_Str");
  buttonPanel.add(parametersButton);
  JButton goButton=new JButton("String_Node_Str");
  goButton.setToolTipText("String_Node_Str");
  buttonPanel.add(goButton);
  JButton stopButton=new JButton("String_Node_Str");
  stopButton.setToolTipText("String_Node_Str");
  buttonPanel.add(stopButton);
  JButton clearButton=new JButton("String_Node_Str");
  clearButton.setToolTipText("String_Node_Str");
  buttonPanel.add(clearButton);
  buttonPanel.setMaximumSize(new Dimension(500,50));
  left.add(buttonPanel);
  GeneratorAttribute attribute=(GeneratorAttribute)model.getAttribute("String_Node_Str",GeneratorAttribute.class);
  if (attribute == null) {
    attribute=new GeneratorAttribute(model,"String_Node_Str");
  }
  attribute.sanityCheckAndUpdateParameters(getEffigy().uri.toString());
  Configurer configurer=new Configurer(attribute);
  final GeneratorAttribute options=attribute;
  JPanel controlPanel=new JPanel();
  controlPanel.add(configurer);
  JScrollPane scrollPane=new JScrollPane(controlPanel);
  left.add(scrollPane,BorderLayout.CENTER);
  final JTextAreaExec exec=new JTextAreaExec("String_Node_Str",false);
  JSplitPane splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,left,exec);
  splitPane.setOneTouchExpandable(true);
  Dimension preferred=left.getPreferredSize();
  splitPane.setDividerLocation((int)(preferred.width + 20));
  getContentPane().add(splitPane,BorderLayout.CENTER);
  parametersButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      try {
        options.sanityCheckAndUpdateParameters(null);
      }
 catch (      Exception ex) {
        exec.appendJTextArea(ex.toString());
      }
      exec.appendJTextArea(options.toString());
    }
  }
);
  stopButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      exec.cancel();
    }
  }
);
  clearButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      exec.clear();
    }
  }
);
  goButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      try {
        boolean decompile=false;
        boolean compile=((BooleanToken)((Parameter)options.getAttribute("String_Node_Str")).getToken()).booleanValue();
        boolean show=((BooleanToken)((Parameter)options.getAttribute("String_Node_Str")).getToken()).booleanValue();
        boolean run=((BooleanToken)((Parameter)options.getAttribute("String_Node_Str")).getToken()).booleanValue();
        String codeGenerator=getStringToken(options,"String_Node_Str");
        String targetPath=getStringToken(options,"String_Node_Str");
        String ptIIUserDirectory=getStringToken(options,"String_Node_Str");
        File directory=new File(ptIIUserDirectory,targetPath);
        if (!directory.isDirectory()) {
          throw new IllegalActionException(model,"String_Node_Str" + ptIIUserDirectory + "String_Node_Str"+ targetPath+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
        }
        if (!directory.canWrite()) {
          throw new IllegalActionException(model,"String_Node_Str" + ptIIUserDirectory + "String_Node_Str"+ targetPath);
        }
        List execCommands=new LinkedList();
        List commands=null;
        if (codeGenerator.equals("String_Node_Str")) {
          try {
            commands=_generateCodeGeneratorCommands(model,options,"String_Node_Str");
          }
 catch (          Exception ex) {
            throw new IllegalActionException(model,ex,null);
          }
        }
 else         if (codeGenerator.equals("String_Node_Str") && compile) {
          exec.updateStatusBar("String_Node_Str" + "String_Node_Str");
          ptolemy.copernicus.c.Main.generate((CompositeActor)model,targetPath);
          exec.updateStatusBar("String_Node_Str" + "String_Node_Str");
          decompile=true;
        }
 else         if (codeGenerator.equals("String_Node_Str")) {
          try {
            commands=_generateCodeGeneratorCommands(model,options,"String_Node_Str");
            decompile=true;
          }
 catch (          Exception ex) {
            throw new IllegalActionException(model,ex,null);
          }
        }
 else         if (codeGenerator.equals("String_Node_Str")) {
          try {
            commands=_generateCodeGeneratorCommands(model,options,"String_Node_Str");
          }
 catch (          Exception ex) {
            throw new IllegalActionException(model,ex,null);
          }
        }
 else         if (codeGenerator.equals("String_Node_Str") && compile) {
          exec.updateStatusBar("String_Node_Str" + "String_Node_Str");
          ptolemy.copernicus.jhdl.Main.generate((CompositeActor)model,targetPath);
          exec.updateStatusBar("String_Node_Str" + "String_Node_Str");
        }
 else         if (codeGenerator.equals("String_Node_Str")) {
          try {
            commands=_generateCodeGeneratorCommands(model,options,"String_Node_Str");
          }
 catch (          Exception ex) {
            throw new IllegalActionException(model,ex,null);
          }
          decompile=true;
        }
 else {
          throw new IllegalActionException(model,"String_Node_Str" + codeGenerator + "String_Node_Str");
        }
        if (compile && commands != null) {
          execCommands.add(commands.get(0));
        }
        if (show && decompile) {
          String targetPackage=getStringToken(options,"String_Node_Str");
          String className=targetPackage;
          if (codeGenerator.equals("String_Node_Str")) {
            className=className + "String_Node_Str";
          }
 else {
            if (className.length() > 0 && !className.endsWith("String_Node_Str")) {
              className=className + '.' + "String_Node_Str"+ model.getName();
            }
 else {
              className="String_Node_Str" + model.getName();
            }
          }
          String classPath=getStringToken(options,"String_Node_Str");
          execCommands.add("String_Node_Str" + "String_Node_Str" + classPath + "String_Node_Str"+ className);
        }
        if (run && commands != null) {
          execCommands.add(commands.get(1));
        }
        if (execCommands.size() > 0) {
          exec.setCommands(execCommands);
          exec.start();
        }
      }
 catch (      Exception ex) {
        MessageHandler.error("String_Node_Str",ex);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Construct a frame to control code generation for the specified Ptolemy II model. After constructing this, it is necessary to call setVisible(true) to make the frame appear. This is typically accomplished by calling show() on enclosing tableau.
 * @param model The model to put in this frame, or null if none.
 * @param tableau The tableau responsible for this frame.
 * @exception IllegalActionException If the model rejects theconfiguration attribute.
 * @exception NameDuplicationException If a name collision occurs.
 */
public GeneratorFrame(final CompositeEntity model,Tableau tableau) throws IllegalActionException, NameDuplicationException {
  super(model,tableau);
  if (isModified()) {
    _save();
  }
  if (getEffigy() == null || getEffigy().uri == null || getEffigy().uri.getURI() == null) {
    throw new IllegalActionException(model,(Throwable)null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  JPanel caveatsPanel=new JPanel();
  caveatsPanel.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
  caveatsPanel.setLayout(new BoxLayout(caveatsPanel,BoxLayout.X_AXIS));
  JTextArea messageArea=new JTextArea("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",2,10);
  messageArea.setEditable(false);
  messageArea.setBorder(BorderFactory.createEtchedBorder());
  messageArea.setLineWrap(true);
  messageArea.setWrapStyleWord(true);
  caveatsPanel.add(messageArea);
  JButton moreInfoButton=new JButton("String_Node_Str");
  moreInfoButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      Configuration configuration=getConfiguration();
      URL infoURL=getClass().getResource("String_Node_Str");
      try {
        configuration.openModel(null,infoURL,infoURL.toExternalForm());
      }
 catch (      Exception ex) {
        throw new InternalErrorException(model,ex,"String_Node_Str");
      }
    }
  }
);
  caveatsPanel.add(moreInfoButton);
  JPanel left=new JPanel();
  left.setLayout(new BoxLayout(left,BoxLayout.Y_AXIS));
  caveatsPanel.setMaximumSize(new Dimension(500,100));
  left.add(caveatsPanel);
  JPanel buttonPanel=new JPanel();
  buttonPanel.setLayout(new GridLayout(1,4));
  JButton parametersButton=new JButton("String_Node_Str");
  parametersButton.setToolTipText("String_Node_Str" + "String_Node_Str");
  buttonPanel.add(parametersButton);
  JButton goButton=new JButton("String_Node_Str");
  goButton.setToolTipText("String_Node_Str");
  buttonPanel.add(goButton);
  JButton stopButton=new JButton("String_Node_Str");
  stopButton.setToolTipText("String_Node_Str");
  buttonPanel.add(stopButton);
  JButton clearButton=new JButton("String_Node_Str");
  clearButton.setToolTipText("String_Node_Str");
  buttonPanel.add(clearButton);
  buttonPanel.setMaximumSize(new Dimension(500,50));
  left.add(buttonPanel);
  GeneratorAttribute attribute=(GeneratorAttribute)model.getAttribute("String_Node_Str",GeneratorAttribute.class);
  if (attribute == null) {
    attribute=new GeneratorAttribute(model,"String_Node_Str");
  }
  attribute.sanityCheckAndUpdateParameters(getEffigy().uri.getURI().toString());
  Configurer configurer=new Configurer(attribute);
  final GeneratorAttribute options=attribute;
  JPanel controlPanel=new JPanel();
  controlPanel.add(configurer);
  JScrollPane scrollPane=new JScrollPane(controlPanel);
  left.add(scrollPane,BorderLayout.CENTER);
  final JTextAreaExec exec=new JTextAreaExec("String_Node_Str",false);
  JSplitPane splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,left,exec);
  splitPane.setOneTouchExpandable(true);
  Dimension preferred=left.getPreferredSize();
  splitPane.setDividerLocation((int)(preferred.width + 20));
  getContentPane().add(splitPane,BorderLayout.CENTER);
  parametersButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      try {
        options.sanityCheckAndUpdateParameters(null);
      }
 catch (      Exception ex) {
        exec.appendJTextArea(ex.toString());
      }
      exec.appendJTextArea(options.toString());
    }
  }
);
  stopButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      exec.cancel();
    }
  }
);
  clearButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      exec.clear();
    }
  }
);
  goButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent evt){
      try {
        boolean decompile=false;
        boolean compile=((BooleanToken)((Parameter)options.getAttribute("String_Node_Str")).getToken()).booleanValue();
        boolean show=((BooleanToken)((Parameter)options.getAttribute("String_Node_Str")).getToken()).booleanValue();
        boolean run=((BooleanToken)((Parameter)options.getAttribute("String_Node_Str")).getToken()).booleanValue();
        String codeGenerator=getStringToken(options,"String_Node_Str");
        String targetPath=getStringToken(options,"String_Node_Str");
        String ptIIUserDirectory=getStringToken(options,"String_Node_Str");
        File directory=new File(ptIIUserDirectory,targetPath);
        if (!directory.isDirectory()) {
          throw new IllegalActionException(model,"String_Node_Str" + ptIIUserDirectory + "String_Node_Str"+ targetPath+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
        }
        if (!directory.canWrite()) {
          throw new IllegalActionException(model,"String_Node_Str" + ptIIUserDirectory + "String_Node_Str"+ targetPath);
        }
        List execCommands=new LinkedList();
        List commands=null;
        if (codeGenerator.equals("String_Node_Str")) {
          try {
            commands=_generateCodeGeneratorCommands(model,options,"String_Node_Str");
          }
 catch (          Exception ex) {
            throw new IllegalActionException(model,ex,null);
          }
        }
 else         if (codeGenerator.equals("String_Node_Str") && compile) {
          exec.updateStatusBar("String_Node_Str" + "String_Node_Str");
          ptolemy.copernicus.c.Main.generate((CompositeActor)model,targetPath);
          exec.updateStatusBar("String_Node_Str" + "String_Node_Str");
          decompile=true;
        }
 else         if (codeGenerator.equals("String_Node_Str")) {
          try {
            commands=_generateCodeGeneratorCommands(model,options,"String_Node_Str");
            decompile=true;
          }
 catch (          Exception ex) {
            throw new IllegalActionException(model,ex,null);
          }
        }
 else         if (codeGenerator.equals("String_Node_Str")) {
          try {
            commands=_generateCodeGeneratorCommands(model,options,"String_Node_Str");
          }
 catch (          Exception ex) {
            throw new IllegalActionException(model,ex,null);
          }
        }
 else         if (codeGenerator.equals("String_Node_Str") && compile) {
          exec.updateStatusBar("String_Node_Str" + "String_Node_Str");
          ptolemy.copernicus.jhdl.Main.generate((CompositeActor)model,targetPath);
          exec.updateStatusBar("String_Node_Str" + "String_Node_Str");
        }
 else         if (codeGenerator.equals("String_Node_Str")) {
          try {
            commands=_generateCodeGeneratorCommands(model,options,"String_Node_Str");
          }
 catch (          Exception ex) {
            throw new IllegalActionException(model,ex,null);
          }
          decompile=true;
        }
 else {
          throw new IllegalActionException(model,"String_Node_Str" + codeGenerator + "String_Node_Str");
        }
        if (compile && commands != null) {
          execCommands.add(commands.get(0));
        }
        if (show && decompile) {
          String targetPackage=getStringToken(options,"String_Node_Str");
          String className=targetPackage;
          if (codeGenerator.equals("String_Node_Str")) {
            className=className + "String_Node_Str";
          }
 else {
            if (className.length() > 0 && !className.endsWith("String_Node_Str")) {
              className=className + '.' + "String_Node_Str"+ model.getName();
            }
 else {
              className="String_Node_Str" + model.getName();
            }
          }
          String classPath=getStringToken(options,"String_Node_Str");
          execCommands.add("String_Node_Str" + "String_Node_Str" + classPath + "String_Node_Str"+ className);
        }
        if (run && commands != null) {
          execCommands.add(commands.get(1));
        }
        if (execCommands.size() > 0) {
          exec.setCommands(execCommands);
          exec.start();
        }
      }
 catch (      Exception ex) {
        MessageHandler.error("String_Node_Str",ex);
      }
    }
  }
);
}