1
1
/*******************************************************************************
2
- * Copyright (c) 2021 Syntevo and others.
2
+ * Copyright (c) 2021, 2023 Syntevo and others.
3
3
*
4
4
* This program and the accompanying materials
5
5
* are made available under the terms of the Eclipse Public License 2.0
@@ -59,12 +59,12 @@ public void stash(Throwable throwable) {
59
59
try {
60
60
Display display = Display .getCurrent ();
61
61
if (display != null ) {
62
- if (throwable instanceof RuntimeException ) {
63
- display .getRuntimeExceptionHandler ().accept (( RuntimeException ) throwable );
62
+ if (throwable instanceof RuntimeException runtimeEx ) {
63
+ display .getRuntimeExceptionHandler ().accept (runtimeEx );
64
64
/* If handler doesn't throw then the exception is fully handled */
65
65
return ;
66
- } else if (throwable instanceof Error ) {
67
- display .getErrorHandler ().accept (( Error ) throwable );
66
+ } else if (throwable instanceof Error er ) {
67
+ display .getErrorHandler ().accept (er );
68
68
/* If handler doesn't throw then the exception is fully handled */
69
69
return ;
70
70
}
@@ -88,10 +88,10 @@ public void close() {
88
88
Throwable throwable = storedThrowable ;
89
89
storedThrowable = null ;
90
90
91
- if (throwable instanceof RuntimeException ) {
92
- throw ( RuntimeException ) throwable ;
93
- } else if (throwable instanceof Error ) {
94
- throw ( Error ) throwable ;
91
+ if (throwable instanceof RuntimeException runtimeEx ) {
92
+ throw runtimeEx ;
93
+ } else if (throwable instanceof Error er ) {
94
+ throw er ;
95
95
}
96
96
}
97
97
0 commit comments