Program: 35214
Project: 35214
Buggy source:
private void addListener(){
  this.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent me){
      if (SwingUtilities.isRightMouseButton(me)) {
        TreePath tp=ClassTree.this.getPathForLocation(me.getX(),me.getY());
        if (tp != null && tp.getParentPath() != null) {
          ClassTree.this.setSelectionPath(tp);
          if (ClassTree.this.getLastSelectedPathComponent() == null) {
            return;
          }
          SortedTreeNode stn=(SortedTreeNode)ClassTree.this.getLastSelectedPathComponent();
          MethodNode mn=stn.getMn();
          ClassNode cn=stn.getCn();
          if (mn != null) {
            JPopupMenu menu=new JPopupMenu();
            JMenuItem edit=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            edit.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                new InsnEditDialogue(mn,mn).open();
                changedChilds((TreeNode)model.getRoot());
              }
            }
);
            menu.add(edit);
            JMenuItem remove=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            remove.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (JOptionPane.showConfirmDialog(JByteMod.instance,JByteMod.res.getResource("String_Node_Str"),JByteMod.res.getResource("String_Node_Str"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                  cn.methods.remove(mn);
                  model.removeNodeFromParent(stn);
                }
              }
            }
);
            menu.add(remove);
            JMenu tools=new JMenu(JByteMod.res.getResource("String_Node_Str"));
            JMenuItem clear=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            clear.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (JOptionPane.showConfirmDialog(JByteMod.instance,JByteMod.res.getResource("String_Node_Str"),JByteMod.res.getResource("String_Node_Str"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                  MethodUtils.clear(mn);
                  jbm.selectMethod(cn,mn);
                }
              }
            }
);
            tools.add(clear);
            JMenuItem lines=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            lines.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (JOptionPane.showConfirmDialog(JByteMod.instance,JByteMod.res.getResource("String_Node_Str"),JByteMod.res.getResource("String_Node_Str"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                  MethodUtils.removeLines(mn);
                  jbm.selectMethod(cn,mn);
                }
              }
            }
);
            tools.add(lines);
            JMenuItem deadcode=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            deadcode.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (JOptionPane.showConfirmDialog(JByteMod.instance,JByteMod.res.getResource("String_Node_Str"),JByteMod.res.getResource("String_Node_Str"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                  MethodUtils.removeDeadCode(mn);
                  jbm.selectMethod(cn,mn);
                }
              }
            }
);
            tools.add(deadcode);
            menu.add(tools);
            menu.show(ClassTree.this,me.getX(),me.getY());
          }
 else           if (cn != null) {
            JPopupMenu menu=new JPopupMenu();
            JMenuItem insert=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            insert.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                MethodNode mn=new MethodNode(1,"String_Node_Str","String_Node_Str",null,null);
                if (new InsnEditDialogue(mn,mn).open()) {
                  if (mn.name.isEmpty() || mn.desc.isEmpty()) {
                    ErrorDisplay.error("String_Node_Str");
                    return;
                  }
                  cn.methods.add(mn);
                  model.insertNodeInto(new SortedTreeNode(cn,mn),stn,0);
                }
              }
            }
);
            menu.add(insert);
            JMenuItem edit=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            edit.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (new InsnEditDialogue(mn,cn).open()) {
                  jbm.refreshTree();
                }
              }
            }
);
            menu.add(edit);
            JMenu tools=new JMenu(JByteMod.res.getResource("String_Node_Str"));
            JMenuItem frames=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            frames.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                FrameGen.regenerateFrames(jbm,cn);
              }
            }
);
            tools.add(frames);
            menu.add(tools);
            menu.show(ClassTree.this,me.getX(),me.getY());
          }
        }
      }
    }
  }
);
}

Fixed version (ground truth):
private void addListener(){
  this.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent me){
      if (SwingUtilities.isRightMouseButton(me)) {
        TreePath tp=ClassTree.this.getPathForLocation(me.getX(),me.getY());
        if (tp != null && tp.getParentPath() != null) {
          ClassTree.this.setSelectionPath(tp);
          if (ClassTree.this.getLastSelectedPathComponent() == null) {
            return;
          }
          SortedTreeNode stn=(SortedTreeNode)ClassTree.this.getLastSelectedPathComponent();
          MethodNode mn=stn.getMn();
          ClassNode cn=stn.getCn();
          if (mn != null) {
            JPopupMenu menu=new JPopupMenu();
            JMenuItem edit=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            edit.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                new InsnEditDialogue(mn,mn).open();
                changedChilds((TreeNode)model.getRoot());
              }
            }
);
            menu.add(edit);
            JMenuItem remove=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            remove.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (JOptionPane.showConfirmDialog(JByteMod.instance,JByteMod.res.getResource("String_Node_Str"),JByteMod.res.getResource("String_Node_Str"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                  cn.methods.remove(mn);
                  model.removeNodeFromParent(stn);
                }
              }
            }
);
            menu.add(remove);
            JMenu tools=new JMenu(JByteMod.res.getResource("String_Node_Str"));
            JMenuItem clear=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            clear.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (JOptionPane.showConfirmDialog(JByteMod.instance,JByteMod.res.getResource("String_Node_Str"),JByteMod.res.getResource("String_Node_Str"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                  MethodUtils.clear(mn);
                  jbm.selectMethod(cn,mn);
                }
              }
            }
);
            tools.add(clear);
            JMenuItem lines=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            lines.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (JOptionPane.showConfirmDialog(JByteMod.instance,JByteMod.res.getResource("String_Node_Str"),JByteMod.res.getResource("String_Node_Str"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                  MethodUtils.removeLines(mn);
                  jbm.selectMethod(cn,mn);
                }
              }
            }
);
            tools.add(lines);
            JMenuItem deadcode=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            deadcode.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (JOptionPane.showConfirmDialog(JByteMod.instance,JByteMod.res.getResource("String_Node_Str"),JByteMod.res.getResource("String_Node_Str"),JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                  MethodUtils.removeDeadCode(cn,mn);
                  jbm.selectMethod(cn,mn);
                }
              }
            }
);
            tools.add(deadcode);
            menu.add(tools);
            menu.show(ClassTree.this,me.getX(),me.getY());
          }
 else           if (cn != null) {
            JPopupMenu menu=new JPopupMenu();
            JMenuItem insert=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            insert.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                MethodNode mn=new MethodNode(1,"String_Node_Str","String_Node_Str",null,null);
                if (new InsnEditDialogue(mn,mn).open()) {
                  if (mn.name.isEmpty() || mn.desc.isEmpty()) {
                    ErrorDisplay.error("String_Node_Str");
                    return;
                  }
                  cn.methods.add(mn);
                  model.insertNodeInto(new SortedTreeNode(cn,mn),stn,0);
                }
              }
            }
);
            menu.add(insert);
            JMenuItem edit=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            edit.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                if (new InsnEditDialogue(mn,cn).open()) {
                  jbm.refreshTree();
                }
              }
            }
);
            menu.add(edit);
            JMenu tools=new JMenu(JByteMod.res.getResource("String_Node_Str"));
            JMenuItem frames=new JMenuItem(JByteMod.res.getResource("String_Node_Str"));
            frames.addActionListener(new ActionListener(){
              public void actionPerformed(              ActionEvent e){
                FrameGen.regenerateFrames(jbm,cn);
              }
            }
);
            tools.add(frames);
            menu.add(tools);
            menu.show(ClassTree.this,me.getX(),me.getY());
          }
        }
      }
    }
  }
);
}