Buggy code:
public class ValidatorDialog extends ToggleDialog implements ActionListener , SelectionChangedListener , LayerChangeListener { private static final long serialVersionUID = 2952292777351992696L ; public ValidatorTreePanel tree ; private SideButton fixButton ; private SideButton ignoreButton ; private SideButton selectButton ; private JPopupMenu popupMenu ; private TestError popupMenuError = null ; private DefaultMutableTreeNode lastSelectedNode = null ; public ValidatorDialog ( ) { } @ Override public void showNotify ( ) { } @ Override public void hideNotify ( ) { } @ Override public void setVisible ( boolean v ) { } @ SuppressWarnings ( "unchecked" ) private void fixErrors ( ActionEvent e ) { } @ SuppressWarnings ( "unchecked" ) private void ignoreErrors ( ActionEvent e ) { } private void showPopupMenu ( MouseEvent e ) { } private void zoomToProblem ( ) { } @ SuppressWarnings ( "unchecked" ) private void setSelectedItems ( ) { if ( ( tree ) == null ) return ; Collection < OsmPrimitive > sel = new HashSet < OsmPrimitive > ( 40 ) ; TreePath [ ] selectedPaths = tree . getSelectionPaths ( ) ; if ( selectedPaths == null ) return ; for ( TreePath path : selectedPaths ) { DefaultMutableTreeNode node = ( ( DefaultMutableTreeNode ) ( path . getLastPathComponent ( ) ) ) ; Enumeration < DefaultMutableTreeNode > children = node . breadthFirstEnumeration ( ) ; while ( children . hasMoreElements ( ) ) { DefaultMutableTreeNode childNode = children . nextElement ( ) ; Object nodeInfo = childNode . getUserObject ( ) ; if ( nodeInfo instanceof TestError ) { TestError error = ( ( TestError ) ( nodeInfo ) ) ; <START_BUG> sel . addAll ( error . getPrimitives ( ) ) ; <END_BUG> } } } main . getCurrentDataSet ( ) . setSelected ( sel ) ; } @ Override public void actionPerformed ( ActionEvent e ) { } @ SuppressWarnings ( "unchecked" ) private boolean setSelection ( Collection < OsmPrimitive > sel , boolean addSelected ) { } @ Override public void activeLayerChange ( Layer oldLayer , Layer newLayer ) { } @ Override public void layerAdded ( Layer newLayer ) { } @ Override public void layerRemoved ( Layer oldLayer ) { } public class ClickWatch extends MouseAdapter { @ Override public void mouseClicked ( MouseEvent e ) { } @ Override public void mousePressed ( MouseEvent e ) { } @ Override public void mouseReleased ( MouseEvent e ) { } } public class SelectionWatch implements TreeSelectionListener { @ Override public void valueChanged ( TreeSelectionEvent e ) { } } public static class ValidatorBoundingXYVisitor extends BoundingXYVisitor implements ValidatorVisitor { @ Override public void visit ( OsmPrimitive p ) { } @ Override public void visit ( WaySegment ws ) { } @ Override public void visit ( List < Node > nodes ) { } } public void updateSelection ( Collection < ? extends OsmPrimitive > newSelection ) { } @ Override public void selectionChanged ( Collection < ? extends OsmPrimitive > newSelection ) { } class FixTask extends PleaseWaitRunnable { private Collection < TestError > testErrors ; private boolean canceled ; public FixTask ( Collection < TestError > testErrors ) { } @ Override protected void cancel ( ) { } @ Override protected void finish ( ) { } @ Override protected void realRun ( ) throws IOException , OsmTransferException , SAXException { } } }

Fix:
sel . addAll ( error . getSelectablePrimitives ( ) ) ;