You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2021/10/23 16:34:48 UTC

[httpcomponents-client] 06/08: Change loop that don't loop for "if" conditions.

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit 277c7228c3c626b93b298dc94aee4a7895851715
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sun Oct 17 15:46:36 2021 +0200

    Change loop that don't loop for "if" conditions.
---
 .../org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java
index 9c787b6..9408669 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java
@@ -302,7 +302,7 @@ class ResponseCachingPolicy {
 
     private boolean from1_0Origin(final HttpResponse response) {
         final Iterator<HeaderElement> it = MessageSupport.iterate(response, HeaderConstants.VIA);
-        while (it.hasNext()) {
+        if (it.hasNext()) {
             final HeaderElement elt = it.next();
             final String proto = elt.toString().split("\\s")[0];
             if (proto.contains("/")) {