mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
Simplify instanceof checks (#19645)
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
+3
-6
@@ -156,8 +156,7 @@ public class IndegoController {
|
||||
} catch (TimeoutException e) {
|
||||
throw new IndegoException(e);
|
||||
} catch (ExecutionException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause != null && cause instanceof HttpResponseException httpResponseException) {
|
||||
if (e.getCause() instanceof HttpResponseException httpResponseException) {
|
||||
Response response = httpResponseException.getResponse();
|
||||
if (response.getStatus() == HttpStatus.UNAUTHORIZED_401) {
|
||||
/*
|
||||
@@ -216,8 +215,7 @@ public class IndegoController {
|
||||
} catch (TimeoutException e) {
|
||||
throw new IndegoException(e);
|
||||
} catch (ExecutionException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause != null && cause instanceof HttpResponseException httpResponseException) {
|
||||
if (e.getCause() instanceof HttpResponseException httpResponseException) {
|
||||
Response response = httpResponseException.getResponse();
|
||||
if (response.getStatus() == HttpStatus.UNAUTHORIZED_401) {
|
||||
/*
|
||||
@@ -315,8 +313,7 @@ public class IndegoController {
|
||||
} catch (TimeoutException e) {
|
||||
throw new IndegoException(e);
|
||||
} catch (ExecutionException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause != null && cause instanceof HttpResponseException httpResponseException) {
|
||||
if (e.getCause() instanceof HttpResponseException httpResponseException) {
|
||||
Response response = httpResponseException.getResponse();
|
||||
if (response.getStatus() == HttpStatus.UNAUTHORIZED_401) {
|
||||
/*
|
||||
|
||||
+1
-2
@@ -95,8 +95,7 @@ public class Client {
|
||||
|
||||
return parseXmlResponse(responseContent, configResolution);
|
||||
} catch (ExecutionException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause != null && cause instanceof HttpResponseException httpResponseException) {
|
||||
if (e.getCause() instanceof HttpResponseException httpResponseException) {
|
||||
Response response = httpResponseException.getResponse();
|
||||
if (response.getStatus() == HttpStatus.UNAUTHORIZED_401) {
|
||||
/*
|
||||
|
||||
+1
-2
@@ -377,8 +377,7 @@ public class SleepIQImpl implements SleepIQ {
|
||||
throw new CommunicationException("Communication error while accessing API: " + e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
logger.debug("SleepIQ: doRequest: ExecutionException message={}", e.getMessage(), e);
|
||||
Throwable cause = e.getCause();
|
||||
if (cause instanceof HttpResponseException httpResponseException) {
|
||||
if (e.getCause() instanceof HttpResponseException httpResponseException) {
|
||||
Response response = httpResponseException.getResponse();
|
||||
if (response.getStatus() == HttpStatus.UNAUTHORIZED_401) {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user