Sonar refactorings

This commit is contained in:
Sven Kubiak 2022-02-04 15:58:55 +01:00
parent 6f48a5fbd5
commit d9cde1f429
2 changed files with 10 additions and 5 deletions

View File

@ -43,18 +43,18 @@ public class OpenClient {
StringBuilder params = new StringBuilder() StringBuilder params = new StringBuilder()
.append("email") .append("email")
.append("=") .append('=')
.append(email) .append(email)
.append("&") .append('&')
.append("password") .append("password")
.append("=") .append('=')
.append(password); .append(password);
if (twoFactor != null) { if (twoFactor != null) {
params params
.append("&") .append('&')
.append("twofa") .append("twofa")
.append("=") .append('=')
.append(twoFactor); .append(twoFactor);
} }
@ -72,6 +72,7 @@ public class OpenClient {
.response(response.body()) .response(response.body())
.isSuccessful((response.statusCode() == 200) ? true : false); .isSuccessful((response.statusCode() == 200) ? true : false);
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
Thread.currentThread().interrupt();
throw new JPushoverException("Pushover Login failed", e); throw new JPushoverException("Pushover Login failed", e);
} }
@ -124,6 +125,7 @@ public class OpenClient {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
messages = response.body(); messages = response.body();
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
Thread.currentThread().interrupt();
throw new JPushoverException("Failed to get messages", e); throw new JPushoverException("Failed to get messages", e);
} }
@ -169,6 +171,7 @@ public class OpenClient {
.response(response.body()) .response(response.body())
.isSuccessful((response.statusCode() == 200) ? true : false); .isSuccessful((response.statusCode() == 200) ? true : false);
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
Thread.currentThread().interrupt();
throw new JPushoverException("Failed to delete messages", e); throw new JPushoverException("Failed to delete messages", e);
} }
@ -242,6 +245,7 @@ public class OpenClient {
.response(response.body()) .response(response.body())
.isSuccessful(true); .isSuccessful(true);
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
Thread.currentThread().interrupt();
throw new JPushoverException("Failed to register new device", e); throw new JPushoverException("Failed to register new device", e);
} }

View File

@ -59,6 +59,7 @@ public class PushoverRequest {
try { try {
return httpClientBuilder.build().send(httpRequest, HttpResponse.BodyHandlers.ofString()); return httpClientBuilder.build().send(httpRequest, HttpResponse.BodyHandlers.ofString());
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
Thread.currentThread().interrupt();
throw new JPushoverException("Failed to execute HTTP request", e); throw new JPushoverException("Failed to execute HTTP request", e);
} }
} }