From ffe687f47da0b9ed1ffaf7298e5d1aa3541efc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bl=C3=A4sing?= Date: Thu, 14 Sep 2023 23:02:37 +0200 Subject: [PATCH] Address review comments, to be squashed with f67f3ba17cc6b086e0c53765c9795cb5d2c720b3 --- platform/o.n.bootstrap/src/org/netbeans/NbClipboard.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/o.n.bootstrap/src/org/netbeans/NbClipboard.java b/platform/o.n.bootstrap/src/org/netbeans/NbClipboard.java index 410b6b11a6c0..7d44bc5d88c1 100644 --- a/platform/o.n.bootstrap/src/org/netbeans/NbClipboard.java +++ b/platform/o.n.bootstrap/src/org/netbeans/NbClipboard.java @@ -436,13 +436,14 @@ public void run() { // indefinitely. Running the access loop here is deemed similar // in nature. final int MAX_TRIES = 50; + final long start = System.currentTimeMillis(); for (int i = 0; i < MAX_TRIES; i++) { try { transferable = systemClipboard.getContents(this); break; } catch (IllegalStateException ex) { // Throw exception if retries failed - if(i == (MAX_TRIES - 1)) { + if (i == (MAX_TRIES - 1) || (System.currentTimeMillis() - start) > 980L) { throw ex; } else { log.log(Level.INFO, "systemClipboard#getContents threw IllegalStateException (try: {0})", i + 1); // NOI18N