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 2011/05/07 22:56:42 UTC
svn commit: r1100625 [1/2] - in /httpcomponents/httpcore/trunk:
httpcore-nio/src/main/java/org/apache/http/nio/protocol/
httpcore/src/main/java/org/apache/http/
httpcore/src/main/java/org/apache/http/entity/
httpcore/src/main/java/org/apache/http/impl/...
Author: olegk
Date: Sat May 7 20:56:39 2011
New Revision: 1100625
URL: http://svn.apache.org/viewvc?rev=1100625&view=rev
Log:
Generics with standard collection classes; SocketTimeoutException and Throwable#initCause can be used without reflection; deprected ExceptionUtils
Removed:
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestExceptionUtils.java
Modified:
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NHttpRequestHandlerRegistry.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElementIterator.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderIterator.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpEntity.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpException.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpVersion.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ProtocolVersion.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/TokenIterator.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicNameValuePair.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicRequestLine.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicStatusLine.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/ParserCursor.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/DefaultedHttpParams.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParams.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParamsNames.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/SyncBasicHttpParams.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpContext.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestHandlerRegistry.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestInterceptorList.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpResponseInterceptorList.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpService.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/SyncBasicHttpContext.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderElementIterator.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestHeaderGroup.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/HttpServer.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/TimeoutByteArrayInputStream.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestBasicHttpParams.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestDefaultedHttpParams.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestHandlerRegistry.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpServiceAndExecutor.java
httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestEntityUtils.java
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NHttpRequestHandlerRegistry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NHttpRequestHandlerRegistry.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NHttpRequestHandlerRegistry.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NHttpRequestHandlerRegistry.java Sat May 7 20:56:39 2011
@@ -80,7 +80,7 @@ public class NHttpRequestHandlerRegistry
* Sets handlers from the given map.
* @param map the map containing handlers keyed by their URI patterns.
*/
- public void setHandlers(final Map<String, ? extends NHttpRequestHandler> map) {
+ public void setHandlers(final Map<String, Object> map) {
matcher.setObjects(map);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElementIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElementIterator.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElementIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderElementIterator.java Sat May 7 20:56:39 2011
@@ -34,7 +34,7 @@ import java.util.Iterator;
*
* @since 4.0
*/
-public interface HeaderElementIterator extends Iterator {
+public interface HeaderElementIterator extends Iterator<HeaderElement> {
/**
* Indicates whether there is another header element in this
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderIterator.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HeaderIterator.java Sat May 7 20:56:39 2011
@@ -34,7 +34,7 @@ import java.util.Iterator;
*
* @since 4.0
*/
-public interface HeaderIterator extends Iterator {
+public interface HeaderIterator extends Iterator<Header> {
/**
* Indicates whether there is another header in this iteration.
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpEntity.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpEntity.java Sat May 7 20:56:39 2011
@@ -193,6 +193,7 @@ public interface HttpEntity {
*
* @see #getContent() and #writeTo(OutputStream)
*/
+ @Deprecated
void consumeContent() throws IOException;
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpException.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpException.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpException.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpException.java Sat May 7 20:56:39 2011
@@ -27,8 +27,6 @@
package org.apache.http;
-import org.apache.http.util.ExceptionUtils;
-
/**
* Signals that an HTTP exception has occurred.
*
@@ -63,7 +61,7 @@ public class HttpException extends Excep
*/
public HttpException(final String message, final Throwable cause) {
super(message);
- ExceptionUtils.initCause(this, cause);
+ initCause(cause);
}
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpHost.java Sat May 7 20:56:39 2011
@@ -30,7 +30,6 @@ package org.apache.http;
import java.io.Serializable;
import java.util.Locale;
-import org.apache.http.util.CharArrayBuffer;
import org.apache.http.util.LangUtils;
/**
@@ -150,7 +149,7 @@ public final class HttpHost implements C
* @return the host URI
*/
public String toURI() {
- CharArrayBuffer buffer = new CharArrayBuffer(32);
+ StringBuilder buffer = new StringBuilder();
buffer.append(this.schemeName);
buffer.append("://");
buffer.append(this.hostname);
@@ -170,7 +169,7 @@ public final class HttpHost implements C
public String toHostString() {
if (this.port != -1) {
//the highest port number is 65535, which is length 6 with the addition of the colon
- CharArrayBuffer buffer = new CharArrayBuffer(this.hostname.length() + 6);
+ StringBuilder buffer = new StringBuilder(this.hostname.length() + 6);
buffer.append(this.hostname);
buffer.append(":");
buffer.append(Integer.toString(this.port));
@@ -181,11 +180,13 @@ public final class HttpHost implements C
}
+ @Override
public String toString() {
return toURI();
}
+ @Override
public boolean equals(final Object obj) {
if (this == obj) return true;
if (obj instanceof HttpHost) {
@@ -201,6 +202,7 @@ public final class HttpHost implements C
/**
* @see java.lang.Object#hashCode()
*/
+ @Override
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.lcHostname);
@@ -209,6 +211,7 @@ public final class HttpHost implements C
return hash;
}
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpVersion.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpVersion.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpVersion.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/HttpVersion.java Sat May 7 20:56:39 2011
@@ -81,6 +81,7 @@ public final class HttpVersion extends P
*
* @return an instance of {@link HttpVersion} with the argument version
*/
+ @Override
public ProtocolVersion forVersion(int major, int minor) {
if ((major == this.major) && (minor == this.minor)) {
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ProtocolVersion.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ProtocolVersion.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ProtocolVersion.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/ProtocolVersion.java Sat May 7 20:56:39 2011
@@ -28,7 +28,6 @@
package org.apache.http;
import java.io.Serializable;
-import org.apache.http.util.CharArrayBuffer;
/**
* Represents a protocol version. The "major.minor" numbering
@@ -141,6 +140,7 @@ public class ProtocolVersion implements
*
* @return the hashcode of this protocol version
*/
+ @Override
public final int hashCode() {
return this.protocol.hashCode() ^ (this.major * 100000) ^ this.minor;
}
@@ -159,6 +159,7 @@ public class ProtocolVersion implements
* @return <code>true</code> if the argument is the same protocol version,
* <code>false</code> otherwise
*/
+ @Override
public final boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -259,8 +260,9 @@ public class ProtocolVersion implements
*
* @return a protocol version string, like "HTTP/1.1"
*/
+ @Override
public String toString() {
- CharArrayBuffer buffer = new CharArrayBuffer(16);
+ StringBuilder buffer = new StringBuilder();
buffer.append(this.protocol);
buffer.append('/');
buffer.append(Integer.toString(this.major));
@@ -269,6 +271,7 @@ public class ProtocolVersion implements
return buffer.toString();
}
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/TokenIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/TokenIterator.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/TokenIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/TokenIterator.java Sat May 7 20:56:39 2011
@@ -37,7 +37,7 @@ import java.util.Iterator;
*
* @since 4.0
*/
-public interface TokenIterator extends Iterator {
+public interface TokenIterator extends Iterator<String> {
/**
* Indicates whether there is another token in this iteration.
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/AbstractHttpEntity.java Sat May 7 20:56:39 2011
@@ -176,6 +176,7 @@ public abstract class AbstractHttpEntity
* @deprecated Either use {@link #getContent()} and call {@link java.io.InputStream#close()} on that;
* otherwise call {@link #writeTo(OutputStream)} which is required to free the resources.
*/
+ @Deprecated
public void consumeContent() throws IOException {
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BasicHttpEntity.java Sat May 7 20:56:39 2011
@@ -128,6 +128,8 @@ public class BasicHttpEntity extends Abs
* @deprecated Either use {@link #getContent()} and call {@link java.io.InputStream#close()} on that;
* otherwise call {@link #writeTo(OutputStream)} which is required to free the resources.
*/
+ @Deprecated
+ @Override
public void consumeContent() throws IOException {
if (content != null) {
content.close(); // reads to the end of the entity
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/BufferedHttpEntity.java Sat May 7 20:56:39 2011
@@ -63,6 +63,7 @@ public class BufferedHttpEntity extends
}
}
+ @Override
public long getContentLength() {
if (this.buffer != null) {
return this.buffer.length;
@@ -71,6 +72,7 @@ public class BufferedHttpEntity extends
}
}
+ @Override
public InputStream getContent() throws IOException {
if (this.buffer != null) {
return new ByteArrayInputStream(this.buffer);
@@ -84,6 +86,7 @@ public class BufferedHttpEntity extends
*
* @return <code>false</code>
*/
+ @Override
public boolean isChunked() {
return (buffer == null) && wrappedEntity.isChunked();
}
@@ -93,11 +96,13 @@ public class BufferedHttpEntity extends
*
* @return <code>true</code>
*/
+ @Override
public boolean isRepeatable() {
return true;
}
+ @Override
public void writeTo(final OutputStream outstream) throws IOException {
if (outstream == null) {
throw new IllegalArgumentException("Output stream may not be null");
@@ -111,6 +116,7 @@ public class BufferedHttpEntity extends
// non-javadoc, see interface HttpEntity
+ @Override
public boolean isStreaming() {
return (buffer == null) && wrappedEntity.isStreaming();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java Sat May 7 20:56:39 2011
@@ -79,6 +79,7 @@ public class ByteArrayEntity extends Abs
return false;
}
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/FileEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/FileEntity.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/FileEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/FileEntity.java Sat May 7 20:56:39 2011
@@ -89,6 +89,7 @@ public class FileEntity extends Abstract
return false;
}
+ @Override
public Object clone() throws CloneNotSupportedException {
// File instance is considered immutable
// No need to make a copy of it
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/HttpEntityWrapper.java Sat May 7 20:56:39 2011
@@ -104,6 +104,7 @@ public class HttpEntityWrapper implement
* @deprecated Either use {@link #getContent()} and call {@link java.io.InputStream#close()} on that;
* otherwise call {@link #writeTo(OutputStream)} which is required to free the resources.
*/
+ @Deprecated
public void consumeContent() throws IOException {
wrappedEntity.consumeContent();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java Sat May 7 20:56:39 2011
@@ -103,6 +103,8 @@ public class InputStreamEntity extends A
* @deprecated Either use {@link #getContent()} and call {@link java.io.InputStream#close()} on that;
* otherwise call {@link #writeTo(OutputStream)} which is required to free the resources.
*/
+ @Deprecated
+ @Override
public void consumeContent() throws IOException {
// If the input stream is from a connection, closing it will read to
// the end of the content. Otherwise, we don't care what it does.
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java Sat May 7 20:56:39 2011
@@ -131,6 +131,7 @@ public class StringEntity extends Abstra
return false;
}
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpClientConnection.java Sat May 7 20:56:39 2011
@@ -55,6 +55,7 @@ public class DefaultHttpClientConnection
super();
}
+ @Override
public void bind(
final Socket socket,
final HttpParams params) throws IOException {
@@ -75,6 +76,7 @@ public class DefaultHttpClientConnection
super.bind(socket, params);
}
+ @Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("[");
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/DefaultHttpServerConnection.java Sat May 7 20:56:39 2011
@@ -55,6 +55,7 @@ public class DefaultHttpServerConnection
super();
}
+ @Override
public void bind(final Socket socket, final HttpParams params) throws IOException {
if (socket == null) {
throw new IllegalArgumentException("Socket may not be null");
@@ -73,6 +74,7 @@ public class DefaultHttpServerConnection
super.bind(socket, params);
}
+ @Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("[");
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/HttpConnectionMetricsImpl.java Sat May 7 20:56:39 2011
@@ -28,6 +28,8 @@
package org.apache.http.impl;
import java.util.HashMap;
+import java.util.Map;
+
import org.apache.http.HttpConnectionMetrics;
import org.apache.http.io.HttpTransportMetrics;
@@ -51,7 +53,7 @@ public class HttpConnectionMetricsImpl i
/**
* The cache map for all metrics values.
*/
- private HashMap metricsCache;
+ private Map<String, Object> metricsCache;
public HttpConnectionMetricsImpl(
final HttpTransportMetrics inTransportMetric,
@@ -124,7 +126,7 @@ public class HttpConnectionMetricsImpl i
public void setMetric(final String metricName, Object obj) {
if (this.metricsCache == null) {
- this.metricsCache = new HashMap();
+ this.metricsCache = new HashMap<String, Object>();
}
this.metricsCache.put(metricName, obj);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpClientConnection.java Sat May 7 20:56:39 2011
@@ -73,6 +73,7 @@ public class SocketHttpClientConnection
}
}
+ @Override
protected void assertOpen() {
if (!this.open) {
throw new IllegalStateException("Connection is not open");
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/SocketHttpServerConnection.java Sat May 7 20:56:39 2011
@@ -72,6 +72,7 @@ public class SocketHttpServerConnection
}
}
+ @Override
protected void assertOpen() {
if (!this.open) {
throw new IllegalStateException("Connection is not open");
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java Sat May 7 20:56:39 2011
@@ -65,7 +65,7 @@ public abstract class AbstractMessagePar
private final SessionInputBuffer sessionBuffer;
private final int maxHeaderCount;
private final int maxLineLen;
- private final List headerLines;
+ private final List<CharArrayBuffer> headerLines;
protected final LineParser lineParser;
private int state;
@@ -95,7 +95,7 @@ public abstract class AbstractMessagePar
this.maxLineLen = params.getIntParameter(
CoreConnectionPNames.MAX_LINE_LENGTH, -1);
this.lineParser = (parser != null) ? parser : BasicLineParser.DEFAULT;
- this.headerLines = new ArrayList();
+ this.headerLines = new ArrayList<CharArrayBuffer>();
this.state = HEAD_LINE;
}
@@ -127,7 +127,7 @@ public abstract class AbstractMessagePar
if (parser == null) {
parser = BasicLineParser.DEFAULT;
}
- List headerLines = new ArrayList();
+ List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>();
return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser, headerLines);
}
@@ -160,7 +160,7 @@ public abstract class AbstractMessagePar
int maxHeaderCount,
int maxLineLen,
final LineParser parser,
- final List headerLines)
+ final List<CharArrayBuffer> headerLines)
throws HttpException, IOException {
if (inbuffer == null) {
@@ -217,7 +217,7 @@ public abstract class AbstractMessagePar
}
Header[] headers = new Header[headerLines.size()];
for (int i = 0; i < headerLines.size(); i++) {
- CharArrayBuffer buffer = (CharArrayBuffer) headerLines.get(i);
+ CharArrayBuffer buffer = headerLines.get(i);
try {
headers[i] = parser.parseHeader(buffer);
} catch (ParseException ex) {
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageWriter.java Sat May 7 20:56:39 2011
@@ -87,8 +87,8 @@ public abstract class AbstractMessageWri
throw new IllegalArgumentException("HTTP message may not be null");
}
writeHeadLine(message);
- for (Iterator it = message.headerIterator(); it.hasNext(); ) {
- Header header = (Header) it.next();
+ for (Iterator<Header> it = message.headerIterator(); it.hasNext(); ) {
+ Header header = it.next();
this.sessionBuffer.writeLine
(lineFormatter.formatHeader(this.lineBuf, header));
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java Sat May 7 20:56:39 2011
@@ -37,7 +37,6 @@ import org.apache.http.TruncatedChunkExc
import org.apache.http.io.BufferInfo;
import org.apache.http.io.SessionInputBuffer;
import org.apache.http.util.CharArrayBuffer;
-import org.apache.http.util.ExceptionUtils;
/**
* Implements chunked transfer coding. The content is received in small chunks.
@@ -100,6 +99,7 @@ public class ChunkedInputStream extends
this.state = CHUNK_LEN;
}
+ @Override
public int available() throws IOException {
if (this.in instanceof BufferInfo) {
int len = ((BufferInfo) this.in).length();
@@ -121,6 +121,7 @@ public class ChunkedInputStream extends
* byte
* @throws IOException in case of an I/O error
*/
+ @Override
public int read() throws IOException {
if (this.closed) {
throw new IOException("Attempted read from closed stream.");
@@ -154,6 +155,7 @@ public class ChunkedInputStream extends
* reached.
* @throws IOException in case of an I/O error
*/
+ @Override
public int read (byte[] b, int off, int len) throws IOException {
if (closed) {
@@ -192,6 +194,7 @@ public class ChunkedInputStream extends
* reached.
* @throws IOException in case of an I/O error
*/
+ @Override
public int read (byte[] b) throws IOException {
return read(b, 0, b.length);
}
@@ -269,10 +272,10 @@ public class ChunkedInputStream extends
try {
this.footers = AbstractMessageParser.parseHeaders
(in, -1, -1, null);
- } catch (HttpException e) {
+ } catch (HttpException ex) {
IOException ioe = new MalformedChunkCodingException("Invalid footer: "
- + e.getMessage());
- ExceptionUtils.initCause(ioe, e);
+ + ex.getMessage());
+ ioe.initCause(ex);
throw ioe;
}
}
@@ -283,6 +286,7 @@ public class ChunkedInputStream extends
* next response without scanning.
* @throws IOException in case of an I/O error
*/
+ @Override
public void close() throws IOException {
if (!closed) {
try {
@@ -300,7 +304,7 @@ public class ChunkedInputStream extends
}
public Header[] getFooters() {
- return (Header[])this.footers.clone();
+ return this.footers.clone();
}
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java Sat May 7 20:56:39 2011
@@ -131,6 +131,7 @@ public class ChunkedOutputStream extends
}
// -------------------------------------------- OutputStream Methods
+ @Override
public void write(int b) throws IOException {
if (this.closed) {
throw new IOException("Attempted write to closed stream.");
@@ -144,6 +145,7 @@ public class ChunkedOutputStream extends
* Writes the array. If the array does not fit within the buffer, it is
* not split, but rather written out as one large chunk.
*/
+ @Override
public void write(byte b[]) throws IOException {
write(b, 0, b.length);
}
@@ -152,6 +154,7 @@ public class ChunkedOutputStream extends
* Writes the array. If the array does not fit within the buffer, it is
* not split, but rather written out as one large chunk.
*/
+ @Override
public void write(byte src[], int off, int len) throws IOException {
if (this.closed) {
throw new IOException("Attempted write to closed stream.");
@@ -167,6 +170,7 @@ public class ChunkedOutputStream extends
/**
* Flushes the content buffer and the underlying stream.
*/
+ @Override
public void flush() throws IOException {
flushCache();
this.out.flush();
@@ -175,6 +179,7 @@ public class ChunkedOutputStream extends
/**
* Finishes writing to the underlying stream, but does NOT close the underlying stream.
*/
+ @Override
public void close() throws IOException {
if (!this.closed) {
this.closed = true;
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java Sat May 7 20:56:39 2011
@@ -96,6 +96,7 @@ public class ContentLengthInputStream ex
* primed to parse the next response.</p>
* @throws IOException If an IO problem occurs.
*/
+ @Override
public void close() throws IOException {
if (!closed) {
try {
@@ -110,6 +111,7 @@ public class ContentLengthInputStream ex
}
}
+ @Override
public int available() throws IOException {
if (this.in instanceof BufferInfo) {
int len = ((BufferInfo) this.in).length();
@@ -125,6 +127,7 @@ public class ContentLengthInputStream ex
* @throws IOException If an IO problem occurs
* @see java.io.InputStream#read()
*/
+ @Override
public int read() throws IOException {
if (closed) {
throw new IOException("Attempted read from closed stream.");
@@ -149,6 +152,7 @@ public class ContentLengthInputStream ex
*
* @throws java.io.IOException Should an error occur on the wrapped stream.
*/
+ @Override
public int read (byte[] b, int off, int len) throws java.io.IOException {
if (closed) {
throw new IOException("Attempted read from closed stream.");
@@ -174,6 +178,7 @@ public class ContentLengthInputStream ex
* @throws IOException If an IO problem occurs
* @see java.io.InputStream#read(byte[])
*/
+ @Override
public int read(byte[] b) throws IOException {
return read(b, 0, b.length);
}
@@ -186,6 +191,7 @@ public class ContentLengthInputStream ex
* @throws IOException If an error occurs while skipping bytes.
* @see InputStream#skip(long)
*/
+ @Override
public long skip(long n) throws IOException {
if (n <= 0) {
return 0;
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java Sat May 7 20:56:39 2011
@@ -91,6 +91,7 @@ public class ContentLengthOutputStream e
*
* @throws IOException If an I/O problem occurs.
*/
+ @Override
public void close() throws IOException {
if (!this.closed) {
this.closed = true;
@@ -98,10 +99,12 @@ public class ContentLengthOutputStream e
}
}
+ @Override
public void flush() throws IOException {
this.out.flush();
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
if (this.closed) {
throw new IOException("Attempted write to closed stream.");
@@ -116,10 +119,12 @@ public class ContentLengthOutputStream e
}
}
+ @Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
+ @Override
public void write(int b) throws IOException {
if (this.closed) {
throw new IOException("Attempted write to closed stream.");
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestParser.java Sat May 7 20:56:39 2011
@@ -82,6 +82,7 @@ public class HttpRequestParser extends A
this.lineBuf = new CharArrayBuffer(128);
}
+ @Override
protected HttpMessage parseHead(
final SessionInputBuffer sessionBuffer)
throws IOException, HttpException, ParseException {
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpRequestWriter.java Sat May 7 20:56:39 2011
@@ -49,6 +49,7 @@ public class HttpRequestWriter extends A
super(buffer, formatter, params);
}
+ @Override
protected void writeHeadLine(final HttpMessage message)
throws IOException {
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseParser.java Sat May 7 20:56:39 2011
@@ -82,6 +82,7 @@ public class HttpResponseParser extends
this.lineBuf = new CharArrayBuffer(128);
}
+ @Override
protected HttpMessage parseHead(
final SessionInputBuffer sessionBuffer)
throws IOException, HttpException, ParseException {
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/HttpResponseWriter.java Sat May 7 20:56:39 2011
@@ -49,6 +49,7 @@ public class HttpResponseWriter extends
super(buffer, formatter, params);
}
+ @Override
protected void writeHeadLine(final HttpMessage message)
throws IOException {
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityInputStream.java Sat May 7 20:56:39 2011
@@ -64,6 +64,7 @@ public class IdentityInputStream extends
this.in = in;
}
+ @Override
public int available() throws IOException {
if (this.in instanceof BufferInfo) {
return ((BufferInfo) this.in).length();
@@ -72,10 +73,12 @@ public class IdentityInputStream extends
}
}
+ @Override
public void close() throws IOException {
this.closed = true;
}
+ @Override
public int read() throws IOException {
if (this.closed) {
return -1;
@@ -84,6 +87,7 @@ public class IdentityInputStream extends
}
}
+ @Override
public int read(final byte[] b, int off, int len) throws IOException {
if (this.closed) {
return -1;
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/IdentityOutputStream.java Sat May 7 20:56:39 2011
@@ -67,6 +67,7 @@ public class IdentityOutputStream extend
*
* @throws IOException If an I/O problem occurs.
*/
+ @Override
public void close() throws IOException {
if (!this.closed) {
this.closed = true;
@@ -74,10 +75,12 @@ public class IdentityOutputStream extend
}
}
+ @Override
public void flush() throws IOException {
this.out.flush();
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
if (this.closed) {
throw new IOException("Attempted write to closed stream.");
@@ -85,10 +88,12 @@ public class IdentityOutputStream extend
this.out.write(b, off, len);
}
+ @Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
+ @Override
public void write(int b) throws IOException {
if (this.closed) {
throw new IOException("Attempted write to closed stream.");
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java Sat May 7 20:56:39 2011
@@ -28,8 +28,8 @@
package org.apache.http.impl.io;
import java.io.IOException;
-import java.io.InterruptedIOException;
import java.net.Socket;
+import java.net.SocketTimeoutException;
import org.apache.http.io.EofSensor;
import org.apache.http.io.SessionInputBuffer;
@@ -49,30 +49,6 @@ import org.apache.http.params.HttpParams
*/
public class SocketInputBuffer extends AbstractSessionInputBuffer implements EofSensor {
- static private final Class SOCKET_TIMEOUT_CLASS = SocketTimeoutExceptionClass();
-
- /**
- * Returns <code>SocketTimeoutExceptionClass<code> or <code>null</code> if the class
- * does not exist.
- *
- * @return <code>SocketTimeoutExceptionClass<code>, or <code>null</code> if unavailable.
- */
- static private Class SocketTimeoutExceptionClass() {
- try {
- return Class.forName("java.net.SocketTimeoutException");
- } catch (ClassNotFoundException e) {
- return null;
- }
- }
-
- private static boolean isSocketTimeoutException(final InterruptedIOException e) {
- if (SOCKET_TIMEOUT_CLASS != null) {
- return SOCKET_TIMEOUT_CLASS.isInstance(e);
- } else {
- return true;
- }
- }
-
private final Socket socket;
private boolean eof;
@@ -106,6 +82,7 @@ public class SocketInputBuffer extends A
init(socket.getInputStream(), buffersize, params);
}
+ @Override
protected int fillBuffer() throws IOException {
int i = super.fillBuffer();
this.eof = i == -1;
@@ -120,10 +97,8 @@ public class SocketInputBuffer extends A
this.socket.setSoTimeout(timeout);
fillBuffer();
result = hasBufferedData();
- } catch (InterruptedIOException e) {
- if (!isSocketTimeoutException(e)) {
- throw e;
- }
+ } catch (SocketTimeoutException ex) {
+ throw ex;
} finally {
socket.setSoTimeout(oldtimeout);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/AbstractHttpMessage.java Sat May 7 20:56:39 2011
@@ -122,8 +122,8 @@ public abstract class AbstractHttpMessag
if (name == null) {
return;
}
- for (Iterator i = this.headergroup.iterator(); i.hasNext(); ) {
- Header header = (Header) i.next();
+ for (Iterator<Header> i = this.headergroup.iterator(); i.hasNext(); ) {
+ Header header = i.next();
if (name.equalsIgnoreCase(header.getName())) {
i.remove();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeader.java Sat May 7 20:56:39 2011
@@ -68,6 +68,7 @@ public class BasicHeader implements Head
return this.value;
}
+ @Override
public String toString() {
// no need for non-default formatting in toString()
return BasicLineFormatter.DEFAULT.formatHeader(null, this).toString();
@@ -82,6 +83,7 @@ public class BasicHeader implements Head
}
}
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElement.java Sat May 7 20:56:39 2011
@@ -29,7 +29,6 @@ package org.apache.http.message;
import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair;
-import org.apache.http.util.CharArrayBuffer;
import org.apache.http.util.LangUtils;
/**
@@ -87,7 +86,7 @@ public class BasicHeaderElement implemen
}
public NameValuePair[] getParameters() {
- return (NameValuePair[])this.parameters.clone();
+ return this.parameters.clone();
}
public int getParameterCount() {
@@ -114,6 +113,7 @@ public class BasicHeaderElement implemen
return found;
}
+ @Override
public boolean equals(final Object object) {
if (this == object) return true;
if (object instanceof HeaderElement) {
@@ -126,6 +126,7 @@ public class BasicHeaderElement implemen
}
}
+ @Override
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.name);
@@ -136,8 +137,9 @@ public class BasicHeaderElement implemen
return hash;
}
+ @Override
public String toString() {
- CharArrayBuffer buffer = new CharArrayBuffer(64);
+ StringBuilder buffer = new StringBuilder();
buffer.append(this.name);
if (this.value != null) {
buffer.append("=");
@@ -150,6 +152,7 @@ public class BasicHeaderElement implemen
return buffer.toString();
}
+ @Override
public Object clone() throws CloneNotSupportedException {
// parameters array is considered immutable
// no need to make a copy of it
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderElementIterator.java Sat May 7 20:56:39 2011
@@ -143,7 +143,7 @@ public class BasicHeaderElementIterator
return element;
}
- public final Object next() throws NoSuchElementException {
+ public final HeaderElement next() throws NoSuchElementException {
return nextElement();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java Sat May 7 20:56:39 2011
@@ -154,7 +154,7 @@ public class BasicHeaderIterator impleme
*
* @throws NoSuchElementException if there are no more headers
*/
- public final Object next()
+ public final Header next()
throws NoSuchElementException {
return nextHeader();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java Sat May 7 20:56:39 2011
@@ -103,15 +103,14 @@ public class BasicHeaderValueParser impl
throw new IllegalArgumentException("Parser cursor may not be null");
}
- List elements = new ArrayList();
+ List<HeaderElement> elements = new ArrayList<HeaderElement>();
while (!cursor.atEnd()) {
HeaderElement element = parseHeaderElement(buffer, cursor);
if (!(element.getName().length() == 0 && element.getValue() == null)) {
elements.add(element);
}
}
- return (HeaderElement[])
- elements.toArray(new HeaderElement[elements.size()]);
+ return elements.toArray(new HeaderElement[elements.size()]);
}
@@ -236,7 +235,7 @@ public class BasicHeaderValueParser impl
return new NameValuePair[] {};
}
- List params = new ArrayList();
+ List<NameValuePair> params = new ArrayList<NameValuePair>();
while (!cursor.atEnd()) {
NameValuePair param = parseNameValuePair(buffer, cursor);
params.add(param);
@@ -246,8 +245,7 @@ public class BasicHeaderValueParser impl
}
}
- return (NameValuePair[])
- params.toArray(new NameValuePair[params.size()]);
+ return params.toArray(new NameValuePair[params.size()]);
}
/**
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpRequest.java Sat May 7 20:56:39 2011
@@ -127,6 +127,7 @@ public class BasicHttpRequest extends Ab
return this.requestline;
}
+ @Override
public String toString() {
return this.method + " " + this.uri + " " + this.headergroup;
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHttpResponse.java Sat May 7 20:56:39 2011
@@ -191,6 +191,7 @@ public class BasicHttpResponse extends A
null : this.reasonCatalog.getReason(code, this.locale);
}
+ @Override
public String toString() {
return this.statusline + " " + this.headergroup;
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java Sat May 7 20:56:39 2011
@@ -45,7 +45,7 @@ public class BasicListHeaderIterator imp
* A list of headers to iterate over.
* Not all elements of this array are necessarily part of the iteration.
*/
- protected final List allHeaders;
+ protected final List<Header> allHeaders;
/**
@@ -77,7 +77,7 @@ public class BasicListHeaderIterator imp
* @param name the name of the headers over which to iterate, or
* <code>null</code> for any
*/
- public BasicListHeaderIterator(List headers, String name) {
+ public BasicListHeaderIterator(List<Header> headers, String name) {
if (headers == null) {
throw new IllegalArgumentException
("Header list must not be null.");
@@ -126,7 +126,7 @@ public class BasicListHeaderIterator imp
return true;
// non-header elements, including null, will trigger exceptions
- final String name = ((Header)this.allHeaders.get(index)).getName();
+ final String name = (this.allHeaders.get(index)).getName();
return this.headerName.equalsIgnoreCase(name);
}
@@ -156,7 +156,7 @@ public class BasicListHeaderIterator imp
this.lastIndex = current;
this.currentIndex = findNext(current);
- return (Header) this.allHeaders.get(current);
+ return this.allHeaders.get(current);
}
@@ -168,7 +168,7 @@ public class BasicListHeaderIterator imp
*
* @throws NoSuchElementException if there are no more headers
*/
- public final Object next()
+ public final Header next()
throws NoSuchElementException {
return nextHeader();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicNameValuePair.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicNameValuePair.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicNameValuePair.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicNameValuePair.java Sat May 7 20:56:39 2011
@@ -30,7 +30,6 @@ package org.apache.http.message;
import java.io.Serializable;
import org.apache.http.NameValuePair;
-import org.apache.http.util.CharArrayBuffer;
import org.apache.http.util.LangUtils;
/**
@@ -68,6 +67,7 @@ public class BasicNameValuePair implemen
return this.value;
}
+ @Override
public String toString() {
// don't call complex default formatting for a simple toString
@@ -75,7 +75,7 @@ public class BasicNameValuePair implemen
return name;
} else {
int len = this.name.length() + 1 + this.value.length();
- CharArrayBuffer buffer = new CharArrayBuffer(len);
+ StringBuilder buffer = new StringBuilder(len);
buffer.append(this.name);
buffer.append("=");
buffer.append(this.value);
@@ -83,6 +83,7 @@ public class BasicNameValuePair implemen
}
}
+ @Override
public boolean equals(final Object object) {
if (this == object) return true;
if (object instanceof NameValuePair) {
@@ -94,6 +95,7 @@ public class BasicNameValuePair implemen
}
}
+ @Override
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.name);
@@ -101,6 +103,7 @@ public class BasicNameValuePair implemen
return hash;
}
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicRequestLine.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicRequestLine.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicRequestLine.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicRequestLine.java Sat May 7 20:56:39 2011
@@ -78,12 +78,14 @@ public class BasicRequestLine implements
return this.uri;
}
+ @Override
public String toString() {
// no need for non-default formatting in toString()
return BasicLineFormatter.DEFAULT
.formatRequestLine(null, this).toString();
}
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicStatusLine.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicStatusLine.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicStatusLine.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicStatusLine.java Sat May 7 20:56:39 2011
@@ -93,12 +93,14 @@ public class BasicStatusLine implements
return this.reasonPhrase;
}
+ @Override
public String toString() {
// no need for non-default formatting in toString()
return BasicLineFormatter.DEFAULT
.formatStatusLine(null, this).toString();
}
+ @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java Sat May 7 20:56:39 2011
@@ -126,7 +126,7 @@ public class BasicTokenIterator implemen
* @throws NoSuchElementException if there are no more tokens
* @throws ParseException if an invalid header value is encountered
*/
- public final Object next()
+ public final String next()
throws NoSuchElementException, ParseException {
return nextToken();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BufferedHeader.java Sat May 7 20:56:39 2011
@@ -116,10 +116,12 @@ public class BufferedHeader implements F
return this.buffer;
}
+ @Override
public String toString() {
return this.buffer.toString();
}
+ @Override
public Object clone() throws CloneNotSupportedException {
// buffer is considered immutable
// no need to make a copy of it
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/HeaderGroup.java Sat May 7 20:56:39 2011
@@ -49,13 +49,13 @@ public class HeaderGroup implements Clon
private static final long serialVersionUID = 2608834160639271617L;
/** The list of headers for this group, in the order in which they were added */
- private final List headers;
+ private final List<Header> headers;
/**
* Constructor for HeaderGroup.
*/
public HeaderGroup() {
- this.headers = new ArrayList(16);
+ this.headers = new ArrayList<Header>(16);
}
/**
@@ -102,7 +102,7 @@ public class HeaderGroup implements Clon
return;
}
for (int i = 0; i < this.headers.size(); i++) {
- Header current = (Header) this.headers.get(i);
+ Header current = this.headers.get(i);
if (current.getName().equalsIgnoreCase(header.getName())) {
this.headers.set(i, header);
return;
@@ -169,16 +169,16 @@ public class HeaderGroup implements Clon
* @return an array of length >= 0
*/
public Header[] getHeaders(String name) {
- ArrayList headersFound = new ArrayList();
+ List<Header> headersFound = new ArrayList<Header>();
for (int i = 0; i < headers.size(); i++) {
- Header header = (Header) headers.get(i);
+ Header header = headers.get(i);
if (header.getName().equalsIgnoreCase(name)) {
headersFound.add(header);
}
}
- return (Header[]) headersFound.toArray(new Header[headersFound.size()]);
+ return headersFound.toArray(new Header[headersFound.size()]);
}
/**
@@ -191,7 +191,7 @@ public class HeaderGroup implements Clon
*/
public Header getFirstHeader(String name) {
for (int i = 0; i < headers.size(); i++) {
- Header header = (Header) headers.get(i);
+ Header header = headers.get(i);
if (header.getName().equalsIgnoreCase(name)) {
return header;
}
@@ -210,7 +210,7 @@ public class HeaderGroup implements Clon
public Header getLastHeader(String name) {
// start at the end of the list and work backwards
for (int i = headers.size() - 1; i >= 0; i--) {
- Header header = (Header) headers.get(i);
+ Header header = headers.get(i);
if (header.getName().equalsIgnoreCase(name)) {
return header;
}
@@ -225,7 +225,7 @@ public class HeaderGroup implements Clon
* @return an array of length >= 0
*/
public Header[] getAllHeaders() {
- return (Header[]) headers.toArray(new Header[headers.size()]);
+ return headers.toArray(new Header[headers.size()]);
}
/**
@@ -239,7 +239,7 @@ public class HeaderGroup implements Clon
*/
public boolean containsHeader(String name) {
for (int i = 0; i < headers.size(); i++) {
- Header header = (Header) headers.get(i);
+ Header header = headers.get(i);
if (header.getName().equalsIgnoreCase(name)) {
return true;
}
@@ -286,6 +286,7 @@ public class HeaderGroup implements Clon
return clone;
}
+ @Override
public Object clone() throws CloneNotSupportedException {
HeaderGroup clone = (HeaderGroup) super.clone();
clone.headers.clear();
@@ -293,6 +294,7 @@ public class HeaderGroup implements Clon
return clone;
}
+ @Override
public String toString() {
return this.headers.toString();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/ParserCursor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/ParserCursor.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/ParserCursor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/ParserCursor.java Sat May 7 20:56:39 2011
@@ -27,8 +27,6 @@
package org.apache.http.message;
-import org.apache.http.util.CharArrayBuffer;
-
/**
* This class represents a context of a parsing operation:
* <ul>
@@ -83,8 +81,9 @@ public class ParserCursor {
return this.pos >= this.upperBound;
}
+ @Override
public String toString() {
- CharArrayBuffer buffer = new CharArrayBuffer(16);
+ StringBuilder buffer = new StringBuilder();
buffer.append('[');
buffer.append(Integer.toString(this.lowerBound));
buffer.append('>');
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/AbstractHttpParams.java Sat May 7 20:56:39 2011
@@ -116,7 +116,7 @@ public abstract class AbstractHttpParams
* @since 4.2
* @throws UnsupportedOperationException - always
*/
- public Set getNames(){
+ public Set<String> getNames(){
throw new UnsupportedOperationException();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/BasicHttpParams.java Sat May 7 20:56:39 2011
@@ -49,7 +49,7 @@ public class BasicHttpParams extends Abs
private static final long serialVersionUID = -7086398485908701455L;
/** Map of HTTP parameters that this collection contains. */
- private final HashMap parameters = new HashMap();
+ private final HashMap<String, Object> parameters = new HashMap<String, Object>();
public BasicHttpParams() {
super();
@@ -132,6 +132,7 @@ public class BasicHttpParams extends Abs
* @deprecated
* @throws UnsupportedOperationException if the clone() fails
*/
+ @Deprecated
public HttpParams copy() {
try {
return (HttpParams) clone();
@@ -144,6 +145,7 @@ public class BasicHttpParams extends Abs
* Clones the instance.
* Uses {@link #copyParams(HttpParams)} to copy the parameters.
*/
+ @Override
public Object clone() throws CloneNotSupportedException {
BasicHttpParams clone = (BasicHttpParams) super.clone();
copyParams(clone);
@@ -158,11 +160,11 @@ public class BasicHttpParams extends Abs
* @since 4.2
*/
public void copyParams(HttpParams target) {
- Iterator iter = parameters.entrySet().iterator();
+ Iterator<Map.Entry<String, Object>> iter = this.parameters.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry me = (Map.Entry) iter.next();
+ Map.Entry<String, Object> me = iter.next();
if (me.getKey() instanceof String)
- target.setParameter((String)me.getKey(), me.getValue());
+ target.setParameter(me.getKey(), me.getValue());
}
}
@@ -175,7 +177,8 @@ public class BasicHttpParams extends Abs
* @return the names, as a Set<String>
* @since 4.2
*/
- public Set getNames() {
- return new HashSet(parameters.keySet());
+ @Override
+ public Set<String> getNames() {
+ return new HashSet<String>(this.parameters.keySet());
}
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/DefaultedHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/DefaultedHttpParams.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/DefaultedHttpParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/DefaultedHttpParams.java Sat May 7 20:56:39 2011
@@ -65,6 +65,7 @@ public final class DefaultedHttpParams e
*
* @deprecated
*/
+ @Deprecated
public HttpParams copy() {
HttpParams clone = this.local.copy();
return new DefaultedHttpParams(clone, this.defaults);
@@ -104,6 +105,7 @@ public final class DefaultedHttpParams e
* @return the default HttpParams collection
* @deprecated (4.2) do not use, will be removed in a later version
*/
+ @Deprecated
public HttpParams getDefaults() {
return this.defaults;
}
@@ -119,9 +121,10 @@ public final class DefaultedHttpParams e
* @since 4.2
* @throws UnsupportedOperationException if either the local or default HttpParams instances do not implement HttpParamsNames
*/
- public Set getNames() {
- Set combined = new HashSet(getNames(defaults));
- combined.addAll(getNames(local));
+ @Override
+ public Set<String> getNames() {
+ Set<String> combined = new HashSet<String>(getNames(defaults));
+ combined.addAll(getNames(this.local));
return combined ;
}
@@ -135,8 +138,8 @@ public final class DefaultedHttpParams e
* @since 4.2
* @throws UnsupportedOperationException if the default HttpParams instance does not implement HttpParamsNames
*/
- public Set getDefaultNames() {
- return new HashSet(getNames(defaults));
+ public Set<String> getDefaultNames() {
+ return new HashSet<String>(getNames(this.defaults));
}
/**
@@ -149,12 +152,12 @@ public final class DefaultedHttpParams e
* @since 4.2
* @throws UnsupportedOperationException if the local HttpParams instance does not implement HttpParamsNames
*/
- public Set getLocalNames() {
- return new HashSet(getNames(local));
+ public Set<String> getLocalNames() {
+ return new HashSet<String>(getNames(this.local));
}
// Helper method
- private Set getNames(HttpParams params) {
+ private Set<String> getNames(HttpParams params) {
if (params instanceof HttpParamsNames) {
return ((HttpParamsNames) params).getNames();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParams.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParams.java Sat May 7 20:56:39 2011
@@ -76,6 +76,7 @@ public interface HttpParams {
*
* @deprecated
*/
+ @Deprecated
HttpParams copy();
/**
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParamsNames.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParamsNames.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParamsNames.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/HttpParamsNames.java Sat May 7 20:56:39 2011
@@ -48,6 +48,6 @@ public interface HttpParamsNames {
*
* @return the names, as a Set<String>
*/
- Set getNames();
+ Set<String> getNames();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/SyncBasicHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/SyncBasicHttpParams.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/SyncBasicHttpParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/params/SyncBasicHttpParams.java Sat May 7 20:56:39 2011
@@ -39,34 +39,42 @@ public class SyncBasicHttpParams extends
super();
}
+ @Override
public synchronized boolean removeParameter(final String name) {
return super.removeParameter(name);
}
+ @Override
public synchronized HttpParams setParameter(final String name, final Object value) {
return super.setParameter(name, value);
}
+ @Override
public synchronized Object getParameter(final String name) {
return super.getParameter(name);
}
+ @Override
public synchronized boolean isParameterSet(final String name) {
return super.isParameterSet(name);
}
+ @Override
public synchronized boolean isParameterSetLocally(final String name) {
return super.isParameterSetLocally(name);
}
+ @Override
public synchronized void setParameters(final String[] names, final Object value) {
super.setParameters(names, value);
}
+ @Override
public synchronized void clear() {
super.clear();
}
+ @Override
public synchronized Object clone() throws CloneNotSupportedException {
return super.clone();
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpContext.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpContext.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpContext.java Sat May 7 20:56:39 2011
@@ -41,7 +41,7 @@ import java.util.Map;
public class BasicHttpContext implements HttpContext {
private final HttpContext parentContext;
- private Map map = null;
+ private Map<String, Object> map = null;
public BasicHttpContext() {
this(null);
@@ -71,7 +71,7 @@ public class BasicHttpContext implements
throw new IllegalArgumentException("Id may not be null");
}
if (this.map == null) {
- this.map = new HashMap();
+ this.map = new HashMap<String, Object>();
}
this.map.put(id, obj);
}