Program: 71021
Project: 71021
Buggy source:
private void buildMenu(JMenu menu,Node<MenuEntry> menuNode){
  MenuEntry entry=menuNode.getData();
switch (entry.getType()) {
case MENU:
    JMenu newMenu=new JMenu(entry.getTitle());
  if (entry.getIcon() != null) {
    URL iconFile=ArtisynthPath.findResource(entry.getIcon());
    newMenu.setIcon(new ImageIcon(iconFile));
  }
if (entry.getFont() != null) {
  newMenu.setFont(entry.getFont());
}
menu.add(newMenu);
if (menuNode.getChildren().size() > MAX_MENU_ROWS) {
VerticalGridLayout menuGrid=new VerticalGridLayout(MAX_MENU_ROWS,0);
newMenu.getPopupMenu().setLayout(menuGrid);
}
for (Node<MenuEntry> child : menuNode.getChildren()) {
buildMenu(newMenu,child);
}
break;
case DIVIDER:
JSeparator div=new JSeparator();
div.setLayout(new GridLayout());
menu.add(div);
break;
case LABEL:
if (entry instanceof LabelEntry) {
LabelEntry label=(LabelEntry)entry;
JLabel lbl=new JLabel(label.getTitle());
if (label.getIcon() != null) {
URL iconFile=ArtisynthPath.findResource(entry.getIcon());
lbl.setIcon(new ImageIcon(iconFile));
}
if (entry.getFont() != null) {
lbl.setFont(entry.getFont());
}
menu.add(lbl);
}
case MODEL:
if (entry instanceof DemoEntry) {
DemoEntry demo=(DemoEntry)entry;
JMenuItem newItem=makeMenuItem(entry.getTitle(),demo.getModel().getName());
myMain.addDemoName(demo.getModel().getName(),demo.getModel().getFile());
if (entry.getIcon() != null) {
URL iconFile=ArtisynthPath.findResource(entry.getIcon());
newItem.setIcon(new ImageIcon(iconFile));
}
if (entry.getFont() != null) {
newItem.setFont(entry.getFont());
}
newItem.setToolTipText(demo.getModel().getFile());
menu.add(newItem);
}
break;
default :
break;
}
}

Fixed version (ground truth):
private void buildMenu(JMenu menu,Node<MenuEntry> menuNode){
  MenuEntry entry=menuNode.getData();
switch (entry.getType()) {
case MENU:
    JMenu newMenu=new JMenu(entry.getTitle());
  if (entry.getIcon() != null) {
    URL iconFile=ArtisynthPath.findResource(entry.getIcon());
    newMenu.setIcon(new ImageIcon(iconFile));
  }
if (entry.getFont() != null) {
  newMenu.setFont(entry.getFont());
}
menu.add(newMenu);
if (menuNode.getChildren().size() > MAX_MENU_ROWS) {
VerticalGridLayout menuGrid=new VerticalGridLayout(MAX_MENU_ROWS,0);
newMenu.getPopupMenu().setLayout(menuGrid);
}
for (Node<MenuEntry> child : menuNode.getChildren()) {
if (!isMenuEmpty(child)) {
buildMenu(newMenu,child);
}
}
break;
case DIVIDER:
JSeparator div=new JSeparator();
div.setLayout(new GridLayout());
menu.add(div);
break;
case LABEL:
if (entry instanceof LabelEntry) {
LabelEntry label=(LabelEntry)entry;
JLabel lbl=new JLabel(label.getTitle());
if (label.getIcon() != null) {
URL iconFile=ArtisynthPath.findResource(entry.getIcon());
lbl.setIcon(new ImageIcon(iconFile));
}
if (entry.getFont() != null) {
lbl.setFont(entry.getFont());
}
menu.add(lbl);
}
case MODEL:
if (entry instanceof DemoEntry) {
DemoEntry demo=(DemoEntry)entry;
JMenuItem newItem=makeMenuItem(entry.getTitle(),demo.getModel().getName());
myMain.addDemoName(demo.getModel().getName(),demo.getModel().getFile());
if (entry.getIcon() != null) {
URL iconFile=ArtisynthPath.findResource(entry.getIcon());
newItem.setIcon(new ImageIcon(iconFile));
}
if (entry.getFont() != null) {
newItem.setFont(entry.getFont());
}
newItem.setToolTipText(demo.getModel().getFile());
menu.add(newItem);
}
break;
default :
break;
}
}