]> git.basschouten.com Git - openhab-addons.git/commitdiff
[sonyprojector] Fix handling of InterruptedException (Thread.sleep) (#10458)
authorlolodomo <lg.hc@free.fr>
Tue, 6 Apr 2021 06:47:20 +0000 (08:47 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Apr 2021 06:47:20 +0000 (08:47 +0200)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/SonyProjectorConnector.java
bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/serial/SonyProjectorSerialConnector.java

index 5db6305c33b627a783973f380829e93f261a540f..c037924dd90546c7169c81aa349e2a28d4f867fe 100644 (file)
@@ -950,9 +950,13 @@ public abstract class SonyProjectorConnector {
             if (!runningSession) {
                 close();
             }
-        } catch (SonyProjectorException | InterruptedException e) {
+        } catch (SonyProjectorException e) {
             logger.debug("Send IR {} failed: {}", item.getName(), e.getMessage());
             throw new SonyProjectorException("Send IR " + item.getName() + " failed: " + e.getMessage());
+        } catch (InterruptedException e) {
+            logger.debug("Send IR {} interrupted: {}", item.getName(), e.getMessage());
+            Thread.currentThread().interrupt();
+            throw new SonyProjectorException("Send IR " + item.getName() + " interrupted: " + e.getMessage());
         }
 
         logger.debug("Send IR {} succeeded", item.getName());
index 2d0787d009bdc676527642812fb5d98cc2f35a22..673c86182d18470d369039a188aaca019fa8d5d3 100644 (file)
@@ -302,6 +302,7 @@ public class SonyProjectorSerialConnector extends SonyProjectorConnector impleme
             logger.debug("RXTX library CPU load workaround, sleep forever");
             Thread.sleep(Long.MAX_VALUE);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
         }
     }
 }