From 8f7db68d1aa5a8a33cd834b6073f19dcbada6243 Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Wed, 27 Apr 2022 23:09:37 +0200 Subject: [PATCH] Fix a few SAT findings (#2936) Signed-off-by: Wouter Born --- .../audio/internal/javasound/JavaSoundAudioSource.java | 7 +++++-- .../module/script/ScriptTransformationService.java | 1 - .../module/script/ScriptTransformationServiceTest.java | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/javasound/JavaSoundAudioSource.java b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/javasound/JavaSoundAudioSource.java index 792beb380c..167ffec36c 100644 --- a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/javasound/JavaSoundAudioSource.java +++ b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/javasound/JavaSoundAudioSource.java @@ -157,11 +157,14 @@ public class JavaSoundAudioSource implements AudioSource { if (openStreamRefs.contains(output)) { output.flush(); } - } catch (IOException e) { - if (e instanceof InterruptedIOException && openStreamRefs.isEmpty()) { + } catch (InterruptedIOException e) { + if (openStreamRefs.isEmpty()) { // task has been ended while writing return; } + logger.warn("InterruptedIOException while writing to source pipe: {}", + e.getMessage()); + } catch (IOException e) { logger.warn("IOException while writing to source pipe: {}", e.getMessage()); } catch (RuntimeException e) { logger.warn("RuntimeException while writing to source pipe: {}", e.getMessage()); diff --git a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/ScriptTransformationService.java b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/ScriptTransformationService.java index 937541793d..d45776aa63 100644 --- a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/ScriptTransformationService.java +++ b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/ScriptTransformationService.java @@ -146,7 +146,6 @@ public class ScriptTransformationService if (splitString.length != 2) { logger.warn("Parameter '{}' does not consist of two parts for configuration UID {}, skipping.", param, scriptUid); - } else { executionContext.setAttribute(splitString[0], splitString[1], ScriptContext.ENGINE_SCOPE); } diff --git a/bundles/org.openhab.core.automation.module.script/src/test/java/org/openhab/core/automation/module/script/ScriptTransformationServiceTest.java b/bundles/org.openhab.core.automation.module.script/src/test/java/org/openhab/core/automation/module/script/ScriptTransformationServiceTest.java index 2c8fe60aa3..0dbd23a4c0 100644 --- a/bundles/org.openhab.core.automation.module.script/src/test/java/org/openhab/core/automation/module/script/ScriptTransformationServiceTest.java +++ b/bundles/org.openhab.core.automation.module.script/src/test/java/org/openhab/core/automation/module/script/ScriptTransformationServiceTest.java @@ -49,7 +49,6 @@ import org.openhab.core.transform.TransformationException; @ExtendWith(MockitoExtension.class) @MockitoSettings(strictness = Strictness.LENIENT) public class ScriptTransformationServiceTest { - private static final String COMPILABLE_SCRIPT_TYPE = "compilableScript"; private static final String SCRIPT_TYPE = "script"; private static final String SCRIPT_UID = "scriptUid"; private static final String SCRIPT = "script";