Skip to content

Commit 007a5f6

Browse files
committed
Upgraded HC StyleCheck to version 3; fixed style-check violations (no functional changes)
1 parent e9560a4 commit 007a5f6

File tree

125 files changed

+619
-612
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+619
-612
lines changed

httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/CacheContextBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected HttpCacheContext createContext() {
109109

110110
@Override
111111
public HttpCacheContext build() {
112-
final HttpCacheContext context = super.build();
112+
final HttpCacheContext context = super.build();
113113
context.setRequestCacheControl(cacheControl);
114114
return context;
115115
}

httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HeaderConstants.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ public class HeaderConstants {
165165
public static final String CACHE_CONTROL_STALE_WHILE_REVALIDATE = "stale-while-revalidate";
166166
public static final String CACHE_CONTROL_ONLY_IF_CACHED = "only-if-cached";
167167
public static final String CACHE_CONTROL_MUST_UNDERSTAND = "must-understand";
168-
public static final String CACHE_CONTROL_IMMUTABLE= "immutable";
168+
public static final String CACHE_CONTROL_IMMUTABLE = "immutable";
169+
169170
/**
170171
* @deprecated Use {@link #CACHE_CONTROL_STALE_IF_ERROR}
171172
*/

httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ private void handleCacheHit(
721721
final AsyncExecChain.Scope scope,
722722
final AsyncExecChain chain,
723723
final AsyncExecCallback asyncExecCallback) {
724-
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
724+
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
725725
final String exchangeId = scope.exchangeId;
726726

727727
if (LOG.isDebugEnabled()) {

httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public int getMaxCacheEntries() {
227227
/**
228228
* Returns the number of times to retry a cache processChallenge on failure
229229
*/
230-
public int getMaxUpdateRetries(){
230+
public int getMaxUpdateRetries() {
231231
return maxUpdateRetries;
232232
}
233233

httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachedResponseSuitabilityChecker.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public CacheSuitability assessSuitability(final RequestCacheControl requestCache
198198

199199
boolean requestMethodMatch(final HttpRequest request, final HttpCacheEntry entry) {
200200
return request.getMethod().equalsIgnoreCase(entry.getRequestMethod()) ||
201-
(Method.HEAD.isSame(request.getMethod()) && Method.GET.isSame(entry.getRequestMethod()));
201+
Method.HEAD.isSame(request.getMethod()) && Method.GET.isSame(entry.getRequestMethod());
202202
}
203203

204204
boolean requestUriMatch(final HttpRequest request, final HttpCacheEntry entry) {
@@ -295,10 +295,10 @@ public boolean allConditionalsMatch(final HttpRequest request, final HttpCacheEn
295295
return true;
296296
}
297297

298-
final boolean etagValidatorMatches = (hasEtagValidator) && etagValidatorMatches(request, entry);
299-
final boolean lastModifiedValidatorMatches = (hasLastModifiedValidator) && lastModifiedValidatorMatches(request, entry, now);
298+
final boolean etagValidatorMatches = hasEtagValidator && etagValidatorMatches(request, entry);
299+
final boolean lastModifiedValidatorMatches = hasLastModifiedValidator && lastModifiedValidatorMatches(request, entry, now);
300300

301-
if ((hasEtagValidator && hasLastModifiedValidator)
301+
if (hasEtagValidator && hasLastModifiedValidator
302302
&& !(etagValidatorMatches && lastModifiedValidatorMatches)) {
303303
return false;
304304
} else if (hasEtagValidator && !etagValidatorMatches) {
@@ -309,9 +309,9 @@ public boolean allConditionalsMatch(final HttpRequest request, final HttpCacheEn
309309
}
310310

311311
boolean hasUnsupportedConditionalHeaders(final HttpRequest request) {
312-
return (request.containsHeader(HttpHeaders.IF_RANGE)
312+
return request.containsHeader(HttpHeaders.IF_RANGE)
313313
|| request.containsHeader(HttpHeaders.IF_MATCH)
314-
|| request.containsHeader(HttpHeaders.IF_UNMODIFIED_SINCE));
314+
|| request.containsHeader(HttpHeaders.IF_UNMODIFIED_SINCE);
315315
}
316316

317317
boolean hasSupportedEtagValidator(final HttpRequest request) {

httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ ClassicHttpResponse callBackend(
218218
final HttpHost target,
219219
final ClassicHttpRequest request,
220220
final ExecChain.Scope scope,
221-
final ExecChain chain) throws IOException, HttpException {
221+
final ExecChain chain) throws IOException, HttpException {
222222

223223
final String exchangeId = scope.exchangeId;
224224
final Instant requestDate = getCurrentDate();
@@ -244,7 +244,7 @@ private ClassicHttpResponse handleCacheHit(
244244
final ExecChain.Scope scope,
245245
final ExecChain chain) throws IOException, HttpException {
246246
final String exchangeId = scope.exchangeId;
247-
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
247+
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
248248

249249
if (LOG.isDebugEnabled()) {
250250
LOG.debug("{} cache hit: {}", exchangeId, new RequestLine(request));
@@ -353,7 +353,7 @@ ClassicHttpResponse revalidateCacheEntry(
353353
final ClassicHttpRequest request,
354354
final ExecChain.Scope scope,
355355
final ExecChain chain) throws IOException, HttpException {
356-
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
356+
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
357357
Instant requestDate = getCurrentDate();
358358
final ClassicHttpRequest conditionalRequest = conditionalRequestBuilder.buildConditionalRequest(
359359
responseCacheControl, request, hit.entry);
@@ -397,7 +397,7 @@ ClassicHttpResponse revalidateCacheEntryWithoutFallback(
397397
final ExecChain.Scope scope,
398398
final ExecChain chain) throws HttpException {
399399
final String exchangeId = scope.exchangeId;
400-
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
400+
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
401401
try {
402402
return revalidateCacheEntry(responseCacheControl, hit, target, request, scope, chain);
403403
} catch (final IOException ex) {
@@ -418,7 +418,7 @@ ClassicHttpResponse revalidateCacheEntryWithFallback(
418418
final ExecChain.Scope scope,
419419
final ExecChain chain) throws HttpException, IOException {
420420
final String exchangeId = scope.exchangeId;
421-
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
421+
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
422422
final ClassicHttpResponse response;
423423
try {
424424
response = revalidateCacheEntry(responseCacheControl, hit, target, request, scope, chain);
@@ -490,7 +490,7 @@ ClassicHttpResponse cacheAndReturnResponse(
490490
final Instant requestSent,
491491
final Instant responseReceived) throws IOException {
492492
final String exchangeId = scope.exchangeId;
493-
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
493+
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
494494
final int statusCode = backendResponse.getCode();
495495
// handle 304 Not Modified responses
496496
if (statusCode == HttpStatus.SC_NOT_MODIFIED) {
@@ -573,7 +573,7 @@ private ClassicHttpResponse handleCacheMiss(
573573
}
574574
cacheMisses.getAndIncrement();
575575

576-
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
576+
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
577577
if (requestCacheControl.isOnlyIfCached()) {
578578
if (LOG.isDebugEnabled()) {
579579
LOG.debug("{} request marked only-if-cached", exchangeId);
@@ -643,7 +643,7 @@ ClassicHttpResponse negotiateResponseFromVariants(
643643
return callBackend(target, unconditional, scope, chain);
644644
}
645645

646-
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
646+
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
647647
context.setCacheResponseStatus(CacheResponseStatus.VALIDATED);
648648
cacheUpdates.getAndIncrement();
649649

httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ManagedHttpCacheStorage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ public boolean isActive() {
240240
return active.get();
241241
}
242242

243-
private boolean compareAndSet(){
243+
private boolean compareAndSet() {
244244
return this.active.compareAndSet(true, false);
245245
}
246+
246247
}

httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ protected boolean isExplicitlyNonCacheable(final ResponseCacheControl cacheContr
235235
// The response is considered explicitly non-cacheable if it contains
236236
// "no-store" or (if sharedCache is true) "private" directives.
237237
// Note that "no-cache" is considered cacheable but requires validation before use.
238-
return cacheControl.isNoStore() || (sharedCache && cacheControl.isCachePrivate());
238+
return cacheControl.isNoStore() || sharedCache && cacheControl.isCachePrivate();
239239
}
240240

241241
protected boolean isExplicitlyCacheable(final ResponseCacheControl cacheControl, final HttpResponse response) {
@@ -371,11 +371,11 @@ private Duration calculateFreshnessLifetime(final ResponseCacheControl cacheCont
371371
* @return true if the HTTP status code is understood, false otherwise.
372372
*/
373373
private boolean understoodStatusCode(final int status) {
374-
return (status >= 200 && status <= 206) ||
375-
(status >= 300 && status <= 399) ||
376-
(status >= 400 && status <= 417) ||
377-
(status == 421) ||
378-
(status >= 500 && status <= 505);
374+
return status >= 200 && status <= 206 ||
375+
status >= 300 && status <= 399 ||
376+
status >= 400 && status <= 417 ||
377+
status == 421 ||
378+
status >= 500 && status <= 505;
379379
}
380380

381381
/**

httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void canGetOriginalHeaders() {
176176
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK, headers, mockResource, null);
177177
final Header[] result = entry.getHeaders();
178178
assertEquals(headers.length, result.length);
179-
for(int i=0; i<headers.length; i++) {
179+
for (int i = 0; i < headers.length; i++) {
180180
assertEquals(headers[i], result[i]);
181181
}
182182
}

httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/HttpTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static boolean equivalent(final HttpEntity e1, final HttpEntity e2) throw
8080
return false;
8181
}
8282
}
83-
return (-1 == i2.read());
83+
return -1 == i2.read();
8484
}
8585

8686
/*

0 commit comments

Comments
 (0)