GitHub user matthiasblaesing edited a comment on the discussion: Windows 
clipboard issues discussion

And this also ~reproduces the problem~ raises the assertion  for me:

```java
package eu.doppelhelix.test.clipboardreproducer;

import java.awt.Toolkit;
import java.awt.datatransfer.FlavorEvent;
import java.awt.datatransfer.FlavorListener;
import java.awt.datatransfer.StringSelection;
import javax.swing.SwingUtilities;

public class Clipboardreproducer2 {

    private static final System.Logger LOG = 
System.getLogger(Clipboardreproducer.class.getName());

    public static void main(String[] args) throws Exception {
        SwingUtilities.invokeLater(() -> {
            
Toolkit.getDefaultToolkit().getSystemClipboard().addFlavorListener(new 
FlavorListener() {
                @Override
                public void flavorsChanged(FlavorEvent e) {
                    LOG.log(System.Logger.Level.INFO, "Flavor Changed: {0} // 
{1}", e, SwingUtilities.isEventDispatchThread());
                }
            });
        });

        // Copy operation one: copy from EDT
        Runnable copy = new Runnable() {
            public void run() {
                try {
                    
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new 
StringSelection("Test"), null);
                    LOG.log(System.Logger.Level.INFO, "Copy 1");
                } catch (IllegalStateException ex) {
                    LOG.log(System.Logger.Level.ERROR, "Failed to invoke copy 
(1)", ex);
                }
                SwingUtilities.invokeLater(this);
            }
        };

        SwingUtilities.invokeLater(copy);

        Thread.sleep(60 * 1000);
    }

}
```

After 10-20 rounds I get assertion errors. It seems it just needs brute force 
to get into the problematic situation. I'll see if this is reproducible on a 
clean Windows 10/11 next. 

GitHub link: 
https://github.com/apache/netbeans/discussions/7051#discussioncomment-12743356

----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@netbeans.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to