Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 63420 invoked from network); 4 Apr 2003 02:37:09 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 4 Apr 2003 02:37:09 -0000 Received: (qmail 8441 invoked by uid 97); 4 Apr 2003 02:39:06 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 8434 invoked from network); 4 Apr 2003 02:39:05 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 4 Apr 2003 02:39:05 -0000 Received: (qmail 63199 invoked by uid 500); 4 Apr 2003 02:37:05 -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 63187 invoked by uid 500); 4 Apr 2003 02:37:05 -0000 Received: (qmail 63182 invoked from network); 4 Apr 2003 02:37:04 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 4 Apr 2003 02:37:04 -0000 Received: (qmail 17052 invoked by uid 1633); 4 Apr 2003 02:37:03 -0000 Date: 4 Apr 2003 02:37:03 -0000 Message-ID: <20030404023703.17051.qmail@icarus.apache.org> From: mbecke@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart Part.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 mbecke 2003/04/03 18:37:03 Modified: httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java WireLogInputStream.java HeaderGroup.java WireLogOutputStream.java HttpConstants.java HttpURL.java ConnectMethod.java RequestOutputStream.java HttpConnection.java HttpParser.java Authenticator.java Wire.java httpclient/src/java/org/apache/commons/httpclient/methods ExpectContinueMethod.java PostMethod.java MultipartPostMethod.java httpclient/src/java/org/apache/commons/httpclient/auth AuthChallengeParser.java NTLMScheme.java BasicScheme.java DigestScheme.java HttpAuthenticator.java AuthScheme.java RFC2617Scheme.java AuthSchemeBase.java httpclient/src/java/org/apache/commons/httpclient/methods/multipart Part.java Log: Code cleanup. Fixed some checkstyle problems, added a few minor comments and removed some unused private variables. Revision Changes Path 1.129 +26 -20 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.128 retrieving revision 1.129 diff -u -r1.128 -r1.129 --- HttpMethodBase.java 1 Apr 2003 19:04:18 -0000 1.128 +++ HttpMethodBase.java 4 Apr 2003 02:37:02 -0000 1.129 @@ -227,7 +227,7 @@ private boolean doneWithConnection = false; /** Number of milliseconds to wait for 100-contunue response */ - private static int RESPONSE_WAIT_TIME_MS = 3000; + private static final int RESPONSE_WAIT_TIME_MS = 3000; // ----------------------------------------------------------- Constructors @@ -688,8 +688,7 @@ } else { lengthValue = header.getValue(); } - } - catch(HttpException e) { + } catch (HttpException e) { if (LOG.isWarnEnabled()) { LOG.warn("Invalid content-length value: " + e.getMessage()); } @@ -698,7 +697,7 @@ if (lengthValue != null) { try { return Integer.parseInt(lengthValue); - } catch(NumberFormatException e) { + } catch (NumberFormatException e) { if (LOG.isWarnEnabled()) { LOG.warn("Invalid content-length value: " + e.getMessage()); } @@ -1000,7 +999,7 @@ LOG.debug("Default basic proxy credentials applied"); } } - } catch(AuthenticationException e) { + } catch (AuthenticationException e) { // Log error and move on LOG.error(e.getMessage(), e); } @@ -1604,7 +1603,9 @@ buf.append(protocol.getScheme().toLowerCase()); buf.append("://"); buf.append(connection.getHost()); - if ((connection.getPort() != -1) && (connection.getPort() != protocol.getDefaultPort())) { + if ((connection.getPort() != -1) + && (connection.getPort() != protocol.getDefaultPort()) + ) { buf.append(":"); buf.append(connection.getPort()); } @@ -1723,11 +1724,10 @@ LOG.debug("Cookie accepted: \"" + parser.formatCookie(cookie) + "\""); } - } catch(MalformedCookieException e) { + } catch (MalformedCookieException e) { if (LOG.isWarnEnabled()) { - LOG.warn("Cookie rejected: \"" - + parser.formatCookie(cookie) + - "\". " + e.getMessage()); + LOG.warn("Cookie rejected: \"" + parser.formatCookie(cookie) + + "\". " + e.getMessage()); } } } @@ -1906,8 +1906,9 @@ } else { int expectedLength = getResponseContentLength(); if (expectedLength == -1) { - if (canResponseHaveBody(statusLine.getStatusCode()) && - !getName().equalsIgnoreCase("connect")) { + if (canResponseHaveBody(statusLine.getStatusCode()) + && !getName().equalsIgnoreCase("connect") + ) { result = is; } } else { @@ -2108,7 +2109,7 @@ } else { return; } - } catch(InterruptedIOException e) { + } catch (InterruptedIOException e) { // Most probably Expect header is not recongnized // Remove the header to signal the method // that it's okay to go ahead with sending data @@ -2120,7 +2121,8 @@ } else { removeRequestHeader("Expect"); - LOG.info("'Expect: 100-continue' handshake is only supported by HTTP/1.1 or higher"); + LOG.info("'Expect: 100-continue' handshake is only supported by " + + "HTTP/1.1 or higher"); } } @@ -2300,7 +2302,7 @@ AuthScheme authscheme = null; try { authscheme = HttpAuthenticator.selectAuthScheme(challenges); - } catch(MalformedChallengeException e) { + } catch (MalformedChallengeException e) { if (LOG.isErrorEnabled()) { LOG.error(e.getMessage(), e); } @@ -2343,7 +2345,11 @@ break; case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED: removeRequestHeader(HttpAuthenticator.PROXY_AUTH_RESP); - authenticated = HttpAuthenticator.authenticateProxy(authscheme, this, state); + authenticated = HttpAuthenticator.authenticateProxy( + authscheme, + this, + state + ); break; } } catch (AuthenticationException e) { 1.10 +5 -13 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/WireLogInputStream.java Index: WireLogInputStream.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/WireLogInputStream.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- WireLogInputStream.java 28 Feb 2003 12:48:58 -0000 1.9 +++ WireLogInputStream.java 4 Apr 2003 02:37:02 -0000 1.10 @@ -66,13 +66,11 @@ import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * Logs all data read to the wire LOG. * - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author Mike Bowler * @author Oleg Kalnichevski * @@ -80,13 +78,7 @@ */ class WireLogInputStream extends FilterInputStream { - - /** Log for any wire messages. */ - private static final Log WIRE_LOG = LogFactory.getLog("httpclient.wire"); - - /** Content encoding. */ - private String charset = "US-ASCII"; - + /** Original input stream. */ private InputStream in; 1.2 +1 -0 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HeaderGroup.java Index: HeaderGroup.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HeaderGroup.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HeaderGroup.java 11 Feb 2003 05:04:10 -0000 1.1 +++ HeaderGroup.java 4 Apr 2003 02:37:02 -0000 1.2 @@ -15,6 +15,7 @@ */ public class HeaderGroup { + /** The list of headers for this group, in the order in which they were added */ private List headers; /** 1.3 +0 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/WireLogOutputStream.java Index: WireLogOutputStream.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/WireLogOutputStream.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- WireLogOutputStream.java 1 Apr 2003 19:04:19 -0000 1.2 +++ WireLogOutputStream.java 4 Apr 2003 02:37:02 -0000 1.3 @@ -62,8 +62,6 @@ import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * Logs all data written to the wire LOG. @@ -74,9 +72,6 @@ */ class WireLogOutputStream extends FilterOutputStream { - - /** Log for any wire messages. */ - private static final Log WIRE_LOG = LogFactory.getLog("httpclient.wire"); /** Original input stream. */ private OutputStream out; 1.8 +9 -4 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- HttpConstants.java 12 Feb 2003 12:54:24 -0000 1.7 +++ HttpConstants.java 4 Apr 2003 02:37:02 -0000 1.8 @@ -212,7 +212,12 @@ * @param charset the desired character encoding * @return The result of the conversion. */ - public static String getContentString(final byte[] data, int offset, int length, String charset) { + public static String getContentString( + final byte[] data, + int offset, + int length, + String charset + ) { if (data == null) { throw new IllegalArgumentException("Parameter may not be null"); 1.12 +6 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpURL.java Index: HttpURL.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpURL.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- HttpURL.java 17 Feb 2003 04:15:33 -0000 1.11 +++ HttpURL.java 4 Apr 2003 02:37:02 -0000 1.12 @@ -532,8 +532,9 @@ // set the charset to do escape encoding String charset = getProtocolCharset(); setRawUserinfo(encode(user, within_userinfo, charset), - (password == null) ? null : - encode(password, within_userinfo, charset)); + (password == null) + ? null + : encode(password, within_userinfo, charset)); } 1.11 +7 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java Index: ConnectMethod.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ConnectMethod.java 27 Mar 2003 20:58:27 -0000 1.10 +++ ConnectMethod.java 4 Apr 2003 02:37:02 -0000 1.11 @@ -72,7 +72,7 @@ /** *

Wraps another method to tunnel through a proxy.

* - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author dIon Gillard * @author Mike Bowler * @since 2.0 @@ -194,6 +194,8 @@ * * @see HttpMethodBase#shouldCloseConnection() * @see HttpStatus#SC_OK + * + * @return true if the connection should be closed */ protected boolean shouldCloseConnection() { return (getStatusCode() != HttpStatus.SC_OK); 1.21 +4 -7 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.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- RequestOutputStream.java 12 Feb 2003 13:21:27 -0000 1.20 +++ RequestOutputStream.java 4 Apr 2003 02:37:02 -0000 1.21 @@ -133,9 +133,6 @@ /** True if chunking is allowed */ private boolean useChunking = false; - /** True if printing a chunk */ - private boolean writingChunk = false; - /** "\r\n", as bytes. */ private static final byte CRLF[] = new byte[] {(byte) 13, (byte) 10}; 1.53 +7 -8 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.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- HttpConnection.java 1 Apr 2003 02:13:09 -0000 1.52 +++ HttpConnection.java 4 Apr 2003 02:37:02 -0000 1.53 @@ -469,8 +469,7 @@ * * @return the timeout value */ - public int getSoTimeout() - throws SocketException, IllegalStateException { + public int getSoTimeout() throws SocketException { LOG.debug("HttpConnection.getSoTimeout()"); if (this.socket != null) { return this.socket.getSoTimeout(); @@ -553,7 +552,7 @@ throw e; } catch (TimeoutController.TimeoutException e) { if (LOG.isWarnEnabled()) { - LOG.warn( "The host " + hostName + ":" + portNumber + LOG.warn("The host " + hostName + ":" + portNumber + " (or proxy " + proxyHostName + ":" + proxyPortNumber + ") did not accept the connection within timeout of " + connectTimeout + " milliseconds"); @@ -732,7 +731,7 @@ LOG.trace("enter HttpConnection.write(byte[], int, int)"); if (offset + length > data.length) { - throw new HttpRecoverableException( "Unable to write:" + throw new HttpRecoverableException("Unable to write:" + " offset=" + offset + " length=" + length + " data.length=" + data.length); } else if (data.length <= 0) { 1.6 +1 -1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpParser.java Index: HttpParser.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpParser.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- HttpParser.java 24 Mar 2003 19:18:04 -0000 1.5 +++ HttpParser.java 4 Apr 2003 02:37:02 -0000 1.6 @@ -24,7 +24,7 @@ /** * Constructor for HttpParser. */ - private HttpParser() {} + private HttpParser() { } /** * Return byte array from an (unchunked) input stream. 1.42 +9 -9 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Authenticator.java Index: Authenticator.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Authenticator.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Authenticator.java 28 Mar 2003 16:37:49 -0000 1.41 +++ Authenticator.java 4 Apr 2003 02:37:02 -0000 1.42 @@ -91,7 +91,7 @@ * @author Remy Maucherat * @author Rodney Waldhoff * @author Jeff Dever - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author Sean C. Sullivan * @author Adrian Sutton * @author Mike Bowler @@ -186,11 +186,11 @@ * null, the default authentication credentials will be sent. * * @param method the http method to add the authentication header to - * @param authenticateHeader the array of headers the web server created to challenge - * the credentials * @param state the http state object providing {@link Credentials} - * @param responseHeader the response header to add (e.g. proxy or standard) + * @param proxy a flag indicating if the authentication is against a proxy + * * @return true if a response header was added + * * @throws HttpException when an error occurs parsing the challenge * @throws UnsupportedOperationException when the given challenge type is * not supported @@ -212,13 +212,13 @@ // does not provide this kind of functionality Header[] headers = method.getResponseHeaders(); ArrayList headerlist = new ArrayList(); - for (int i = 0; i < headers.length; i++ ) { + for (int i = 0; i < headers.length; i++) { Header header = headers[i]; if (header.getName().equalsIgnoreCase(challengeheader)) { headerlist.add(header); } } - headers = (Header [])headerlist.toArray(new Header[headerlist.size()]); + headers = (Header[]) headerlist.toArray(new Header[headerlist.size()]); headerlist = null; //if there is no challenge, attempt to use preemptive authorization 1.3 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Wire.java Index: Wire.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Wire.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Wire.java 1 Apr 2003 19:04:19 -0000 1.2 +++ Wire.java 4 Apr 2003 02:37:02 -0000 1.3 @@ -94,7 +94,7 @@ while ((ch = reader.read()) != -1) { if (ch == 13) { buffer.append("[\\r]"); - } else if (ch == 10){ + } else if (ch == 10) { buffer.append("[\\n]\""); buffer.insert(0, "\""); buffer.insert(0, header); @@ -105,7 +105,7 @@ buffer.append(Integer.toHexString(ch)); buffer.append("]"); } else { - buffer.append((char)ch); + buffer.append((char) ch); } } if (buffer.length() > 0) { @@ -171,12 +171,12 @@ public static final void output(int b) throws IOException { - output(new byte[] {(byte)b}); + output(new byte[] {(byte) b}); } public static final void input(int b) throws IOException { - input(new byte[] {(byte)b}); + input(new byte[] {(byte) b}); } public static final void output(final String s) 1.4 +2 -2 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/ExpectContinueMethod.java Index: ExpectContinueMethod.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/ExpectContinueMethod.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ExpectContinueMethod.java 1 Apr 2003 19:04:19 -0000 1.3 +++ ExpectContinueMethod.java 4 Apr 2003 02:37:03 -0000 1.4 @@ -83,8 +83,8 @@ * @since 2.0beta1 */ -public abstract class ExpectContinueMethod extends GetMethod -{ +public abstract class ExpectContinueMethod extends GetMethod { + /** This flag specifies whether "expect: 100-continue" handshake is * to be used prior to sending the request body */ private boolean useExpectHeader = false; 1.40 +7 -6 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/PostMethod.java Index: PostMethod.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/PostMethod.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- PostMethod.java 25 Feb 2003 23:33:46 -0000 1.39 +++ PostMethod.java 4 Apr 2003 02:37:03 -0000 1.40 @@ -100,7 +100,7 @@ * @author Remy Maucherat * @author Doug Sale * @author Jeff Dever - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author Mike Bowler * @author Oleg Kalnichevski * @@ -129,7 +129,7 @@ /** * The buffered request body consisting of NameValuePairs. * @deprecated Parameters will not be buffered in the future but converted - * into an InputStream immeadiately. + * into an InputStream immediately. */ private Vector deprecated_parameters = new Vector(); @@ -428,6 +428,7 @@ * Encode the list of parameters into a query string. * * @param parameters the list of query name and value + * @param charset the charset to use for encoding the parameters * * @return url encoded form of the parameters * 1.16 +13 -9 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/MultipartPostMethod.java Index: MultipartPostMethod.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/MultipartPostMethod.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- MultipartPostMethod.java 1 Apr 2003 19:04:19 -0000 1.15 +++ MultipartPostMethod.java 4 Apr 2003 02:37:03 -0000 1.16 @@ -179,7 +179,8 @@ */ public void addParameter(String parameterName, File parameterFile) throws FileNotFoundException { - LOG.trace("enter MultipartPostMethod.addParameter(String parameterName, File parameterFile)"); + LOG.trace("enter MultipartPostMethod.addParameter(String parameterName, " + + "File parameterFile)"); Part param = new FilePart(parameterName, parameterFile); parameters.add(param); } @@ -194,7 +195,8 @@ */ public void addParameter(String parameterName, String fileName, File parameterFile) throws FileNotFoundException { - LOG.trace("enter MultipartPostMethod.addParameter(String parameterName, String fileName, File parameterFile)"); + LOG.trace("enter MultipartPostMethod.addParameter(String parameterName, " + + "String fileName, File parameterFile)"); Part param = new FilePart(parameterName, fileName, parameterFile); parameters.add(param); } @@ -214,7 +216,7 @@ * @return an array of containing all parts */ public Part[] getParts() { - return (Part[])parameters.toArray(new Part[parameters.size()]); + return (Part[]) parameters.toArray(new Part[parameters.size()]); } /** * Add content type header and set the Expect header @@ -230,7 +232,8 @@ */ protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException { - LOG.trace("enter MultipartPostMethod.addRequestHeaders(HttpState state, HttpConnection conn)"); + LOG.trace("enter MultipartPostMethod.addRequestHeaders(HttpState state, " + + "HttpConnection conn)"); super.addRequestHeaders(state, conn); if (!parameters.isEmpty()) { @@ -255,7 +258,8 @@ */ protected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException, HttpException { - LOG.trace("enter MultipartPostMethod.writeRequestBody(HttpState state, HttpConnection conn)"); + LOG.trace("enter MultipartPostMethod.writeRequestBody(HttpState state, " + + "HttpConnection conn)"); OutputStream out = conn.getRequestOutputStream(); Part.sendParts(out, getParts()); return true; @@ -275,7 +279,7 @@ long len = Part.getLengthOfParts(getParts()); // Chop the length to the max int value. if (len <= Integer.MAX_VALUE) { - return (int)len; + return (int) len; } else { return (Integer.MAX_VALUE); } 1.3 +3 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthChallengeParser.java Index: AuthChallengeParser.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthChallengeParser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AuthChallengeParser.java 1 Apr 2003 19:04:19 -0000 1.2 +++ AuthChallengeParser.java 4 Apr 2003 02:37:03 -0000 1.3 @@ -70,8 +70,7 @@ * * @since 2.0beta1 */ -public final class AuthChallengeParser -{ +public final class AuthChallengeParser { /** * Extracts authentication scheme from the given authentication * challenge. @@ -97,7 +96,7 @@ s = challengeStr.substring(0, i); } if (s.equals("")) { - throw new MalformedChallengeException( "Invalid challenge: " + challengeStr); + throw new MalformedChallengeException("Invalid challenge: " + challengeStr); } return s.toLowerCase(); } @@ -120,7 +119,7 @@ } int i = challengeStr.indexOf(' '); if (i == -1) { - throw new MalformedChallengeException( "Invalid challenge: " + challengeStr ); + throw new MalformedChallengeException("Invalid challenge: " + challengeStr); } Map elements = new HashMap(); 1.2 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLMScheme.java Index: NTLMScheme.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/NTLMScheme.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- NTLMScheme.java 27 Mar 2003 20:58:27 -0000 1.1 +++ NTLMScheme.java 4 Apr 2003 02:37:03 -0000 1.2 @@ -74,7 +74,7 @@ * @author Remy Maucherat * @author Rodney Waldhoff * @author Jeff Dever - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author Sean C. Sullivan * @author Adrian Sutton * @author Mike Bowler @@ -171,7 +171,7 @@ s = ntlm.getResponseFor(challenge, credentials.getUserName(), credentials.getPassword(), credentials.getHost(), credentials.getDomain()); - } catch(HttpException e) { + } catch (HttpException e) { throw new AuthenticationException(e.getMessage()); } return "NTLM " + s; @@ -195,8 +195,8 @@ NTCredentials ntcredentials = null; try { - ntcredentials = (NTCredentials)credentials; - } catch(ClassCastException e ) { + ntcredentials = (NTCredentials) credentials; + } catch (ClassCastException e) { throw new AuthenticationException( "Credentials cannot be used for basic authentication: " + credentials.toString()); 1.2 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/BasicScheme.java Index: BasicScheme.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/BasicScheme.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BasicScheme.java 27 Mar 2003 20:58:27 -0000 1.1 +++ BasicScheme.java 4 Apr 2003 02:37:03 -0000 1.2 @@ -74,15 +74,15 @@ * @author Remy Maucherat * @author Rodney Waldhoff * @author Jeff Dever - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author Sean C. Sullivan * @author Adrian Sutton * @author Mike Bowler * @author Oleg Kalnichevski */ -public class BasicScheme extends RFC2617Scheme -{ +public class BasicScheme extends RFC2617Scheme { + /** Log object for this class. */ private static final Log LOG = LogFactory.getLog(BasicScheme.class); @@ -127,8 +127,8 @@ UsernamePasswordCredentials usernamepassword = null; try { - usernamepassword = (UsernamePasswordCredentials)credentials; - } catch(ClassCastException e) { + usernamepassword = (UsernamePasswordCredentials) credentials; + } catch (ClassCastException e) { throw new AuthenticationException( "Credentials cannot be used for basic authentication: " + credentials.toString()); 1.2 +5 -5 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/DigestScheme.java Index: DigestScheme.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/DigestScheme.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DigestScheme.java 27 Mar 2003 20:58:27 -0000 1.1 +++ DigestScheme.java 4 Apr 2003 02:37:03 -0000 1.2 @@ -76,15 +76,15 @@ * @author Remy Maucherat * @author Rodney Waldhoff * @author Jeff Dever - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author Sean C. Sullivan * @author Adrian Sutton * @author Mike Bowler * @author Oleg Kalnichevski */ -public class DigestScheme extends RFC2617Scheme -{ +public class DigestScheme extends RFC2617Scheme { + /** Log object for this class. */ private static final Log LOG = LogFactory.getLog(DigestScheme.class); @@ -146,8 +146,8 @@ UsernamePasswordCredentials usernamepassword = null; try { - usernamepassword = (UsernamePasswordCredentials)credentials; - } catch(ClassCastException e ) { + usernamepassword = (UsernamePasswordCredentials) credentials; + } catch (ClassCastException e) { throw new AuthenticationException( "Credentials cannot be used for basic authentication: " + credentials.toString()); 1.2 +22 -16 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/HttpAuthenticator.java Index: HttpAuthenticator.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/HttpAuthenticator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HttpAuthenticator.java 27 Mar 2003 20:58:27 -0000 1.1 +++ HttpAuthenticator.java 4 Apr 2003 02:37:03 -0000 1.2 @@ -89,7 +89,7 @@ * @author Remy Maucherat * @author Rodney Waldhoff * @author Jeff Dever - * @author Ortwin Gl�ck + * @author Ortwin Gl�ck * @author Sean C. Sullivan * @author Adrian Sutton * @author Mike Bowler @@ -157,15 +157,15 @@ String s = AuthChallengeParser.extractScheme(challenge); challengemap.put(s, challenge); } - challenge = (String)challengemap.get("ntlm"); + challenge = (String) challengemap.get("ntlm"); if (challenge != null) { return new NTLMScheme(challenge); } - challenge = (String)challengemap.get("digest"); + challenge = (String) challengemap.get("digest"); if (challenge != null) { return new DigestScheme(challenge); } - challenge = (String)challengemap.get("basic"); + challenge = (String) challengemap.get("basic"); if (challenge != null) { return new BasicScheme(challenge); } @@ -182,8 +182,8 @@ if (state == null) { throw new IllegalArgumentException("HTTP state may not be null"); } - Credentials credentials = proxy ? - state.getProxyCredentials(null) : state.getCredentials(null); + Credentials credentials = proxy + ? state.getProxyCredentials(null) : state.getCredentials(null); if (credentials == null) { return false; } @@ -192,7 +192,7 @@ "Credentials cannot be used for basic authentication: " + credentials.toString()); } - String auth = BasicScheme.authenticate((UsernamePasswordCredentials)credentials); + String auth = BasicScheme.authenticate((UsernamePasswordCredentials) credentials); if (auth != null) { String s = proxy ? PROXY_AUTH_RESP : WWW_AUTH_RESP; method.addRequestHeader(s, auth); @@ -247,9 +247,12 @@ } - private static boolean doAuthenticate(AuthScheme authscheme, HttpMethod method, HttpState state, - boolean proxy) - throws AuthenticationException { + private static boolean doAuthenticate( + AuthScheme authscheme, + HttpMethod method, + HttpState state, + boolean proxy + ) throws AuthenticationException { if (authscheme == null) { throw new IllegalArgumentException("Authentication scheme may not be null"); } @@ -273,12 +276,12 @@ LOG.debug("Using '" + realm + "' authentication realm"); } } - Credentials credentials = proxy ? - state.getProxyCredentials(realm) : state.getCredentials(realm); + Credentials credentials = proxy + ? state.getProxyCredentials(realm) : state.getCredentials(realm); if (credentials == null) { throw new AuthenticationException( - "No credentials available for the " + authscheme.getSchemeName() + - "authentication realm '" + realm + "'"); + "No credentials available for the " + authscheme.getSchemeName() + + "authentication realm '" + realm + "'"); } String auth = authscheme.authenticate(credentials, method.getName(), method.getPath()); if (auth != null) { @@ -329,8 +332,11 @@ * @see HttpState#setCredentials(String,Credentials) */ - public static boolean authenticateProxy(AuthScheme authscheme, HttpMethod method, HttpState state) - throws AuthenticationException { + public static boolean authenticateProxy( + AuthScheme authscheme, + HttpMethod method, + HttpState state + ) throws AuthenticationException { LOG.trace("enter HttpAuthenticator.authenticateProxy(AuthScheme, HttpMethod, HttpState)"); return doAuthenticate(authscheme, method, state, true); } 1.2 +4 -4 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthScheme.java Index: AuthScheme.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthScheme.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AuthScheme.java 27 Mar 2003 20:58:27 -0000 1.1 +++ AuthScheme.java 4 Apr 2003 02:37:03 -0000 1.2 @@ -94,7 +94,7 @@ * * @return the name of the given authentication scheme */ - public String getSchemeName(); + String getSchemeName(); /** * Returns authentication parameter with the given name, if available. @@ -103,7 +103,7 @@ * * @return the parameter with the given name */ - public String getParameter(final String name); + String getParameter(final String name); /** * Returns authentication realm. If the concept of an authentication @@ -112,7 +112,7 @@ * * @return the authentication realm */ - public String getRealm(); + String getRealm(); /** * Produces an authorization string for the given set of {@link Credentials}, @@ -133,7 +133,7 @@ * @see org.apache.commons.httpclient.HttpMethod#getName() * @see org.apache.commons.httpclient.HttpMethod#getPath() */ - public String authenticate(Credentials credentials, String method, String uri) + String authenticate(Credentials credentials, String method, String uri) throws AuthenticationException; } 1.2 +2 -2 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/RFC2617Scheme.java Index: RFC2617Scheme.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/RFC2617Scheme.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RFC2617Scheme.java 27 Mar 2003 20:58:27 -0000 1.1 +++ RFC2617Scheme.java 4 Apr 2003 02:37:03 -0000 1.2 @@ -88,7 +88,7 @@ String s = AuthChallengeParser.extractScheme(challenge); if (!s.equalsIgnoreCase(getSchemeName())) { throw new MalformedChallengeException( - "Invalid " + getSchemeName() +" challenge: " + challenge); + "Invalid " + getSchemeName() + " challenge: " + challenge); } this.params = AuthChallengeParser.extractParams(challenge); } @@ -113,7 +113,7 @@ if (name == null) { throw new IllegalArgumentException("Parameter name may not be null"); } - return (String)this.params.get(name.toLowerCase()); + return (String) this.params.get(name.toLowerCase()); } /** 1.2 +1 -1 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthSchemeBase.java Index: AuthSchemeBase.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/auth/AuthSchemeBase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AuthSchemeBase.java 27 Mar 2003 20:58:27 -0000 1.1 +++ AuthSchemeBase.java 4 Apr 2003 02:37:03 -0000 1.2 @@ -94,7 +94,7 @@ */ public boolean equals(Object obj) { if (obj instanceof AuthSchemeBase) { - return this.challenge.equals(((AuthSchemeBase)obj).challenge); + return this.challenge.equals(((AuthSchemeBase) obj).challenge); } else { return super.equals(obj); } 1.10 +5 -3 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/Part.java Index: Part.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/Part.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Part.java 25 Feb 2003 23:33:48 -0000 1.9 +++ Part.java 4 Apr 2003 02:37:03 -0000 1.10 @@ -354,6 +354,8 @@ * * @param parts The array of parts * + * @return the total length + * * @throws IOException If an IO problem occurs. */ public static long getLengthOfParts(final Part[] parts) --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org