[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:
@@ -15,7 +15,9 @@ package org.openhab.binding.daikin.internal;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
@@ -234,8 +236,11 @@ public class DaikinWebTargets {
|
||||
return response.getContentAsString();
|
||||
} catch (DaikinCommunicationException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
} catch (ExecutionException | TimeoutException e) {
|
||||
throw new DaikinCommunicationException("Daikin HTTP error", e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new DaikinCommunicationException("Daikin HTTP interrupted", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class BasicInfo {
|
||||
private static final Logger logger = LoggerFactory.getLogger(BasicInfo.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(BasicInfo.class);
|
||||
|
||||
public String mac = "";
|
||||
public String ret = "";
|
||||
@@ -38,7 +38,7 @@ public class BasicInfo {
|
||||
}
|
||||
|
||||
public static BasicInfo parse(String response) {
|
||||
logger.debug("Parsing string: \"{}\"", response);
|
||||
LOGGER.debug("Parsing string: \"{}\"", response);
|
||||
|
||||
Map<String, String> responseMap = InfoParser.parse(response);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class EnergyInfoDayAndWeek {
|
||||
public Optional<Double> energyCoolingThisWeek = Optional.empty();
|
||||
public Optional<Double> energyCoolingLastWeek = Optional.empty();
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EnergyInfoDayAndWeek.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EnergyInfoDayAndWeek.class);
|
||||
|
||||
private EnergyInfoDayAndWeek() {
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class EnergyInfoDayAndWeek {
|
||||
public static EnergyInfoDayAndWeek parse(String response) {
|
||||
EnergyInfoDayAndWeek info = new EnergyInfoDayAndWeek();
|
||||
|
||||
logger.trace("Parsing string: \"{}\"", response);
|
||||
LOGGER.trace("Parsing string: \"{}\"", response);
|
||||
|
||||
// /aircon/get_week_power_ex
|
||||
// ret=OK,s_dayw=0,week_heat=1/1/1/1/1/5/2/1/1/1/1/2/1/1,week_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0
|
||||
@@ -94,7 +94,7 @@ public class EnergyInfoDayAndWeek {
|
||||
info.energyCoolingLastWeek = Optional.of(previousWeekEnergy / 10);
|
||||
}
|
||||
} else {
|
||||
logger.debug("did not receive 'ret=OK' from adapter");
|
||||
LOGGER.debug("did not receive 'ret=OK' from adapter");
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ public class EnergyInfoYear {
|
||||
}
|
||||
|
||||
public static EnergyInfoYear parse(String response) {
|
||||
|
||||
LOGGER.trace("Parsing string: \"{}\"", response);
|
||||
|
||||
Map<String, String> responseMap = InfoParser.parse(response);
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class AirbaseBasicInfo {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AirbaseBasicInfo.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AirbaseBasicInfo.class);
|
||||
|
||||
public String mac = "";
|
||||
public String ret = "";
|
||||
@@ -39,7 +39,7 @@ public class AirbaseBasicInfo {
|
||||
}
|
||||
|
||||
public static AirbaseBasicInfo parse(String response) {
|
||||
logger.debug("Parsing string: \"{}\"", response);
|
||||
LOGGER.debug("Parsing string: \"{}\"", response);
|
||||
|
||||
Map<String, String> responseMap = InfoParser.parse(response);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.slf4j.LoggerFactory;
|
||||
* @author Paul Smedley - Modifications to support Airbase Controllers
|
||||
* @author Lukas Agethen - Added support for Energy Year reading, compressor frequency and powerful mode
|
||||
* @author Wouter Denayer - Added to support for weekly & daily energy reading
|
||||
*
|
||||
*
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class DaikinAcUnitHandler extends DaikinBaseHandler {
|
||||
@@ -281,7 +281,7 @@ public class DaikinAcUnitHandler extends DaikinBaseHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param channel
|
||||
* @param maybePower
|
||||
*/
|
||||
@@ -304,7 +304,7 @@ public class DaikinAcUnitHandler extends DaikinBaseHandler {
|
||||
return;
|
||||
}
|
||||
webTargets.registerUuid(key);
|
||||
} catch (Exception e) {
|
||||
} catch (DaikinCommunicationException e) {
|
||||
// suppress exceptions
|
||||
logger.debug("registerUuid({}) error: {}", key, e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user