]> git.basschouten.com Git - openhab-addons.git/commitdiff
Fix authentication after communication error (#15747)
authorJacob Laursen <jacob-github@vindvejr.dk>
Mon, 16 Oct 2023 18:07:52 +0000 (20:07 +0200)
committerGitHub <noreply@github.com>
Mon, 16 Oct 2023 18:07:52 +0000 (20:07 +0200)
Fixes #15746

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
bundles/org.openhab.voice.googletts/src/main/java/org/openhab/voice/googletts/internal/GoogleCloudAPI.java

index 7fc039187e7bc7e7184c685d2c9ab9e2ec38abdf..0a5ef5983e8fbe0bea5851a2c7f3524593edd3d6 100644 (file)
@@ -328,14 +328,16 @@ class GoogleCloudAPI {
         String format = getFormatForCodec(codec);
         try {
             return synthesizeSpeechByGoogle(text, voice, format);
-        } catch (AuthenticationException | CommunicationException e) {
-            logger.warn("Error initializing Google Cloud TTS service: {}", e.getMessage());
+        } catch (AuthenticationException e) {
+            logger.warn("Error authenticating Google Cloud TTS service: {}", e.getMessage());
             if (oAuthService != null) {
                 oAuthFactory.ungetOAuthService(GoogleTTSService.SERVICE_PID);
                 oAuthService = null;
             }
-            voices.clear();
+        } catch (CommunicationException e) {
+            logger.warn("Error initializing Google Cloud TTS service: {}", e.getMessage());
         }
+        voices.clear();
         return null;
     }