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 [2/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/...
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/BasicHttpProcessor.java Sat May 7 20:56:39 2011
@@ -51,8 +51,8 @@ public final class BasicHttpProcessor im
HttpProcessor, HttpRequestInterceptorList, HttpResponseInterceptorList, Cloneable {
// Don't allow direct access, as nulls are not allowed
- protected final List requestInterceptors = new ArrayList();
- protected final List responseInterceptors = new ArrayList();
+ protected final List<HttpRequestInterceptor> requestInterceptors = new ArrayList<HttpRequestInterceptor>();
+ protected final List<HttpResponseInterceptor> responseInterceptors = new ArrayList<HttpResponseInterceptor>();
public void addRequestInterceptor(final HttpRequestInterceptor itcp) {
if (itcp == null) {
@@ -77,8 +77,8 @@ public final class BasicHttpProcessor im
this.responseInterceptors.add(index, itcp);
}
- public void removeRequestInterceptorByClass(final Class clazz) {
- for (Iterator it = this.requestInterceptors.iterator();
+ public void removeRequestInterceptorByClass(final Class<? extends HttpRequestInterceptor> clazz) {
+ for (Iterator<HttpRequestInterceptor> it = this.requestInterceptors.iterator();
it.hasNext(); ) {
Object request = it.next();
if (request.getClass().equals(clazz)) {
@@ -87,8 +87,8 @@ public final class BasicHttpProcessor im
}
}
- public void removeResponseInterceptorByClass(final Class clazz) {
- for (Iterator it = this.responseInterceptors.iterator();
+ public void removeResponseInterceptorByClass(final Class<? extends HttpResponseInterceptor> clazz) {
+ for (Iterator<HttpResponseInterceptor> it = this.responseInterceptors.iterator();
it.hasNext(); ) {
Object request = it.next();
if (request.getClass().equals(clazz)) {
@@ -112,7 +112,7 @@ public final class BasicHttpProcessor im
public HttpRequestInterceptor getRequestInterceptor(int index) {
if ((index < 0) || (index >= this.requestInterceptors.size()))
return null;
- return (HttpRequestInterceptor) this.requestInterceptors.get(index);
+ return this.requestInterceptors.get(index);
}
public void clearRequestInterceptors() {
@@ -141,7 +141,7 @@ public final class BasicHttpProcessor im
public HttpResponseInterceptor getResponseInterceptor(int index) {
if ((index < 0) || (index >= this.responseInterceptors.size()))
return null;
- return (HttpResponseInterceptor) this.responseInterceptors.get(index);
+ return this.responseInterceptors.get(index);
}
public void clearResponseInterceptors() {
@@ -165,7 +165,7 @@ public final class BasicHttpProcessor im
* @param list the list of request and response interceptors
* from which to initialize
*/
- public void setInterceptors(final List list) {
+ public void setInterceptors(final List<?> list) {
if (list == null) {
throw new IllegalArgumentException("List must not be null.");
}
@@ -196,7 +196,7 @@ public final class BasicHttpProcessor im
throws IOException, HttpException {
for (int i = 0; i < this.requestInterceptors.size(); i++) {
HttpRequestInterceptor interceptor =
- (HttpRequestInterceptor) this.requestInterceptors.get(i);
+ this.requestInterceptors.get(i);
interceptor.process(request, context);
}
}
@@ -207,7 +207,7 @@ public final class BasicHttpProcessor im
throws IOException, HttpException {
for (int i = 0; i < this.responseInterceptors.size(); i++) {
HttpResponseInterceptor interceptor =
- (HttpResponseInterceptor) this.responseInterceptors.get(i);
+ this.responseInterceptors.get(i);
interceptor.process(response, context);
}
}
@@ -236,6 +236,7 @@ public final class BasicHttpProcessor im
return clone;
}
+ @Override
public Object clone() throws CloneNotSupportedException {
BasicHttpProcessor clone = (BasicHttpProcessor) super.clone();
copyInterceptors(clone);
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestHandlerRegistry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestHandlerRegistry.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestHandlerRegistry.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestHandlerRegistry.java Sat May 7 20:56:39 2011
@@ -84,7 +84,7 @@ public class HttpRequestHandlerRegistry
* Sets handlers from the given map.
* @param map the map containing handlers keyed by their URI patterns.
*/
- public void setHandlers(final Map map) {
+ public void setHandlers(final Map<String, Object> map) {
matcher.setObjects(map);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestInterceptorList.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestInterceptorList.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestInterceptorList.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpRequestInterceptorList.java Sat May 7 20:56:39 2011
@@ -83,7 +83,7 @@ public interface HttpRequestInterceptorL
*
* @param clazz the class of the instances to be removed.
*/
- void removeRequestInterceptorByClass(Class clazz);
+ void removeRequestInterceptorByClass(Class<? extends HttpRequestInterceptor> clazz);
/**
* Sets the request interceptors in this list.
@@ -94,7 +94,7 @@ public interface HttpRequestInterceptorL
*
* @param list the list of request interceptors
*/
- void setInterceptors(List list);
+ void setInterceptors(List<?> list);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpResponseInterceptorList.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpResponseInterceptorList.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpResponseInterceptorList.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpResponseInterceptorList.java Sat May 7 20:56:39 2011
@@ -83,7 +83,7 @@ public interface HttpResponseInterceptor
*
* @param clazz the class of the instances to be removed.
*/
- void removeResponseInterceptorByClass(Class clazz);
+ void removeResponseInterceptorByClass(Class<? extends HttpResponseInterceptor> clazz);
/**
* Sets the response interceptors in this list.
@@ -94,7 +94,7 @@ public interface HttpResponseInterceptor
*
* @param list the list of response interceptors
*/
- void setInterceptors(List list);
+ void setInterceptors(List<?> list);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpService.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/HttpService.java Sat May 7 20:56:39 2011
@@ -150,6 +150,7 @@ public class HttpService {
* @deprecated use {@link HttpService#HttpService(HttpProcessor,
* ConnectionReuseStrategy, HttpResponseFactory, HttpRequestHandlerResolver, HttpParams)}
*/
+ @Deprecated
public HttpService(
final HttpProcessor proc,
final ConnectionReuseStrategy connStrategy,
@@ -163,6 +164,7 @@ public class HttpService {
/**
* @deprecated set {@link HttpProcessor} using constructor
*/
+ @Deprecated
public void setHttpProcessor(final HttpProcessor processor) {
if (processor == null) {
throw new IllegalArgumentException("HTTP processor may not be null");
@@ -173,6 +175,7 @@ public class HttpService {
/**
* @deprecated set {@link ConnectionReuseStrategy} using constructor
*/
+ @Deprecated
public void setConnReuseStrategy(final ConnectionReuseStrategy connStrategy) {
if (connStrategy == null) {
throw new IllegalArgumentException("Connection reuse strategy may not be null");
@@ -183,6 +186,7 @@ public class HttpService {
/**
* @deprecated set {@link HttpResponseFactory} using constructor
*/
+ @Deprecated
public void setResponseFactory(final HttpResponseFactory responseFactory) {
if (responseFactory == null) {
throw new IllegalArgumentException("Response factory may not be null");
@@ -193,6 +197,7 @@ public class HttpService {
/**
* @deprecated set {@link HttpResponseFactory} using constructor
*/
+ @Deprecated
public void setParams(final HttpParams params) {
this.params = params;
}
@@ -200,6 +205,7 @@ public class HttpService {
/**
* @deprecated set {@link HttpRequestHandlerResolver} using constructor
*/
+ @Deprecated
public void setHandlerResolver(final HttpRequestHandlerResolver handlerResolver) {
this.handlerResolver = handlerResolver;
}
@@ -207,6 +213,7 @@ public class HttpService {
/**
* @deprecated set {@link HttpExpectationVerifier} using constructor
*/
+ @Deprecated
public void setExpectationVerifier(final HttpExpectationVerifier expectationVerifier) {
this.expectationVerifier = expectationVerifier;
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/SyncBasicHttpContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/SyncBasicHttpContext.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/SyncBasicHttpContext.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/SyncBasicHttpContext.java Sat May 7 20:56:39 2011
@@ -38,14 +38,17 @@ public class SyncBasicHttpContext extend
super(parentContext);
}
+ @Override
public synchronized Object getAttribute(final String id) {
return super.getAttribute(id);
}
+ @Override
public synchronized void setAttribute(final String id, final Object obj) {
super.setAttribute(id, obj);
}
+ @Override
public synchronized Object removeAttribute(final String id) {
return super.removeAttribute(id);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/protocol/UriPatternMatcher.java Sat May 7 20:56:39 2011
@@ -51,11 +51,11 @@ public class UriPatternMatcher {
/**
* TODO: Replace with ConcurrentHashMap
*/
- private final Map map;
+ private final Map<String, Object> map;
public UriPatternMatcher() {
super();
- this.map = new HashMap();
+ this.map = new HashMap<String, Object>();
}
/**
@@ -86,7 +86,8 @@ public class UriPatternMatcher {
/**
* @deprecated use {@link #setObjects(Map)}
*/
- public synchronized void setHandlers(final Map map) {
+ @Deprecated
+ public synchronized void setHandlers(final Map<String, Object> map) {
if (map == null) {
throw new IllegalArgumentException("Map of handlers may not be null");
}
@@ -98,7 +99,7 @@ public class UriPatternMatcher {
* Sets objects from the given map.
* @param map the map containing objects keyed by their URI patterns.
*/
- public synchronized void setObjects(final Map map) {
+ public synchronized void setObjects(final Map<String, Object> map) {
if (map == null) {
throw new IllegalArgumentException("Map of handlers may not be null");
}
@@ -127,8 +128,8 @@ public class UriPatternMatcher {
if (obj == null) {
// pattern match?
String bestMatch = null;
- for (Iterator it = this.map.keySet().iterator(); it.hasNext();) {
- String pattern = (String) it.next();
+ for (Iterator<String> it = this.map.keySet().iterator(); it.hasNext();) {
+ String pattern = it.next();
if (matchUriRequestPattern(pattern, requestURI)) {
// we have a match. is it any better?
if (bestMatch == null
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java Sat May 7 20:56:39 2011
@@ -454,6 +454,7 @@ public final class CharArrayBuffer imple
return new String(this.buffer, beginIndex, endIndex - beginIndex);
}
+ @Override
public String toString() {
return new String(this.buffer, 0, this.len);
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ExceptionUtils.java Sat May 7 20:56:39 2011
@@ -33,7 +33,10 @@ import java.lang.reflect.Method;
*
*
* @since 4.0
+ *
+ * @deprecated (4.2) no longer used
*/
+@Deprecated
public final class ExceptionUtils {
/** A reference to Throwable's initCause method, or null if it's not there in this JVM */
@@ -50,7 +53,7 @@ public final class ExceptionUtils {
*/
static private Method getInitCauseMethod() {
try {
- Class[] paramsClasses = new Class[] { Throwable.class };
+ Class<?>[] paramsClasses = new Class[] { Throwable.class };
return Throwable.class.getMethod("initCause", paramsClasses);
} catch (NoSuchMethodException e) {
return null;
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java Sat May 7 20:56:39 2011
@@ -29,6 +29,7 @@ package org.apache.http.util;
import java.io.IOException;
import java.io.InputStream;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.ArrayList;
@@ -158,6 +159,7 @@ public class VersionInfo {
*
* @return a string holding this version information
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer
(20 + infoPackage.length() + infoModule.length() +
@@ -200,14 +202,14 @@ public class VersionInfo {
("Package identifier list must not be null.");
}
- ArrayList vil = new ArrayList(pckgs.length);
+ List<VersionInfo> vil = new ArrayList<VersionInfo>(pckgs.length);
for (int i=0; i<pckgs.length; i++) {
VersionInfo vi = loadVersionInfo(pckgs[i], clsldr);
if (vi != null)
vil.add(vi);
}
- return (VersionInfo[]) vil.toArray(new VersionInfo[vil.size()]);
+ return vil.toArray(new VersionInfo[vil.size()]);
}
@@ -270,7 +272,7 @@ public class VersionInfo {
*
* @return the version information
*/
- protected final static VersionInfo fromMap(String pckg, Map info,
+ protected final static VersionInfo fromMap(String pckg, Map<?, ?> info,
ClassLoader clsldr) {
if (pckg == null) {
throw new IllegalArgumentException
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultConnectionReuseStrategy.java Sat May 7 20:56:39 2011
@@ -59,6 +59,7 @@ public class TestDefaultConnectionReuseS
super(testName);
}
+ @Override
public void setUp() {
// open and not stale is required for most of the tests here
mockConnection = new MockConnection(true, false);
@@ -67,6 +68,7 @@ public class TestDefaultConnectionReuseS
context.setAttribute(ExecutionContext.HTTP_CONNECTION, mockConnection);
}
+ @Override
public void tearDown() {
mockConnection = null;
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderElementIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderElementIterator.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderElementIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicHeaderElementIterator.java Sat May 7 20:56:39 2011
@@ -57,12 +57,12 @@ public class TestBasicHeaderElementItera
new BasicHeaderIterator(headers, "Name"));
assertTrue(hei.hasNext());
- HeaderElement elem = (HeaderElement) hei.next();
+ HeaderElement elem = hei.next();
assertEquals("The two header values must be equal",
"value0", elem.getName());
assertTrue(hei.hasNext());
- elem = (HeaderElement)hei.next();
+ elem = hei.next();
assertEquals("The two header values must be equal",
"value1", elem.getName());
@@ -92,19 +92,19 @@ public class TestBasicHeaderElementItera
HeaderElementIterator hei =
new BasicHeaderElementIterator(new BasicHeaderIterator(headers, "Name"));
- HeaderElement elem = (HeaderElement)hei.next();
+ HeaderElement elem = hei.next();
assertEquals("The two header values must be equal",
"value0", elem.getName());
- elem = (HeaderElement)hei.next();
+ elem = hei.next();
assertEquals("The two header values must be equal",
"value1", elem.getName());
- elem = (HeaderElement)hei.next();
+ elem = hei.next();
assertEquals("The two header values must be equal",
"cookie1", elem.getName());
assertEquals("The two header values must be equal",
"1", elem.getValue());
- elem = (HeaderElement)hei.next();
+ elem = hei.next();
assertEquals("The two header values must be equal",
"cookie2", elem.getName());
assertEquals("The two header values must be equal",
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestHeaderGroup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestHeaderGroup.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestHeaderGroup.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestHeaderGroup.java Sat May 7 20:56:39 2011
@@ -136,7 +136,7 @@ public class TestHeaderGroup extends Tes
public void testIterator() {
HeaderGroup headergroup = new HeaderGroup();
- Iterator i = headergroup.iterator();
+ Iterator<Header> i = headergroup.iterator();
assertNotNull(i);
assertFalse(i.hasNext());
}
@@ -147,7 +147,7 @@ public class TestHeaderGroup extends Tes
Header header2 = new BasicHeader("name", "value2");
Header header3 = new BasicHeader("name", "value3");
headergroup.setHeaders(new Header[] { header1, header2, header3 });
- Iterator i = headergroup.iterator();
+ Iterator<Header> i = headergroup.iterator();
assertNotNull(i);
assertTrue(i.hasNext());
i.next();
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/HttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/HttpServer.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/HttpServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/HttpServer.java Sat May 7 20:56:39 2011
@@ -182,6 +182,7 @@ public class HttpServer {
this.conn = conn;
}
+ @Override
public void run() {
HttpContext context = new BasicHttpContext(null);
try {
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/TimeoutByteArrayInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/TimeoutByteArrayInputStream.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/TimeoutByteArrayInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/mockup/TimeoutByteArrayInputStream.java Sat May 7 20:56:39 2011
@@ -53,6 +53,7 @@ public class TimeoutByteArrayInputStream
this(buf, 0, buf.length);
}
+ @Override
public int read() throws IOException {
if (this.pos < this.count) {
return -1;
@@ -65,6 +66,7 @@ public class TimeoutByteArrayInputStream
}
}
+ @Override
public int read(byte b[], int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
@@ -97,6 +99,7 @@ public class TimeoutByteArrayInputStream
return len;
}
+ @Override
public long skip(long n) {
if (this.pos + n > this.count) {
n = this.count - this.pos;
@@ -108,10 +111,12 @@ public class TimeoutByteArrayInputStream
return n;
}
+ @Override
public int available() {
return this.count - this.pos;
}
+ @Override
public boolean markSupported() {
return false;
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestBasicHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestBasicHttpParams.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestBasicHttpParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestBasicHttpParams.java Sat May 7 20:56:39 2011
@@ -58,16 +58,16 @@ public class TestBasicHttpParams extends
public void testgetNames() {
BasicHttpParams params = new BasicHttpParams();
- Set nameSet = params.getNames();
+ Set<String> nameSet = params.getNames();
assertTrue(nameSet.isEmpty());
params.setBooleanParameter("true", true);
assertTrue(nameSet.isEmpty()); // Still empty, as it is a snapshot
nameSet = params.getNames();
assertFalse(nameSet.isEmpty());
assertEquals(1, nameSet.size());
- Iterator iterator = nameSet.iterator(); // refetch, as iterator is a snapshot
+ Iterator<String> iterator = nameSet.iterator(); // refetch, as iterator is a snapshot
assertTrue("Iterator has an entry",iterator.hasNext());
- String entry = (String) iterator.next();
+ String entry = iterator.next();
// Note: Java 1.3 requires JUnit 3.8.1 which does not have assertTrue(Boolean)
assertTrue(((Boolean) params.getParameter(entry)).booleanValue());
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestDefaultedHttpParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestDefaultedHttpParams.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestDefaultedHttpParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/params/TestDefaultedHttpParams.java Sat May 7 20:56:39 2011
@@ -76,11 +76,11 @@ public class TestDefaultedHttpParams ext
public void testgetNames() {
DefaultedHttpParams params = new DefaultedHttpParams(addParams("local"), addParams("default"));
- Set nameSet = params.getNames();
+ Set<String> nameSet = params.getNames();
assertEquals(3, nameSet.size());
- Set localnameSet = params.getLocalNames();
+ Set<String> localnameSet = params.getLocalNames();
assertEquals(2, localnameSet.size());
- Set defaultnameSet = params.getDefaultNames();
+ Set<String> defaultnameSet = params.getDefaultNames();
assertEquals(2, defaultnameSet.size());
params.setParameter("new", null);
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestBasicHttpProcessor.java Sat May 7 20:56:39 2011
@@ -126,12 +126,6 @@ public class TestBasicHttpProcessor exte
assertEquals(1, instance.getRequestInterceptorCount());
instance.removeRequestInterceptorByClass(itcp3.getClass());
assertEquals(0, instance.getRequestInterceptorCount());
-
- // remove a not present class
- instance.addRequestInterceptor(itcp1);
- instance.addRequestInterceptor(itcp2);
- instance.removeRequestInterceptorByClass(Integer.class);
- assertEquals(2, instance.getRequestInterceptorCount());
}
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestHandlerRegistry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestHandlerRegistry.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestHandlerRegistry.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestHandlerRegistry.java Sat May 7 20:56:39 2011
@@ -81,7 +81,7 @@ public class TestHttpRequestHandlerRegis
h = registry.lookup("/h1");
assertNull(h);
- Map map = new HashMap();
+ Map<String, Object> map = new HashMap<String, Object>();
map.put("/a1", h1);
map.put("/a2", h2);
map.put("/a3", h3);
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpServiceAndExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpServiceAndExecutor.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpServiceAndExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpServiceAndExecutor.java Sat May 7 20:56:39 2011
@@ -75,11 +75,13 @@ public class TestHttpServiceAndExecutor
private HttpServer server;
private HttpClient client;
+ @Override
protected void setUp() throws Exception {
this.server = new HttpServer();
this.client = new HttpClient();
}
+ @Override
protected void tearDown() throws Exception {
this.server.shutdown();
}
@@ -94,7 +96,7 @@ public class TestHttpServiceAndExecutor
Random rnd = new Random();
// Prepare some random data
- final List testData = new ArrayList(reqNo);
+ final List<byte[]> testData = new ArrayList<byte[]>(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(5000);
byte[] data = new byte[size];
@@ -115,7 +117,7 @@ public class TestHttpServiceAndExecutor
s = s.substring(2);
}
int index = Integer.parseInt(s);
- byte[] data = (byte []) testData.get(index);
+ byte[] data = testData.get(index);
ByteArrayEntity entity = new ByteArrayEntity(data);
response.setEntity(entity);
}
@@ -137,7 +139,7 @@ public class TestHttpServiceAndExecutor
BasicHttpRequest get = new BasicHttpRequest("GET", "/?" + r);
HttpResponse response = this.client.execute(get, host, conn);
byte[] received = EntityUtils.toByteArray(response.getEntity());
- byte[] expected = (byte[]) testData.get(r);
+ byte[] expected = testData.get(r);
assertEquals(expected.length, received.length);
for (int i = 0; i < expected.length; i++) {
@@ -170,7 +172,7 @@ public class TestHttpServiceAndExecutor
Random rnd = new Random();
// Prepare some random data
- List testData = new ArrayList(reqNo);
+ List<byte[]> testData = new ArrayList<byte[]>(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(5000);
byte[] data = new byte[size];
@@ -214,13 +216,13 @@ public class TestHttpServiceAndExecutor
}
BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
- byte[] data = (byte[]) testData.get(r);
+ byte[] data = testData.get(r);
ByteArrayEntity outgoing = new ByteArrayEntity(data);
post.setEntity(outgoing);
HttpResponse response = this.client.execute(post, host, conn);
byte[] received = EntityUtils.toByteArray(response.getEntity());
- byte[] expected = (byte[]) testData.get(r);
+ byte[] expected = testData.get(r);
assertEquals(expected.length, received.length);
for (int i = 0; i < expected.length; i++) {
@@ -252,7 +254,7 @@ public class TestHttpServiceAndExecutor
Random rnd = new Random();
// Prepare some random data
- List testData = new ArrayList(reqNo);
+ List<byte[]> testData = new ArrayList<byte[]>(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(20000);
byte[] data = new byte[size];
@@ -296,14 +298,14 @@ public class TestHttpServiceAndExecutor
}
BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
- byte[] data = (byte[]) testData.get(r);
+ byte[] data = testData.get(r);
ByteArrayEntity outgoing = new ByteArrayEntity(data);
outgoing.setChunked(true);
post.setEntity(outgoing);
HttpResponse response = this.client.execute(post, host, conn);
byte[] received = EntityUtils.toByteArray(response.getEntity());
- byte[] expected = (byte[]) testData.get(r);
+ byte[] expected = testData.get(r);
assertEquals(expected.length, received.length);
for (int i = 0; i < expected.length; i++) {
@@ -333,7 +335,7 @@ public class TestHttpServiceAndExecutor
Random rnd = new Random();
// Prepare some random data
- List testData = new ArrayList(reqNo);
+ List<byte[]> testData = new ArrayList<byte[]>(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(5000);
byte[] data = new byte[size];
@@ -381,14 +383,14 @@ public class TestHttpServiceAndExecutor
}
BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
- byte[] data = (byte[]) testData.get(r);
+ byte[] data = testData.get(r);
ByteArrayEntity outgoing = new ByteArrayEntity(data);
post.setEntity(outgoing);
HttpResponse response = this.client.execute(post, host, conn);
assertEquals(HttpVersion.HTTP_1_0, response.getStatusLine().getProtocolVersion());
byte[] received = EntityUtils.toByteArray(response.getEntity());
- byte[] expected = (byte[]) testData.get(r);
+ byte[] expected = testData.get(r);
assertEquals(expected.length, received.length);
for (int i = 0; i < expected.length; i++) {
@@ -420,7 +422,7 @@ public class TestHttpServiceAndExecutor
Random rnd = new Random();
// Prepare some random data
- List testData = new ArrayList(reqNo);
+ List<byte[]> testData = new ArrayList<byte[]>(reqNo);
for (int i = 0; i < reqNo; i++) {
int size = rnd.nextInt(5000);
byte[] data = new byte[size];
@@ -467,14 +469,14 @@ public class TestHttpServiceAndExecutor
}
BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
- byte[] data = (byte[]) testData.get(r);
+ byte[] data = testData.get(r);
ByteArrayEntity outgoing = new ByteArrayEntity(data);
outgoing.setChunked(true);
post.setEntity(outgoing);
HttpResponse response = this.client.execute(post, host, conn);
byte[] received = EntityUtils.toByteArray(response.getEntity());
- byte[] expected = (byte[]) testData.get(r);
+ byte[] expected = testData.get(r);
assertEquals(expected.length, received.length);
for (int i = 0; i < expected.length; i++) {
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestEntityUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestEntityUtils.java?rev=1100625&r1=1100624&r2=1100625&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestEntityUtils.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/util/TestEntityUtils.java Sat May 7 20:56:39 2011
@@ -256,6 +256,7 @@ public class TestEntityUtils extends Tes
*
* @return <code>null</code>
*/
+ @Override
public InputStream getContent() {
return null;
}