From 95b21a826e5d81fdeabcf4673a9e87047edaec9d Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 4 Dec 2019 22:54:51 +0100 Subject: to some more code quality tasks --- .../java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java | 4 ++-- .../src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpUtils.java | 6 +++--- .../src/main/java/at/gv/egiz/eaaf/core/impl/utils/ServletUtils.java | 2 +- .../src/main/java/at/gv/egiz/eaaf/core/impl/utils/StreamUtils.java | 6 +----- 4 files changed, 7 insertions(+), 11 deletions(-) (limited to 'eaaf_core_utils') diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java index 4e8be52e..c60fcd7f 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpClientFactory.java @@ -91,7 +91,7 @@ public class HttpClientFactory implements IHttpClientFactory { private final String mode; - private ClientAuthMode(final String mode) { + ClientAuthMode(final String mode) { this.mode = mode; } @@ -132,7 +132,7 @@ public class HttpClientFactory implements IHttpClientFactory { private final String type; - private KeyStoreType(final String type) { + KeyStoreType(final String type) { this.type = type; } diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpUtils.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpUtils.java index 394d2843..1f7601d8 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpUtils.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/HttpUtils.java @@ -62,7 +62,7 @@ public class HttpUtils { // add port if necessary final int port = request.getServerPort(); - if ((protocol.equals("http") && port != 80) || (protocol.equals("https") && port != 443)) { + if (protocol.equals("http") && port != 80 || protocol.equals("https") && port != 443) { buffer.append(':'); buffer.append(port); } @@ -78,8 +78,8 @@ public class HttpUtils { */ public static String extractAuthUrlFromRequest(final HttpServletRequest req) { String authUrl = req.getScheme() + "://" + req.getServerName(); - if ((req.getScheme().equalsIgnoreCase("https") && req.getServerPort() != 443) - || (req.getScheme().equalsIgnoreCase("http") && req.getServerPort() != 80)) { + if (req.getScheme().equalsIgnoreCase("https") && req.getServerPort() != 443 + || req.getScheme().equalsIgnoreCase("http") && req.getServerPort() != 80) { authUrl = authUrl.concat(":" + req.getServerPort()); } authUrl = authUrl.concat(req.getContextPath()); diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/ServletUtils.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/ServletUtils.java index 0d16e9cd..c8865465 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/ServletUtils.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/ServletUtils.java @@ -30,7 +30,7 @@ public class ServletUtils { * @return Context URL */ public static String getBaseUrl(final HttpServletRequest request) { - if ((request.getServerPort() == 80) || (request.getServerPort() == 443)) { + if (request.getServerPort() == 80 || request.getServerPort() == 443) { return request.getScheme() + "://" + request.getServerName() + request.getContextPath(); } else { return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/StreamUtils.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/StreamUtils.java index cc784870..795b71f7 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/StreamUtils.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/StreamUtils.java @@ -169,11 +169,7 @@ public class StreamUtils { while ((bytesRead = source.read(buffer)) >= 0) { destination.write(buffer, 0, bytesRead); } - } else { - while (source.read(buffer) >= 0) { - - } - } + } } // /** -- cgit v1.2.3