hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1719217 - in /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl: io/ nio/
Date Thu, 10 Dec 2015 21:26:55 GMT
Author: ggregory
Date: Thu Dec 10 21:26:55 2015
New Revision: 1719217

URL: http://svn.apache.org/viewvc?rev=1719217&view=rev
Log:
Reduce use of magic number 200 (Use HttpStatus.SC_OK)

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java?rev=1719217&r1=1719216&r2=1719217&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
Thu Dec 10 21:26:55 2015
@@ -39,6 +39,7 @@ import org.apache.hc.core5.http.HttpEnti
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
 import org.apache.hc.core5.http.io.HttpMessageParser;
@@ -157,7 +158,7 @@ public class DefaultBHttpServerConnectio
         ensureOpen();
         this.responseWriter.write(response, this.outbuffer);
         onResponseSubmitted(response);
-        if (response.getStatusLine().getStatusCode() >= 200) {
+        if (response.getStatusLine().getStatusCode() >= HttpStatus.SC_OK) {
             incrementResponseCount();
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java?rev=1719217&r1=1719216&r2=1719217&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java
Thu Dec 10 21:26:55 2015
@@ -143,7 +143,7 @@ public class HttpRequestExecutor {
                     if (conn.isDataAvailable(this.waitForContinue)) {
                         response = conn.receiveResponseHeader();
                         final int status = response.getStatusLine().getStatusCode();
-                        if (status < 200) {
+                        if (status < HttpStatus.SC_OK) {
                             if (status != HttpStatus.SC_CONTINUE) {
                                 throw new ProtocolException("Unexpected response: " + response.getStatusLine());
                             }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java?rev=1719217&r1=1719216&r2=1719217&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
Thu Dec 10 21:26:55 2015
@@ -180,7 +180,7 @@ public class HttpService {
                     handleException(ex, response);
                 }
             }
-            if (response.getStatusLine().getStatusCode() < 200) {
+            if (response.getStatusLine().getStatusCode() < HttpStatus.SC_OK) {
                 // Send 1xx response indicating the server expectations
                 // have been met
                 conn.sendResponseHeader(response);

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java?rev=1719217&r1=1719216&r2=1719217&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java
Thu Dec 10 21:26:55 2015
@@ -38,6 +38,7 @@ import org.apache.hc.core5.http.HttpEnti
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.LengthRequiredException;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
@@ -175,7 +176,7 @@ public class DefaultNHttpClientConnectio
                     this.response = this.responseParser.parse(this.inbuf, bytesRead == -1);
                 } while (bytesRead > 0 && this.response == null);
                 if (this.response != null) {
-                    if (this.response.getStatusLine().getStatusCode() >= 200) {
+                    if (this.response.getStatusLine().getStatusCode() >= HttpStatus.SC_OK)
{
                         final long len = this.incomingContentStrategy.determineLength(this.response);
                         if (len != ContentLengthStrategy.UNDEFINED) {
                             this.contentDecoder = createContentDecoder(

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java?rev=1719217&r1=1719216&r2=1719217&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java
Thu Dec 10 21:26:55 2015
@@ -38,6 +38,7 @@ import org.apache.hc.core5.http.HttpEnti
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
 import org.apache.hc.core5.http.nio.NHttpMessageParser;
@@ -265,7 +266,7 @@ public class DefaultNHttpServerConnectio
         this.responseWriter.write(response, this.outbuf);
         this.hasBufferedOutput = this.outbuf.hasData();
 
-        if (response.getStatusLine().getStatusCode() >= 200) {
+        if (response.getStatusLine().getStatusCode() >= HttpStatus.SC_OK) {
             this.connMetrics.incrementResponseCount();
             final HttpEntity entity = response.getEntity();
             if (entity != null) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java?rev=1719217&r1=1719216&r2=1719217&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java
Thu Dec 10 21:26:55 2015
@@ -415,7 +415,7 @@ public class HttpAsyncService implements
             }
             final HttpResponse response = outgoing.getResponse();
             final int status = response.getStatusLine().getStatusCode();
-            if (status >= 200) {
+            if (status >= HttpStatus.SC_OK) {
                 commitFinalResponse(conn, state);
             } else {
                 conn.submitResponse(response);
@@ -966,7 +966,7 @@ public class HttpAsyncService implements
 
                 // If there is an incoming request associated with the exchange
                 // the response will be sent early (out of sequence).
-                if (response.getStatusLine().getStatusCode() >= 200 && this.incoming
!= null) {
+                if (response.getStatusLine().getStatusCode() >= HttpStatus.SC_OK &&
this.incoming != null) {
                     this.incoming.setEarlyResponse(true);
                 }
 



Mime
View raw message