Buggy code:
final JMenuItem saveAs = new JMenuItem ( LanguageManager . getString ( "editor.menu.file.saveas" ) ) ; saveAs . addActionListener ( new ActionListener ( ) { @ Override public final void actionPerformed ( final ActionEvent event ) { saveAs ( ) ; } } ) ; final JMenuItem print = new JMenuItem ( LanguageManager . getString ( "editor.menu.file.print" ) ) ; print . addActionListener ( new ActionListener ( ) { @ Override public final void actionPerformed ( final ActionEvent event ) { try { final StringBuilder builder = new StringBuilder ( ) ; builder . append ( getNodeContent ( EditorFrame . variables , new StringBuilder ( ) ) ) ; builder . append ( getNodeContent ( EditorFrame . beginning , new StringBuilder ( ) ) ) ; builder . append ( new AlgoTreeNode ( Keyword . END ) ) ; final PrintRequestAttributeSet printRequest = new HashPrintRequestAttributeSet ( ) ; final DocFlavor flavor = DocFlavor . INPUT_STREAM . AUTOSENSE ; final PrintService service = ServiceUI . printDialog ( GraphicsEnvironment . getLocalGraphicsEnvironment ( ) . getDefaultScreenDevice ( ) . getDefaultConfiguration ( ) , 200 , 200 , PrintServiceLookup . lookupPrintServices ( flavor , printRequest ) , PrintServiceLookup . lookupDefaultPrintService ( ) , flavor , printRequest ) ; if ( service != null ) { service . createPrintJob ( ) . print ( new SimpleDoc ( new ByteArrayInputStream ( new String ( ( ( "<html>" + ( builder . toString ( ) . replace ( "<html>" , "" ) . replace ( "<//html>" , "" ) ) ) + "<//html>" ) ) . getBytes ( StandardCharsets . UTF_8 ) ) , flavor , new HashDocAttributeSet ( ) ) , printRequest ) ; } } catch ( final Exception ex ) { ex . printStackTrace ( ) ; ErrorDialog . errorMessage ( EditorFrame . this , ex ) ; } } private final String getNodeContent ( final AlgoTreeNode node , final StringBuilder spaces ) { final StringBuilder builder = new StringBuilder ( ) ; builder . append ( ( ( node . toString ( ) ) + ( System . lineSeparator ( ) ) ) ) ; final int childCount = node . getChildCount ( ) ; if ( childCount > 0 ) { spaces . append ( "<seq2seq4repair_space>" ) ; for ( int i = 0 ; i != childCount ; i ++ ) { builder . append ( ( ( spaces . toString ( ) ) + ( getNodeContent ( ( ( AlgoTreeNode ) ( node . getChildAt ( i ) ) ) , spaces ) ) ) ) ; } spaces . delete ( 0 , 2 ) ; } return builder . toString ( ) ; } } ) ; print . setIcon ( new ImageIcon ( AlgogoDesktop . class . getResource ( "//fr//skyost//algo//desktop//res//icons//menu_print.png" ) ) ) ; print . setAccelerator ( KeyStroke . getKeyStroke ( 'P' , ctrl ) ) ; final JMenuItem close = new JMenuItem ( LanguageManager . getString ( "editor.menu.file.close" ) ) ; close . addActionListener ( new ActionListener ( ) { @ Override public final void actionPerformed ( final ActionEvent event ) { System . exit ( 0 ) ; } } ) ; close . setIcon ( new ImageIcon ( AlgogoDesktop . class . getResource ( "//fr//skyost//algo//desktop//res//icons//menu_close.png" ) ) ) ; close . setAccelerator ( KeyStroke . getKeyStroke ( 'Q' , ctrl ) ) ; final JMenuItem options = new JMenuItem ( LanguageManager . getString ( "editor.menu.edit.options" ) ) ; options . addActionListener ( new ActionListener ( ) { @ Override public final void actionPerformed ( final ActionEvent event ) { new OptionsDialog ( ) . setVisible ( true ) ; } } ) ; options . setIcon ( new ImageIcon ( AlgogoDesktop . class . getResource ( "//fr//skyost//algo//desktop//res//icons//menu_options.png" ) ) ) ; final JMenuItem paste = new JMenuItem ( LanguageManager . getString ( "editor.menu.edit.paste" ) ) ; final ActionListener pasteActionListener = new ActionListener ( ) { @ Override public final void actionPerformed ( final ActionEvent event ) { final TreePath [ ] paths = EditorFrame . tree . getSelectionPaths ( ) ; if ( paths == null ) { return ; } for ( final AlgoTreeNode node : EditorFrame . clipboard ) { <START_BUG> addNode ( node ) ; <END_BUG> } } } ; paste . addActionListener ( pasteActionListener ) ; paste . setIcon ( new ImageIcon ( AlgogoDesktop . class . getResource ( "//fr//skyost//algo//desktop//res//icons//menu_paste.png" ) ) ) ; paste . setAccelerator ( KeyStroke . getKeyStroke ( 'V' , ctrl ) ) ; component . getInputMap ( ) . put ( KeyStroke . getKeyStroke ( 'V' , ctrl ) , "pasteActionListener" ) ; paste . setEnabled ( false ) ; final JMenuItem cut = new JMenuItem ( LanguageManager . getString ( "editor.menu.edit.cut" ) ) ; final ActionListener cutActionListener = new ActionListener ( ) { @ Override public final void actionPerformed ( final ActionEvent event ) { final TreePath [ ] paths = EditorFrame . tree . getSelectionPaths ( ) ; if ( ( paths == null ) || ( ( paths . length ) < 0 ) ) { return ; } final AlgoTreeNode selected = ( ( AlgoTreeNode ) ( paths [ 0 ] . getLastPathComponent ( ) ) ) ; if ( ( ( selected . equals ( EditorFrame . variables ) ) || ( selected . equals ( EditorFrame . beginning ) ) ) || ( selected . equals ( EditorFrame . end ) ) ) { return ; } EditorFrame . clipboard . clear ( ) ; for ( final TreePath path : paths ) { final AlgoTreeNode node = ( ( AlgoTreeNode ) ( path . getLastPathComponent ( ) ) ) ; EditorFrame . clipboard . add ( node . clone ( ) ) ; removeNode ( node ) ; } paste . setEnabled ( true ) ; } } ; cut . addActionListener ( cutActionListener ) ; cut . setIcon ( new ImageIcon ( AlgogoDesktop . class . getResource ( "//fr//skyost//algo//desktop//res//icons//menu_cut.png" ) ) ) ;

Fix:
addNode ( node . clone ( ) ) ;