|
37 | 37 | // org.codehaus.mojo:animal-sniffer-annotations. The standard |
38 | 38 | // marker has no explanation field; the original strings are |
39 | 39 | // preserved as adjacent // comments. |
| 40 | +// 5. Three catch clauses that swallow InterruptedException |
| 41 | +// (isAndroidTermux, getHardwareName, and resolveArmArchType) |
| 42 | +// re-interrupt the current thread via |
| 43 | +// Thread.currentThread().interrupt() before returning, restoring |
| 44 | +// the thread's interrupt flag (SonarQube java:S2142). Upstream |
| 45 | +// silently swallows the interrupt. |
40 | 46 | // The original Apache-2.0 copyright header from the upstream file is |
41 | 47 | // preserved verbatim below. |
42 | 48 |
|
@@ -185,6 +191,9 @@ public static boolean isAndroidRuntime() { |
185 | 191 | public static boolean isAndroidTermux() { |
186 | 192 | try { |
187 | 193 | return processRunner.runAndWaitFor("uname -o").toLowerCase().contains("android"); |
| 194 | + } catch (InterruptedException e) { |
| 195 | + Thread.currentThread().interrupt(); |
| 196 | + return false; |
188 | 197 | } catch (Exception ignored) { |
189 | 198 | return false; |
190 | 199 | } |
@@ -229,6 +238,9 @@ static String getHardwareName() { |
229 | 238 | try { |
230 | 239 | return processRunner.runAndWaitFor("uname -m"); |
231 | 240 | } catch (Throwable e) { |
| 241 | + if (e instanceof InterruptedException) { |
| 242 | + Thread.currentThread().interrupt(); |
| 243 | + } |
232 | 244 | LogHolder.logger.error("Error while running uname -m", e); |
233 | 245 | return "unknown"; |
234 | 246 | } |
@@ -301,6 +313,9 @@ static String resolveArmArchType() { |
301 | 313 | } |
302 | 314 | } catch (IOException | InterruptedException e) { |
303 | 315 | // ignored: fall back to "arm" arch (soft-float ABI) |
| 316 | + if (e instanceof InterruptedException) { |
| 317 | + Thread.currentThread().interrupt(); |
| 318 | + } |
304 | 319 | } |
305 | 320 | } |
306 | 321 | // Use armv5, soft-float ABI |
|
0 commit comments