eirikbakke commented on code in PR #8024:
URL: https://github.com/apache/netbeans/pull/8024#discussion_r1875048855
##########
platform/o.n.bootstrap/src/org/netbeans/NbClipboard.java:
##########
@@ -475,20 +475,34 @@ private final class SetContents implements Runnable {
@Override
public void run() {
try {
- systemClipboard.setContents(cnts, ownr);
- } catch (IllegalStateException e) {
- //#139616
- if(log.isLoggable(Level.FINE)) {
- log.log(Level.FINE, "systemClipboard not available", e);
// NOI18N
- } else {
- log.log(Level.INFO, "systemClipboard#setContents threw
IllegalStateException"); // NOI18N
+ /* The loop will actually stop before getting to 10 iterations,
per the delay
+ formula and conditional throw. But keep the MAX_TRIES just as
a fail-safe. */
+ final int MAX_TRIES = 10;
+ final long start = System.currentTimeMillis();
+ int delay = 20;
+ for (int i = 0; i < MAX_TRIES; i++) {
+ try {
+ systemClipboard.setContents(cnts, ownr);
+ } catch (IllegalStateException ex) {
+ if (i == (MAX_TRIES - 1) ||
(System.currentTimeMillis() + delay - start) > 1000L) {
+ throw ex;
+ } else {
+ log.log(Level.INFO, "systemClipboard#getContents
ISE, attempt {0}", i + 1); // NOI18N
Review Comment:
Log message should say setContents instead of getContents here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists