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 2005/07/28 22:28:02 UTC
svn commit: r225874 - in
/jakarta/httpclient/trunk/http-common/src/test/org/apache/http: ./ impl/ io/
Author: olegk
Date: Thu Jul 28 13:27:46 2005
New Revision: 225874
URL: http://svn.apache.org/viewcvs?rev=225874&view=rev
Log:
Eliminated unused local variables
Modified:
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeader.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpHost.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpVersion.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestNameValuePair.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestRequestLine.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestStatusLine.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultResponseConsumedWatcher.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java
jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeader.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeader.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeader.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeader.java Thu Jul 28 13:27:46 2005
@@ -62,7 +62,7 @@
public void testInvalidName() {
try {
- Header header = new Header(null, null);
+ new Header(null, null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected
@@ -118,14 +118,14 @@
assertEquals("value", header2.getValue());
try {
- Header header3 = Header.parse(" whatever ");
+ Header.parse(" whatever ");
fail("ProtocolException should have been thrown");
} catch (ProtocolException ex) {
// expected
}
try {
- Header header3 = Header.parse(null);
+ Header.parse(null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
// expected
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHeaderElement.java Thu Jul 28 13:27:46 2005
@@ -91,7 +91,7 @@
public void testInvalidName() {
try {
- HeaderElement element = new HeaderElement(null, null, null);
+ new HeaderElement(null, null, null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpHost.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpHost.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpHost.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpHost.java Thu Jul 28 13:27:46 2005
@@ -88,13 +88,13 @@
assertEquals(8080, host4.getPort());
assertEquals(http, host4.getProtocol());
try {
- HttpHost host = new HttpHost(null, -1, null);
+ new HttpHost(null, -1, null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected
}
try {
- HttpHost host = new HttpHost("somehost", -1, null);
+ new HttpHost("somehost", -1, null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpVersion.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpVersion.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpVersion.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestHttpVersion.java Thu Jul 28 13:27:46 2005
@@ -56,13 +56,13 @@
public void testHttpVersionInvalidConstructorInput() throws Exception {
try {
- HttpVersion ver = new HttpVersion(-1, -1);
+ new HttpVersion(-1, -1);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) {
// expected
}
try {
- HttpVersion ver = new HttpVersion(0, -1);
+ new HttpVersion(0, -1);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) {
// expected
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestNameValuePair.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestNameValuePair.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestNameValuePair.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestNameValuePair.java Thu Jul 28 13:27:46 2005
@@ -61,7 +61,7 @@
public void testInvalidName() {
try {
- NameValuePair param = new NameValuePair(null, null);
+ new NameValuePair(null, null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestRequestLine.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestRequestLine.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestRequestLine.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestRequestLine.java Thu Jul 28 13:27:46 2005
@@ -65,15 +65,15 @@
public void testConstructorInvalidInput() {
try {
- RequestLine requestline = new RequestLine(null, "/stuff", HttpVersion.HTTP_1_1);
+ new RequestLine(null, "/stuff", HttpVersion.HTTP_1_1);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) { /* expected */ }
try {
- RequestLine requestline = new RequestLine("GEt", null, HttpVersion.HTTP_1_1);
+ new RequestLine("GEt", null, HttpVersion.HTTP_1_1);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) { /* expected */ }
try {
- RequestLine requestline = new RequestLine("GET", "/stuff", (HttpVersion)null);
+ new RequestLine("GET", "/stuff", (HttpVersion)null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) { /* expected */ }
}
@@ -101,21 +101,20 @@
}
public void testFailure() throws Exception {
- RequestLine requestline = null;
try {
- requestline = RequestLine.parse("GET /stuff");
+ RequestLine.parse("GET /stuff");
fail();
} catch (HttpException e) { /* expected */ }
try {
- requestline = RequestLine.parse("GET/stuff HTTP/1.1");
+ RequestLine.parse("GET/stuff HTTP/1.1");
fail();
} catch (HttpException e) { /* expected */ }
}
public void testNullInput() throws Exception {
try {
- RequestLine requestline = RequestLine.parse(null);
+ RequestLine.parse(null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) { /* expected */ }
}
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestStatusLine.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestStatusLine.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestStatusLine.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/TestStatusLine.java Thu Jul 28 13:27:46 2005
@@ -70,11 +70,11 @@
public void testConstructorInvalidInput() {
try {
- StatusLine statusline = new StatusLine(null, HttpStatus.SC_OK, "OK");
+ new StatusLine(null, HttpStatus.SC_OK, "OK");
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) { /* expected */ }
try {
- StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, -1, "OK");
+ new StatusLine(HttpVersion.HTTP_1_1, -1, "OK");
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) { /* expected */ }
}
@@ -139,31 +139,29 @@
}
public void testFailure() throws Exception {
- StatusLine statusLine = null;
try {
- statusLine = StatusLine.parse("xxx 200 OK");
+ StatusLine.parse("xxx 200 OK");
fail();
} catch (HttpException e) { /* expected */ }
try {
- statusLine = StatusLine.parse("HTTP/1.1 xxx OK");
+ StatusLine.parse("HTTP/1.1 xxx OK");
fail();
} catch (HttpException e) { /* expected */ }
try {
- statusLine = StatusLine.parse("HTTP/1.1 ");
+ StatusLine.parse("HTTP/1.1 ");
fail();
} catch (HttpException e) { /* expected */ }
try {
- statusLine = StatusLine.parse("HTTP/1.1");
+ StatusLine.parse("HTTP/1.1");
fail();
} catch (HttpException e) { /* expected */ }
}
public void testNullInput() throws Exception {
- StatusLine statusLine = null;
try {
- statusLine = StatusLine.parse(null);
+ StatusLine.parse(null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) { /* expected */ }
}
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultResponseConsumedWatcher.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultResponseConsumedWatcher.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultResponseConsumedWatcher.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestDefaultResponseConsumedWatcher.java Thu Jul 28 13:27:46 2005
@@ -63,13 +63,13 @@
public void testIllegalResponseArg() throws Exception {
try {
- ResponseConsumedWatcher watcher = new DefaultResponseConsumedWatcher(null, null);
+ new DefaultResponseConsumedWatcher(null, null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
// expected
}
try {
- ResponseConsumedWatcher watcher = new DefaultResponseConsumedWatcher(
+ new DefaultResponseConsumedWatcher(
new HttpConnectionMockup(), null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
@@ -96,8 +96,7 @@
entity.setContent(new AutoCloseInputStream(entity.getContent(), watcher));
assertTrue(conn.isOpen());
- int b;
- while ((b = entity.getContent().read()) != -1) {}
+ while (entity.getContent().read() != -1) {}
assertFalse(conn.isOpen());
}
@@ -120,8 +119,7 @@
entity.setContent(new AutoCloseInputStream(entity.getContent(), watcher));
assertTrue(conn.isOpen());
- int b;
- while ((b = entity.getContent().read()) != -1) {}
+ while (entity.getContent().read() != -1) {}
assertTrue(conn.isOpen());
}
}
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/impl/TestNIOHttpTransmitterAndReceiver.java Thu Jul 28 13:27:46 2005
@@ -35,8 +35,6 @@
import org.apache.http.impl.io.NIOHttpDataReceiver;
import org.apache.http.impl.io.NIOHttpDataTransmitter;
-import org.apache.http.io.HttpDataReceiver;
-import org.apache.http.io.HttpDataTransmitter;
import org.apache.http.mockup.HttpDataReceiverMockup;
import org.apache.http.mockup.HttpDataTransmitterMockup;
import org.apache.http.params.HttpParams;
@@ -72,23 +70,19 @@
public void testInit() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
- HttpDataTransmitter transmitter1 =
- new HttpDataTransmitterMockup(Channels.newChannel(out), -10);
- HttpDataTransmitter transmitter2 =
- new HttpDataTransmitterMockup(Channels.newChannel(out), 200000000);
+ new HttpDataTransmitterMockup(Channels.newChannel(out), -10);
+ new HttpDataTransmitterMockup(Channels.newChannel(out), 200000000);
try {
- HttpDataTransmitter transmitter3 = new HttpDataTransmitterMockup(null, 1024);
+ new HttpDataTransmitterMockup(null, 1024);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected
}
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
- HttpDataReceiver receiver1 =
- new HttpDataReceiverMockup(Channels.newChannel(in), -10);
- HttpDataReceiver receiver2 =
- new HttpDataReceiverMockup (Channels.newChannel(in), 200000000);
+ new HttpDataReceiverMockup(Channels.newChannel(in), -10);
+ new HttpDataReceiverMockup (Channels.newChannel(in), 200000000);
try {
- HttpDataReceiver receiver3 = new HttpDataReceiverMockup((ReadableByteChannel)null, 1024);
+ new HttpDataReceiverMockup((ReadableByteChannel)null, 1024);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected
@@ -252,7 +246,6 @@
assertEquals(0, receiver.read(null));
byte[] in = new byte[40];
- int noRead = 0;
off = 0;
remaining = in.length;
while (remaining > 0) {
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestChunkCoding.java Thu Jul 28 13:27:46 2005
@@ -129,7 +129,7 @@
in.close();
- String result = EncodingUtil.getString(out.toByteArray(), CONTENT_CHARSET);
+ EncodingUtil.getString(out.toByteArray(), CONTENT_CHARSET);
Header[] footers = in.getFooters();
assertNotNull(footers);
assertEquals(2, footers.length);
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataInputStream.java Thu Jul 28 13:27:46 2005
@@ -60,9 +60,9 @@
public void testConstructor() throws Exception {
HttpDataReceiver receiver = new HttpDataReceiverMockup(new byte[] {});
- HttpDataInputStream instream1 = new HttpDataInputStream(receiver);
+ new HttpDataInputStream(receiver);
try {
- HttpDataInputStream instream2 = new HttpDataInputStream(null);
+ new HttpDataInputStream(null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected
Modified: jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java?rev=225874&r1=225873&r2=225874&view=diff
==============================================================================
--- jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java (original)
+++ jakarta/httpclient/trunk/http-common/src/test/org/apache/http/io/TestHttpDataOutputStream.java Thu Jul 28 13:27:46 2005
@@ -60,9 +60,9 @@
public void testConstructor() throws Exception {
HttpDataTransmitterMockup transmitter = new HttpDataTransmitterMockup();
- HttpDataOutputStream outstream1 = new HttpDataOutputStream(transmitter);
+ new HttpDataOutputStream(transmitter);
try {
- HttpDataOutputStream outstream2 = new HttpDataOutputStream(null);
+ new HttpDataOutputStream(null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
//expected