Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cfc604

Browse files
committed
More sonar fixes
Signed-off-by: Rob Stryker <[email protected]>
1 parent b05bd6d commit 7cfc604

4 files changed

Lines changed: 20 additions & 17 deletions

File tree

framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/eclipse/debug/core/model/RuntimeProcess.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,7 @@ public void run() {
431431
try {
432432
fOSProcess.waitFor();
433433
} catch (InterruptedException ie) {
434-
// clear interrupted state
435-
// This is intentional
436-
Thread.interrupted();
434+
Thread.currentThread().interrupt();
437435
} finally {
438436
fOSProcess = null;
439437
fRuntimeProcess.terminated();

framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/eclipse/debug/internal/core/InputStreamMonitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ protected void writeNext() {
158158
fLock.wait();
159159
}
160160
} catch (InterruptedException e) {
161-
// Intentionally not rethrown or set to interrupted
161+
Thread.currentThread().interrupt();
162+
close();
162163
}
163164
}
164165

framework/bundles/org.jboss.tools.rsp.launching/src/main/java/org/jboss/tools/rsp/eclipse/debug/internal/core/OutputStreamMonitor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ protected void close() {
108108
try {
109109
thread.join();
110110
} catch (InterruptedException ie) {
111-
// Intentionally not rethrown or interrupt flag set.
112-
// Copied from org.eclipse
111+
Thread.currentThread().interrupt();
113112
}
114113
fListeners = new ListenerList<>();
115114
}
@@ -185,8 +184,8 @@ private void read() {
185184
try {
186185
Thread.sleep(1); // just give up CPU to maintain UI responsiveness.
187186
} catch (InterruptedException e) {
188-
// Intentionally not rethrown or interrupt flag set.
189-
// Copied from org.eclipse
187+
Thread.currentThread().interrupt();
188+
kill();
190189
}
191190
}
192191
}

framework/bundles/org.jboss.tools.rsp.server.spi/src/main/java/org/jboss/tools/rsp/server/spi/model/polling/PollThread.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,19 @@ public void run() {
5555
return;
5656
}
5757

58-
int maxWait = getTimeout();
59-
60-
long startTime = System.currentTimeMillis();
61-
boolean done = false;
62-
boolean serverStartedOrStopped = false;
6358
try {
6459
poller.beginPolling(getServer(), expectedState);
65-
60+
} catch(Exception e) {
61+
LOG.error("Error occurred while polling, aborting.", e);
62+
cancel(e.getMessage(), CANCELATION_CAUSE.FAILED);
63+
}
64+
65+
try {
66+
int maxWait = getTimeout();
67+
long startTime = System.currentTimeMillis();
68+
boolean done = false;
69+
boolean serverStartedOrStopped = false;
70+
6671
// begin the loop; ask the poller every so often
6772
while (!serverStartedOrStopped
6873
&& !isAborted()
@@ -99,9 +104,9 @@ public void run() {
99104
// we timed out. get response from preferences
100105
handleTimeoutTermination();
101106
}
102-
} catch(Exception e) {
103-
LOG.error("Error occurred while polling, aborting.", e);
104-
cancel(e.getMessage(), CANCELATION_CAUSE.FAILED);
107+
} catch( RuntimeException re) {
108+
LOG.error("Error occurred while polling, aborting.", re);
109+
cancel(re.getMessage(), CANCELATION_CAUSE.FAILED);
105110
}
106111
}
107112

0 commit comments

Comments
 (0)