[openweathermap] Call Thread.currentThread().interrupt() on InterruptedException (#12314)
* Call Thread.currentThread().interrupt() on InterruptedException Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
9bb43461fb
commit
a517e6e768
|
@ -428,9 +428,15 @@ public class OpenWeatherMapConnection {
|
|||
throw new CommunicationException(
|
||||
errorMessage == null ? "@text/offline.communication-error" : errorMessage, e.getCause());
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
} catch (TimeoutException e) {
|
||||
String errorMessage = e.getMessage();
|
||||
logger.debug("InterruptedException or TimeoutException occurred during execution: {}", errorMessage, e);
|
||||
logger.debug("TimeoutException occurred during execution: {}", errorMessage, e);
|
||||
throw new CommunicationException(errorMessage == null ? "@text/offline.communication-error" : errorMessage,
|
||||
e.getCause());
|
||||
} catch (InterruptedException e) {
|
||||
String errorMessage = e.getMessage();
|
||||
logger.debug("InterruptedException occurred during execution: {}", errorMessage, e);
|
||||
Thread.currentThread().interrupt();
|
||||
throw new CommunicationException(errorMessage == null ? "@text/offline.communication-error" : errorMessage,
|
||||
e.getCause());
|
||||
}
|
||||
|
|
|
@ -138,9 +138,9 @@ public abstract class AbstractOpenWeatherMapHandler extends BaseThingHandler {
|
|||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
} catch (CommunicationException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getLocalizedMessage());
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getRawMessage());
|
||||
} catch (ConfigurationException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getLocalizedMessage());
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getRawMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue