Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 26654 invoked from network); 8 Feb 2003 19:22:52 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 8 Feb 2003 19:22:52 -0000 Received: (qmail 6900 invoked by uid 97); 8 Feb 2003 19:24:26 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 6892 invoked from network); 8 Feb 2003 19:24:25 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 8 Feb 2003 19:24:25 -0000 Received: (qmail 26461 invoked by uid 500); 8 Feb 2003 19:22:50 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 26450 invoked by uid 500); 8 Feb 2003 19:22:50 -0000 Received: (qmail 26447 invoked from network); 8 Feb 2003 19:22:50 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 8 Feb 2003 19:22:50 -0000 Received: (qmail 98723 invoked by uid 1536); 8 Feb 2003 19:22:50 -0000 Date: 8 Feb 2003 19:22:50 -0000 Message-ID: <20030208192250.98721.qmail@icarus.apache.org> From: jsdever@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods EntityEnclosingMethod.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jsdever 2003/02/08 11:22:50 Modified: httpclient/src/java/org/apache/commons/httpclient ChunkedOutputStream.java HttpConnection.java HttpConstants.java HttpMethodBase.java RequestOutputStream.java httpclient/src/java/org/apache/commons/httpclient/methods EntityEnclosingMethod.java Log: Formatting and style fixes. Revision Changes Path 1.8 +28 -28 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ChunkedOutputStream.java Index: ChunkedOutputStream.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ChunkedOutputStream.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ChunkedOutputStream.java 28 Jan 2003 04:40:20 -0000 1.7 +++ ChunkedOutputStream.java 8 Feb 2003 19:22:49 -0000 1.8 @@ -86,22 +86,19 @@ */ public class ChunkedOutputStream extends OutputStream { - // ----------------------------------------------------------- Constructors + // ------------------------------------------------------- Static Variables - /** - * Construct an output stream wrapping the given stream. - * The stream will not use chunking. - * - * @param stream wrapped output stream. Must be non-null. - */ - public ChunkedOutputStream(OutputStream stream) { - if (stream == null) { - throw new NullPointerException("stream parameter is null"); - } - this.stream = stream; - } + /** "\r\n", as bytes. */ + private static final byte CRLF[] = new byte[] {(byte) 13, (byte) 10}; - // ------------------------------------------------------- Static Variables + /** End chunk */ + private static final byte ENDCHUNK[] = CRLF; + + /** 0 */ + private static final byte ZERO[] = new byte[] {(byte) '0'}; + + /** 1 */ + private static final byte ONE[] = new byte[] {(byte) '1'}; /** Log object for this class. */ private static final Log LOG = LogFactory.getLog(ChunkedOutputStream.class); @@ -120,17 +117,20 @@ /** True if printing a chunk */ private boolean writingChunk = false; - /** End chunk */ - private static final byte ENDCHUNK[] = new byte[] {(byte) 13, (byte) 10}; - - /** CRLF */ - private static final byte CRLF[] = new byte[] {(byte) 13, (byte) 10}; - - /** 0 */ - private static final byte ZERO[] = new byte[] {(byte) '0'}; + // ----------------------------------------------------------- Constructors - /** 1 */ - private static final byte ONE[] = new byte[] {(byte) '1'}; + /** + * Construct an output stream wrapping the given stream. + * The stream will not use chunking. + * + * @param stream wrapped output stream. Must be non-null. + */ + public ChunkedOutputStream(OutputStream stream) { + if (stream == null) { + throw new NullPointerException("stream parameter is null"); + } + this.stream = stream; + } // --------------------------------------------------------- Public Methods 1.42 +32 -56 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java Index: HttpConnection.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- HttpConnection.java 8 Feb 2003 01:12:15 -0000 1.41 +++ HttpConnection.java 8 Feb 2003 19:22:49 -0000 1.42 @@ -108,6 +108,7 @@ * @version $Revision$ $Date$ */ public class HttpConnection { + // ----------------------------------------------------------- Constructors /** @@ -183,11 +184,7 @@ String host, int port, boolean secure) { - this( - proxyHost, - proxyPort, - host, - port, + this(proxyHost, proxyPort, host, port, Protocol.getProtocol(secure ? "https" : "http")); } @@ -197,12 +194,11 @@ * @param hostConfiguration the host/proxy/protocol to use */ public HttpConnection(HostConfiguration hostConfiguration) { - this( - hostConfiguration.getProxyHost(), - hostConfiguration.getProxyPort(), - hostConfiguration.getHost(), - hostConfiguration.getPort(), - hostConfiguration.getProtocol()); + this(hostConfiguration.getProxyHost(), + hostConfiguration.getProxyPort(), + hostConfiguration.getHost(), + hostConfiguration.getPort(), + hostConfiguration.getProtocol()); } /** @@ -222,18 +218,9 @@ Protocol protocol) { if (LOG.isDebugEnabled()) { - LOG.debug( - "HttpConnectionManager.getConnection: creating " - + " connection for " - + host - + ":" - + port - + " via " - + proxyHost - + ":" - + proxyPort - + " using protocol: " - + protocol); + LOG.debug("HttpConnectionManager.getConnection: creating connection for " + + host + ":" + port + " via " + proxyHost + ":" + proxyPort + + " using protocol: " + protocol); } if (host == null) { @@ -374,10 +361,9 @@ */ public void setSecure(boolean secure) throws IllegalStateException { assertNotOpen(); - protocolInUse = - (secure - ? Protocol.getProtocol("https") - : Protocol.getProtocol("http")); + protocolInUse = secure + ? Protocol.getProtocol("https") + : Protocol.getProtocol("http"); } /** @@ -543,19 +529,10 @@ throw e; } catch (TimeoutController.TimeoutException e) { if (LOG.isWarnEnabled()) { - LOG.warn( - "The host " - + hostName - + ":" - + portNumber - + " (or proxy " - + proxyHostName - + ":" - + proxyPortNumber - + ") did not accept the connection " - + "within timeout of " - + connectTimeout - + " milliseconds"); + LOG.warn( "The host " + hostName + ":" + portNumber + + " (or proxy " + proxyHostName + ":" + proxyPortNumber + + ") did not accept the connection within timeout of " + + connectTimeout + " milliseconds"); } throw new ConnectionTimeoutException(); } @@ -740,14 +717,9 @@ LOG.trace("enter HttpConnection.write(byte[], int, int)"); if (offset + length > data.length) { - throw new HttpRecoverableException( - "Unable to write:" - + " offset=" - + offset - + " length=" - + length - + " data.length=" - + data.length); + throw new HttpRecoverableException( "Unable to write:" + + " offset=" + offset + " length=" + length + + " data.length=" + data.length); } else if (data.length <= 0) { throw new HttpRecoverableException( "Unable to write:" + " data.length=" + data.length); @@ -1038,10 +1010,12 @@ } } + /** * Helper class for wrapping socket based tasks. */ private abstract class SocketTask implements Runnable { + /** The socket */ private Socket socket; /** The exception */ @@ -1054,6 +1028,7 @@ protected void setSocket(final Socket newSocket) { socket = newSocket; } + /** * Return the socket. * @return Socket The socket. @@ -1077,7 +1052,10 @@ } } - // ------------------------------------------------------------- Attributes + // ------------------------------------------------------- Static Variable + + /** "\r\n", as bytes. */ + private static final byte[] CRLF = new byte[] {(byte) 13, (byte) 10}; /** Log object for this class. */ private static final Log LOG = LogFactory.getLog(HttpConnection.class); @@ -1085,6 +1063,7 @@ /** Log for any wire messages. */ private static final Log WIRE_LOG = LogFactory.getLog("httpclient.wire"); + // ----------------------------------------------------- Instance Variables /** My host. */ private String hostName = null; @@ -1114,9 +1093,6 @@ /** the protocol being used */ private Protocol protocolInUse; - - /** "\r\n", as bytes. */ - private static final byte[] CRLF = HttpConstants.getBytes("\r\n"); /** SO_TIMEOUT socket value */ private int soTimeout = 0; 1.6 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConstants.java Index: HttpConstants.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConstants.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- HttpConstants.java 3 Feb 2003 21:21:15 -0000 1.5 +++ HttpConstants.java 8 Feb 2003 19:22:49 -0000 1.6 @@ -270,7 +270,7 @@ try { return data.getBytes("US-ASCII"); } catch (UnsupportedEncodingException e) { - throw new RuntimeException("HTTP client requires ASCII support"); + throw new RuntimeException("HttpClient requires ASCII support"); } } @@ -291,7 +291,7 @@ try { return new String(data, "US-ASCII"); } catch (UnsupportedEncodingException e) { - throw new RuntimeException("HTTP client requires ASCII support"); + throw new RuntimeException("HttpClient requires ASCII support"); } } } 1.110 +6 -8 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java Index: HttpMethodBase.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v retrieving revision 1.109 retrieving revision 1.110 diff -u -r1.109 -r1.110 --- HttpMethodBase.java 8 Feb 2003 01:12:15 -0000 1.109 +++ HttpMethodBase.java 8 Feb 2003 19:22:49 -0000 1.110 @@ -2349,8 +2349,7 @@ if (connection.waitForResponse(RESPONSE_WAIT_TIME_MS)) { responseExpected = true; LOG.debug("Response available"); - } - else { + } else { responseExpected = false; // Something is wrong. if (getRequestHeader("Expect") != null) { @@ -2400,8 +2399,7 @@ boolean continueReceived = false; if (statusLine == null) { writeRemaining = true; - } - else { + } else { if (statusLine.getStatusCode() == HttpStatus.SC_CONTINUE) { writeRemaining = true; continueReceived = true; 1.19 +8 -8 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java Index: RequestOutputStream.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/RequestOutputStream.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- RequestOutputStream.java 30 Jan 2003 05:01:54 -0000 1.18 +++ RequestOutputStream.java 8 Feb 2003 19:22:49 -0000 1.19 @@ -135,11 +135,11 @@ /** True if printing a chunk */ private boolean writingChunk = false; - /** End chunk */ - private static final byte ENDCHUNK[] = new byte[] {(byte) 13, (byte) 10}; - - /** CRLF */ + /** "\r\n", as bytes. */ private static final byte CRLF[] = new byte[] {(byte) 13, (byte) 10}; + + /** End chunk */ + private static final byte ENDCHUNK[] = CRLF; /** 0 */ private static final byte ZERO[] = new byte[] {(byte) '0'}; 1.8 +7 -8 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java Index: EntityEnclosingMethod.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- EntityEnclosingMethod.java 6 Feb 2003 16:08:05 -0000 1.7 +++ EntityEnclosingMethod.java 8 Feb 2003 19:22:49 -0000 1.8 @@ -363,13 +363,12 @@ // See if the expect header should be sent // = HTTP/1.1 or higher // = request body present - if (getUseExpectHeader() && isHttp11() && - ((this.requestBodyStream != null) || this.buffer != null)) { + if (getUseExpectHeader() && isHttp11() + && ((this.requestBodyStream != null) || this.buffer != null)) { if (!headerPresent) { setRequestHeader("Expect", "100-continue"); } - } - else { + } else { if (headerPresent) { removeRequestHeader("Expect"); } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org