[bindings d-e] Fix exception handling (Jetty HTTP client) (#10476)

Fixes #10474

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo
2021-04-06 17:37:19 +02:00
committed by GitHub
parent fed460218e
commit 8ab37ce285
20 changed files with 73 additions and 62 deletions

View File

@@ -145,6 +145,7 @@ public class DenonMarantzTelnetClientThread extends Thread {
listener.telnetClientConnected(false);
} catch (InterruptedException e) {
logger.debug("Interrupted while connecting to {}", config.getHost(), e);
Thread.currentThread().interrupt();
}
delay = RECONNECT_DELAY;
}

View File

@@ -127,6 +127,7 @@ public class DenonMarantzTelnetConnector extends DenonMarantzConnector implement
Thread.sleep(300);
} catch (InterruptedException e) {
logger.trace("requestStateOverTelnet() - Interrupted while requesting state.");
Thread.currentThread().interrupt();
}
}
});

View File

@@ -200,7 +200,7 @@ public class DenonMarantzHandler extends BaseThingHandler implements DenonMarant
* Try to auto configure the connection type (Telnet or HTTP)
* for Things not added through Paper UI.
*/
private void autoConfigure() {
private void autoConfigure() throws InterruptedException {
/*
* The isTelnet parameter has no default.
* When not set we will try to auto-detect the correct values
@@ -223,7 +223,7 @@ public class DenonMarantzHandler extends BaseThingHandler implements DenonMarant
telnetEnable = false;
httpApiUsable = true;
}
} catch (InterruptedException | TimeoutException | ExecutionException e) {
} catch (TimeoutException | ExecutionException e) {
logger.debug("Error when trying to access AVR using HTTP on port 80, reverting to Telnet mode.", e);
}
@@ -239,7 +239,7 @@ public class DenonMarantzHandler extends BaseThingHandler implements DenonMarant
httpPort = 8080;
httpApiUsable = true;
}
} catch (InterruptedException | TimeoutException | ExecutionException e) {
} catch (TimeoutException | ExecutionException e) {
logger.debug("Additionally tried to connect to port 8080, this also failed", e);
}
}
@@ -255,7 +255,7 @@ public class DenonMarantzHandler extends BaseThingHandler implements DenonMarant
response = httpClient.newRequest("http://" + host + ":" + httpPort + "/goform/Deviceinfo.xml")
.timeout(3, TimeUnit.SECONDS).send();
status = response.getStatus();
} catch (InterruptedException | TimeoutException | ExecutionException e) {
} catch (TimeoutException | ExecutionException e) {
logger.debug("Failed in fetching the Deviceinfo.xml to determine zone count", e);
}
@@ -303,7 +303,12 @@ public class DenonMarantzHandler extends BaseThingHandler implements DenonMarant
// Configure Connection type (Telnet/HTTP) and number of zones
// Note: this only happens for discovered Things
autoConfigure();
try {
autoConfigure();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
if (!checkConfiguration()) {
return;