Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/Cookie.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/Cookie.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/Cookie.java (working copy) @@ -63,6 +63,8 @@ */ public class Cookie extends NameValuePair implements Serializable, Comparator { + //TODO: private static final long serialVersionUID = nnn; + // ----------------------------------------------------------- Constructors /** Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HeaderElement.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HeaderElement.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HeaderElement.java (working copy) @@ -85,6 +85,8 @@ */ public class HeaderElement extends NameValuePair { + //TODO: private static final long serialVersionUID = nnn; + // ----------------------------------------------------------- Constructors /** Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HostConfiguration.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HostConfiguration.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HostConfiguration.java (working copy) @@ -105,7 +105,7 @@ /** * @see java.lang.Object#clone() */ - public Object clone() { + public Object clone() {//TODO class is not final; failure to use super.clone() can break subclasses return new HostConfiguration(this); } @@ -503,7 +503,7 @@ /** * @see java.lang.Object#hashCode() */ - public int hashCode() { + public int hashCode() {//TODO: make this synchronized? Probably worth caching it too int hash = LangUtils.HASH_SEED; hash = LangUtils.hashCode(hash, this.host); hash = LangUtils.hashCode(hash, this.proxyHost); Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpClient.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpClient.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpClient.java (working copy) @@ -389,7 +389,7 @@ } HttpMethodDirector methodDirector = new HttpMethodDirector( - this.httpConnectionManager, + this.httpConnectionManager,//TODO use get() method to ensure synch? hostconfig, this.params, (state == null ? getState() : state)); Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpException.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpException.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpException.java (working copy) @@ -79,7 +79,7 @@ Class[] paramsClasses = new Class[] { Throwable.class }; Method initCause = Throwable.class.getMethod("initCause", paramsClasses); initCause.invoke(this, new Object[] { cause }); - } catch (Exception e) { + } catch (Exception e) {//TODO use less general catch block? // The setCause method must not be available } } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpHost.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpHost.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpHost.java (working copy) @@ -121,7 +121,7 @@ /** * @see java.lang.Object#clone() */ - public Object clone() { + public Object clone() {//TODO class is not final; failure to use super.clone() can break subclasses return new HttpHost(this); } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpState.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpState.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpState.java (working copy) @@ -35,6 +35,8 @@ import java.util.Map; import java.util.List; import java.util.Iterator; +import java.util.Map.Entry; + import org.apache.commons.httpclient.cookie.CookieSpec; import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.auth.AuthScope; @@ -561,14 +563,14 @@ */ private static String getCredentialsStringRepresentation(final Map credMap) { StringBuffer sbResult = new StringBuffer(); - Iterator iter = credMap.keySet().iterator(); + Iterator iter = credMap.entrySet().iterator(); while (iter.hasNext()) { - Object key = iter.next(); - Credentials cred = (Credentials) credMap.get(key); + Map.Entry me = (Entry) iter.next(); + Credentials cred = (Credentials) me.getValue(); if (sbResult.length() > 0) { sbResult.append(", "); } - sbResult.append(key); + sbResult.append(me.getKey()); sbResult.append("#"); sbResult.append(cred.toString()); } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpURL.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpURL.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpURL.java (working copy) @@ -405,6 +405,7 @@ /** * Default scheme for HTTP URL. */ + //TODO make package protected to help safegaurd against alterations? public static final char[] DEFAULT_SCHEME = { 'h', 't', 't', 'p' }; /** Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpsURL.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpsURL.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/HttpsURL.java (working copy) @@ -395,6 +395,7 @@ /** * Default scheme for HTTPS URL. */ + //TODO make package protected to help safegaurd against alterations? public static final char[] DEFAULT_SCHEME = { 'h', 't', 't', 'p', 's' }; /** Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java (working copy) @@ -517,7 +517,7 @@ } finally { if (useTimeout) { endWait = System.currentTimeMillis(); - timeToWait -= (endWait - startWait); + timeToWait -= (endWait - startWait);//TODO not used } } } @@ -966,6 +966,7 @@ freeConnections.add(conn); // we can remove the reference to this connection as we have control over // it again. this also ensures that the connection manager can be GCed + //TODO: check if cast is permissible/or catch Exception removeReferenceToConnection((HttpConnectionWithReference) conn); if (numConnections == 0) { // for some reason this connection pool didn't already exist Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/ProxyClient.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/ProxyClient.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/ProxyClient.java (working copy) @@ -261,6 +261,7 @@ /** * A connection manager that creates a single connection. Meant to be used only once. */ + //TODO make static? class DummyConnectionManager implements HttpConnectionManager { private HttpConnection httpConnection; Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/ProxyHost.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/ProxyHost.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/ProxyHost.java (working copy) @@ -75,7 +75,7 @@ /** * @see java.lang.Object#clone() */ - public Object clone() { + public Object clone() {//TODO class is not final; failure to use super.clone() can break subclasses return new ProxyHost(this); } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/StatusLine.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/StatusLine.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/StatusLine.java (working copy) @@ -129,7 +129,7 @@ throw new HttpException("Status-Line '" + statusLine + "' is not valid"); } //save the original Status-Line - this.statusLine = new String(statusLine); + this.statusLine = statusLine; } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/URI.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/URI.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/URI.java (working copy) @@ -627,11 +627,19 @@ * The default charset of the document. RFC 2277, 2396 * The platform's charset is used for the document by default. */ - protected static String defaultDocumentCharset = null; - protected static String defaultDocumentCharsetByLocale = null; - protected static String defaultDocumentCharsetByPlatform = null; + protected static String defaultDocumentCharset;//TODO - make private/package protected? + protected static final String defaultDocumentCharsetByLocale; + protected static final String defaultDocumentCharsetByPlatform; // Static initializer for defaultDocumentCharset static { + // in order to support platform encoding + String dDCBP; + try { + dDCBP = System.getProperty("file.encoding"); + } catch (SecurityException ignore) { + dDCBP = null; + } + defaultDocumentCharsetByPlatform = dDCBP; Locale locale = Locale.getDefault(); // in order to support backward compatiblity if (locale != null) { @@ -639,15 +647,9 @@ LocaleToCharsetMap.getCharset(locale); // set the default document charset defaultDocumentCharset = defaultDocumentCharsetByLocale; - } - // in order to support platform encoding - try { - defaultDocumentCharsetByPlatform = System.getProperty("file.encoding"); - } catch (SecurityException ignore) { - } - if (defaultDocumentCharset == null) { - // set the default document charset - defaultDocumentCharset = defaultDocumentCharsetByPlatform; + } else { + defaultDocumentCharsetByLocale = null; + defaultDocumentCharset = defaultDocumentCharsetByPlatform; } } @@ -709,7 +711,8 @@ /** * The root path. */ - protected static char[] rootPath = { '/' }; + //TODO make package protected to help safegaurd against alterations? + protected static final char[] rootPath = { '/' }; // ---------------------- Generous characters for each component validation @@ -2214,8 +2217,8 @@ _is_server = _is_hostname = _is_IPv4address = _is_IPv6reference = false; // set a registry-based naming authority - _authority = (escaped) ? original.toString().toCharArray() - : encode(original.toString(), allowed_reg_name, charset); + _authority = (escaped) ? original.toCharArray() + : encode(original, allowed_reg_name, charset); } else { if (original.length() - 1 > next && hasPort && original.charAt(next) == ':') { // not empty @@ -3671,7 +3674,7 @@ * * @return a clone of this instance */ - public synchronized Object clone() { + public synchronized Object clone() {//TODO class is not final; failure to use super.clone() can break subclasses URI instance = new URI(); Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/WireLogInputStream.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/WireLogInputStream.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/WireLogInputStream.java (working copy) @@ -45,7 +45,7 @@ class WireLogInputStream extends FilterInputStream { /** Original input stream. */ - private InputStream in; + private InputStream in; //TODO obscures java.io.FilterInputStream.in /** The wire log to use for writing. */ private Wire wire; Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/WireLogOutputStream.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/WireLogOutputStream.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/WireLogOutputStream.java (working copy) @@ -43,7 +43,7 @@ class WireLogOutputStream extends FilterOutputStream { /** Original input stream. */ - private OutputStream out; + private OutputStream out;//TODO obscures java.io.FilterOutputStream.out /** The wire log to use. */ private Wire wire; Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/auth/AuthScope.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/auth/AuthScope.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/auth/AuthScope.java (working copy) @@ -69,7 +69,7 @@ * In the future versions of HttpClient the use of this parameter will be * discontinued. */ - public static AuthScope ANY = new AuthScope(ANY_HOST, ANY_PORT, ANY_REALM, ANY_SCHEME); + public static final AuthScope ANY = new AuthScope(ANY_HOST, ANY_PORT, ANY_REALM, ANY_SCHEME); /** The authentication scheme the credentials apply to. */ private String scheme = null; Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/auth/DigestScheme.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/auth/DigestScheme.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/auth/DigestScheme.java (working copy) @@ -459,10 +459,10 @@ String uri = getParameter("uri"); String realm = getParameter("realm"); String nonce = getParameter("nonce"); - String nc = getParameter("nc"); + String nc = getParameter("nc");//TODO: NOTUSED, but probably should be String opaque = getParameter("opaque"); String response = digest; - String qop = getParameter("qop"); + String qop = getParameter("qop");//TODO: NOTUSED, but probably should be String algorithm = getParameter("algorithm"); List params = new ArrayList(20); Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/methods/multipart/FilePart.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/methods/multipart/FilePart.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/methods/multipart/FilePart.java (working copy) @@ -71,7 +71,8 @@ protected static final String FILE_NAME = "; filename="; /** Attachment's file name as a byte array */ - protected static final byte[] FILE_NAME_BYTES = + //TODO make package protected to help safegaurd against alterations? + protected static final byte[] FILE_NAME_BYTES = EncodingUtil.getAsciiBytes(FILE_NAME); /** Source of the file part. */ Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/DefaultHttpParams.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/DefaultHttpParams.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/DefaultHttpParams.java (working copy) @@ -49,6 +49,8 @@ */ public class DefaultHttpParams implements HttpParams, Serializable, Cloneable { + //TODO: private static final long serialVersionUID = nnn; + /** Log object for this class. */ private static final Log LOG = LogFactory.getLog(DefaultHttpParams.class); @@ -208,7 +210,7 @@ } public void setBooleanParameter(final String name, boolean value) { - setParameter(name, new Boolean(value)); + setParameter(name, new Boolean(value));//TODO use Boolean.valueOf() in Java 1.4+ } public boolean isParameterSet(final String name) { Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpClientParams.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpClientParams.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpClientParams.java (working copy) @@ -199,7 +199,7 @@ public void makeStrict() { super.makeStrict(); - setParameters(PROTOCOL_STRICTNESS_PARAMETERS, new Boolean(true)); + setParameters(PROTOCOL_STRICTNESS_PARAMETERS, Boolean.TRUE); } @@ -205,6 +205,6 @@ public void makeLenient() { super.makeLenient(); - setParameters(PROTOCOL_STRICTNESS_PARAMETERS, new Boolean(false)); + setParameters(PROTOCOL_STRICTNESS_PARAMETERS, Boolean.FALSE); } } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpConnectionManagerParams.java (working copy) @@ -62,7 +62,7 @@ * {@link org.apache.commons.httpclient.HostConfiguration#ANY_HOST_CONFIGURATION}. *

*/ - public static String MAX_HOST_CONNECTIONS = "http.connection-manager.max-per-host"; + public static final String MAX_HOST_CONNECTIONS = "http.connection-manager.max-per-host"; /** * Defines the maximum number of connections allowed overall. This value only applies @@ -71,7 +71,7 @@ * This parameter expects a value of type {@link Integer}. *

*/ - public static String MAX_TOTAL_CONNECTIONS = "http.connection-manager.max-total"; + public static final String MAX_TOTAL_CONNECTIONS = "http.connection-manager.max-total"; /** * Sets the default maximum number of connections allowed for a given Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpMethodParams.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpMethodParams.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/params/HttpMethodParams.java (working copy) @@ -50,6 +50,8 @@ */ public class HttpMethodParams extends DefaultHttpParams { + //TODO: private static final long serialVersionUID = nnn; + /** Log object for this class. */ private static final Log LOG = LogFactory.getLog(HttpMethodParams.class); @@ -475,7 +477,7 @@ * strictly adhere to the HTTP specification. */ public void makeStrict() { - setParameters(PROTOCOL_STRICTNESS_PARAMETERS, new Boolean(true)); + setParameters(PROTOCOL_STRICTNESS_PARAMETERS, Boolean.TRUE); setIntParameter(STATUS_LINE_GARBAGE_LIMIT, 0); } @@ -486,7 +488,7 @@ * the HTTP protocol specification (RFC 2616 and other relevant RFCs). */ public void makeLenient() { - setParameters(PROTOCOL_STRICTNESS_PARAMETERS, new Boolean(false)); + setParameters(PROTOCOL_STRICTNESS_PARAMETERS, Boolean.FALSE); setIntParameter(STATUS_LINE_GARBAGE_LIMIT, Integer.MAX_VALUE); } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/protocol/ReflectionSocketFactory.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/protocol/ReflectionSocketFactory.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/protocol/ReflectionSocketFactory.java (working copy) @@ -160,7 +160,7 @@ } return null; } - catch (Exception e) { + catch (Exception e) {//TODO use less general catch block? REFLECTION_FAILED = true; return null; } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/HttpURLConnection.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/HttpURLConnection.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/HttpURLConnection.java (working copy) @@ -82,7 +82,7 @@ /** * The URL to which we are connected */ - private URL url; + private URL url; //TODO this obscures java.net.URLConnection.url Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.java (working copy) @@ -45,7 +45,7 @@ private List connectionManagers = new ArrayList(); - private boolean shutdown = false; + private boolean shutdown = false; //TODO: make volatile/synch access private long timeoutInterval = 1000; @@ -117,7 +117,7 @@ * * @see HttpConnectionManager#closeIdleConnections(long) */ - public void setConnectionTimeout(long connectionTimeout) { + public void setConnectionTimeout(long connectionTimeout) {//TODO: synch to protect Timeout? if (shutdown) { throw new IllegalStateException("IdleConnectionTimeoutThread has been shutdown"); } @@ -129,7 +129,7 @@ * * @param timeoutInterval The timeout interval in milliseconds */ - public void setTimeoutInterval(long timeoutInterval) { + public void setTimeoutInterval(long timeoutInterval) {//TODO may need to synch this if (shutdown) { throw new IllegalStateException("IdleConnectionTimeoutThread has been shutdown"); } Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/LangUtils.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/LangUtils.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/LangUtils.java (working copy) @@ -39,8 +39,8 @@ */ public class LangUtils { - public static int HASH_SEED = 17; - public static int HASH_OFFSET = 37; + public static final int HASH_SEED = 17; + public static final int HASH_OFFSET = 37; private LangUtils() { super(); Index: HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/URIUtil.java =================================================================== --- HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/URIUtil.java (revision 348515) +++ HttpClient_3_0_RC4/src/java/org/apache/commons/httpclient/util/URIUtil.java (working copy) @@ -621,10 +621,10 @@ * @return the replaced string */ public static String replace(String original, char[] from, char[] to) { - for (int i = from.length; i > 0; --i) { + for (int i = from.length; i > 0; --i) {//TODO - recode to use StringBuffer original = replace(original, from[i], to[i]); } - return original.toString(); + return original; }