Fixup odd tab usage

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@617645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2008-02-01 21:05:31 +00:00
parent 13d6dc3da4
commit 8c08ae3178
12 changed files with 145 additions and 145 deletions

View File

@ -76,9 +76,9 @@ public class ClientFormLogin {
}
HttpPost httpost = new HttpPost("https://portal.sun.com/amserver/UI/Login?" +
"org=self_registered_users&" +
"goto=/portal/dt&" +
"gotoOnFail=/portal/dt?error=true");
"org=self_registered_users&" +
"goto=/portal/dt&" +
"gotoOnFail=/portal/dt?error=true");
NameValuePair[] nvps = new NameValuePair[] {
new BasicNameValuePair("IDToken1", "username"),

View File

@ -100,7 +100,7 @@ public class ClientMultiThreadedExecution {
/**
* A thread that performs a GET.
*/
*/
static class GetThread extends Thread {
private HttpClient httpClient;

View File

@ -44,7 +44,7 @@ import java.io.InterruptedIOException;
public class ConnectTimeoutException extends InterruptedIOException {
private static final long serialVersionUID = -4816682903149535989L;
/**
* Creates a ConnectTimeoutException with a <tt>null</tt> detail message.
*/

View File

@ -40,13 +40,13 @@ package org.apache.http.cookie;
*/
public final class CookieOrigin {
private final String host;
private final int port;
private final String path;
private final boolean secure;
public CookieOrigin(final String host, int port, final String path, boolean secure) {
super();
private final String host;
private final int port;
private final String path;
private final boolean secure;
public CookieOrigin(final String host, int port, final String path, boolean secure) {
super();
if (host == null) {
throw new IllegalArgumentException(
"Host of origin may not be null");
@ -62,31 +62,31 @@ public final class CookieOrigin {
throw new IllegalArgumentException(
"Path of origin may not be null.");
}
this.host = host.toLowerCase();
this.port = port;
this.host = host.toLowerCase();
this.port = port;
if (!path.trim().equals("")) {
this.path = path;
} else {
this.path = "/";
}
this.secure = secure;
}
this.secure = secure;
}
public String getHost() {
return this.host;
}
public String getHost() {
return this.host;
}
public String getPath() {
return this.path;
}
public String getPath() {
return this.path;
}
public int getPort() {
return this.port;
}
public int getPort() {
return this.port;
}
public boolean isSecure() {
return this.secure;
}
public boolean isSecure() {
return this.secure;
}
@Override
public String toString() {

View File

@ -50,7 +50,7 @@ import org.apache.http.protocol.ExecutionContext;
*/
public class DefaultHttpRequestRetryHandler implements HttpRequestRetryHandler {
/** the number of times a method will be retried */
/** the number of times a method will be retried */
private int retryCount;
/** Whether or not methods that have successfully sent their request will be retried */

View File

@ -68,9 +68,9 @@ public final class DateUtils {
public static final String PATTERN_ASCTIME = "EEE MMM d HH:mm:ss yyyy";
private static final String[] DEFAULT_PATTERNS = new String[] {
PATTERN_ASCTIME,
PATTERN_RFC1036,
PATTERN_RFC1123 };
PATTERN_ASCTIME,
PATTERN_RFC1036,
PATTERN_RFC1123 };
private static final Date DEFAULT_TWO_DIGIT_YEAR_START;
@ -138,7 +138,7 @@ public final class DateUtils {
throw new IllegalArgumentException("dateValue is null");
}
if (dateFormats == null) {
dateFormats = DEFAULT_PATTERNS;
dateFormats = DEFAULT_PATTERNS;
}
if (startDate == null) {
startDate = DEFAULT_TWO_DIGIT_YEAR_START;
@ -153,8 +153,8 @@ public final class DateUtils {
}
for (int i = 0; i < dateFormats.length; i++) {
SimpleDateFormat dateParser = DateFormatHolder.formatFor(dateFormats[i]);
dateParser.set2DigitYearStart(startDate);
SimpleDateFormat dateParser = DateFormatHolder.formatFor(dateFormats[i]);
dateParser.set2DigitYearStart(startDate);
try {
return dateParser.parse(dateValue);

View File

@ -91,8 +91,8 @@ public class TestRedirects extends ServerTestBase {
private class BasicRedirectService implements HttpRequestHandler {
private int statuscode = HttpStatus.SC_MOVED_TEMPORARILY;
private String host = null;
private int statuscode = HttpStatus.SC_MOVED_TEMPORARILY;
private String host = null;
private int port;
public BasicRedirectService(final String host, int port, int statuscode) {
@ -100,7 +100,7 @@ public class TestRedirects extends ServerTestBase {
this.host = host;
this.port = port;
if (statuscode > 0) {
this.statuscode = statuscode;
this.statuscode = statuscode;
}
}
@ -117,7 +117,7 @@ public class TestRedirects extends ServerTestBase {
if (uri.equals("/oldlocation/")) {
response.setStatusLine(ver, this.statuscode);
response.addHeader(new BasicHeader("Location",
"http://" + this.host + ":" + this.port + "/newlocation/"));
"http://" + this.host + ":" + this.port + "/newlocation/"));
response.addHeader(new BasicHeader("Connection", "close"));
} else if (uri.equals("/newlocation/")) {
response.setStatusLine(ver, HttpStatus.SC_OK);

View File

@ -1,7 +1,7 @@
/*
* $HeadURL:$
* $Revision:$
* $Date:$
* $HeadURL$
* $Revision$
* $Date$
* ====================================================================
*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -48,7 +48,7 @@ import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpRequestHandler;
public class TestUriEscapes extends ServerTestBase {
public TestUriEscapes(final String testName) throws IOException {
super(testName);
}
@ -78,80 +78,80 @@ public class TestUriEscapes extends ServerTestBase {
}
public String getRequestedUri() {
return requestedUri;
return requestedUri;
}
}
private void doTest(String uri, boolean relative) throws Exception {
int port = this.localServer.getServicePort();
String host = "localhost";
UriListeningService listener = new UriListeningService();
this.localServer.register("*", listener);
int port = this.localServer.getServicePort();
String host = "localhost";
UriListeningService listener = new UriListeningService();
this.localServer.register("*", listener);
DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response;
if(!relative) {
String request = "http://" + host + ":" + port + uri;
HttpGet httpget = new HttpGet(request);
response = client.execute(httpget);
response.getEntity().consumeContent();
} else {
HttpHost target = new HttpHost(host, port);
HttpGet httpget = new HttpGet(uri);
response = client.execute(target, httpget);
response.getEntity().consumeContent();
}
String request = "http://" + host + ":" + port + uri;
HttpGet httpget = new HttpGet(request);
response = client.execute(httpget);
response.getEntity().consumeContent();
} else {
HttpHost target = new HttpHost(host, port);
HttpGet httpget = new HttpGet(uri);
response = client.execute(target, httpget);
response.getEntity().consumeContent();
}
assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
assertEquals(uri, listener.getRequestedUri());
}
public void testEscapedAmpersandInQueryAbsolute() throws Exception {
doTest("/path/a=b&c=%26d", false);
doTest("/path/a=b&c=%26d", false);
}
public void testEscapedAmpersandInQueryRelative() throws Exception {
doTest("/path/a=b&c=%26d", true);
doTest("/path/a=b&c=%26d", true);
}
public void testPlusInPathAbsolute() throws Exception {
doTest("/path+go", false);
}
doTest("/path+go", false);
}
public void testPlusInPathRelative() throws Exception {
doTest("/path+go", true);
}
doTest("/path+go", true);
}
public void testEscapedSpaceInPathAbsolute() throws Exception {
doTest("/path%20go?a=b&c=d", false);
}
doTest("/path%20go?a=b&c=d", false);
}
public void testEscapedSpaceInPathRelative() throws Exception {
doTest("/path%20go?a=b&c=d", true);
}
doTest("/path%20go?a=b&c=d", true);
}
public void testEscapedAmpersandInPathAbsolute() throws Exception {
doTest("/this%26that?a=b&c=d", false);
}
doTest("/this%26that?a=b&c=d", false);
}
public void testEscapedAmpersandInPathRelative() throws Exception {
doTest("/this%26that?a=b&c=d", true);
}
doTest("/this%26that?a=b&c=d", true);
}
public void testEscapedSpaceInQueryAbsolute() throws Exception {
doTest("/path?a=b&c=d%20e", false);
doTest("/path?a=b&c=d%20e", false);
}
public void testEscapedSpaceInQueryRelative() throws Exception {
doTest("/path?a=b&c=d%20e", true);
doTest("/path?a=b&c=d%20e", true);
}
public void testPlusInQueryAbsolute() throws Exception {
doTest("/path?a=b&c=d+e", false);
doTest("/path?a=b&c=d+e", false);
}
public void testPlusInQueryRelative() throws Exception {
doTest("/path?a=b&c=d+e", true);
doTest("/path?a=b&c=d+e", true);
}
}

View File

@ -126,24 +126,24 @@ public class TestScheme extends TestCase {
HttpHost host = new HttpHost("www.test.invalid", -1, "http");
HttpHost hosts = new HttpHost("www.test.invalid", -1, "https");
assertNull(schmreg.register(myhttp));
assertNull(schmreg.register(https));
assertSame(myhttp, schmreg.register(http));
assertSame(http, schmreg.getScheme("http"));
assertSame(http, schmreg.getScheme(host));
assertSame(https, schmreg.getScheme("https"));
assertSame(https, schmreg.getScheme(hosts));
assertNull(schmreg.register(myhttp));
assertNull(schmreg.register(https));
assertSame(myhttp, schmreg.register(http));
assertSame(http, schmreg.getScheme("http"));
assertSame(http, schmreg.getScheme(host));
assertSame(https, schmreg.getScheme("https"));
assertSame(https, schmreg.getScheme(hosts));
schmreg.unregister("http");
schmreg.unregister("https");
schmreg.unregister("http");
schmreg.unregister("https");
assertNull(schmreg.get("http")); // get() does not throw exception
try {
try {
schmreg.getScheme("http"); // getScheme() does throw exception
fail("IllegalStateException should have been thrown");
} catch (IllegalStateException ex) {
} catch (IllegalStateException ex) {
// expected
}
}
}
@ -160,8 +160,8 @@ public class TestScheme extends TestCase {
("https", SecureSocketFactoryMockup.INSTANCE, 443);
// ("https", SSLSocketFactory.getSocketFactory(), 443);
schmreg.register(http);
schmreg.register(https);
schmreg.register(http);
schmreg.register(https);
names = schmreg.getSchemeNames();
assertNotNull(names);
@ -198,34 +198,34 @@ public class TestScheme extends TestCase {
public void testIllegalRegisterUnregister() {
SchemeRegistry schmreg = new SchemeRegistry();
try {
schmreg.register(null);
fail("IllegalArgumentException should have been thrown");
schmreg.register(null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
// expected
// expected
}
try {
schmreg.unregister(null);
fail("IllegalArgumentException should have been thrown");
schmreg.unregister(null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
// expected
// expected
}
try {
schmreg.get(null);
fail("IllegalArgumentException should have been thrown");
schmreg.get(null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
// expected
// expected
}
try {
schmreg.getScheme((String)null);
fail("IllegalArgumentException should have been thrown");
schmreg.getScheme((String)null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
// expected
// expected
}
try {
schmreg.getScheme((HttpHost)null);
fail("IllegalArgumentException should have been thrown");
schmreg.getScheme((HttpHost)null);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException ex) {
// expected
// expected
}
}

View File

@ -98,8 +98,8 @@ public class TestBasicCredentialsProvider extends TestCase {
public void testBasicCredentialsProviderDefaultCredentials() {
BasicCredentialsProvider state = new BasicCredentialsProvider();
state.setCredentials(AuthScope.ANY, CREDS1);
state.setCredentials(SCOPE2, CREDS2);
state.setCredentials(AuthScope.ANY, CREDS1);
state.setCredentials(SCOPE2, CREDS2);
assertEquals(CREDS1, state.getCredentials(BOGUS));
}

View File

@ -1,7 +1,7 @@
/*
* $HeadURL:$
* $Revision:$
* $Date:$
* $HeadURL$
* $Revision$
* $Date$
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -50,7 +50,7 @@ import org.apache.http.message.BasicHeader;
*
* @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
*
* @version $Revision:$
* @version $Revision$
*/
public class TestCookieBestMatchSpec extends TestCase {
@ -218,8 +218,8 @@ public class TestCookieBestMatchSpec extends TestCase {
Header header = headers.get(0);
assertEquals("$Version=1; name1=\"value1\"; $Path=\"/\"; $Domain=\".domain.com\"; " +
"name2=\"value2\"; $Path=\"/\"; $Domain=\".domain.com\"",
header.getValue());
"name2=\"value2\"; $Path=\"/\"; $Domain=\".domain.com\"",
header.getValue());
}

View File

@ -65,41 +65,41 @@ public class TestDateUtils extends TestCase {
calendar.set(Calendar.MILLISECOND, 0);
Date date1 = calendar.getTime();
String[] formats = new String[] {
DateUtils.PATTERN_RFC1123
};
Date date2 = DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", formats, null);
assertEquals(date1, date2);
date2 = DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", formats);
assertEquals(date1, date2);
date2 = DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT");
assertEquals(date1, date2);
String[] formats = new String[] {
DateUtils.PATTERN_RFC1123
};
Date date2 = DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", formats, null);
assertEquals(date1, date2);
date2 = DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", formats);
assertEquals(date1, date2);
date2 = DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT");
assertEquals(date1, date2);
}
public void testInvalidInput() throws Exception {
try {
DateUtils.parseDate(null, null, null);
DateUtils.parseDate(null, null, null);
fail("IllegalArgumentException should habe been thrown");
} catch (IllegalArgumentException ex) {
// expected
// expected
}
try {
DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", new String[] {}, null);
DateUtils.parseDate("Fri, 14 Oct 2005 00:00:00 GMT", new String[] {}, null);
fail("DateParseException should habe been thrown");
} catch (DateParseException ex) {
// expected
// expected
}
try {
DateUtils.formatDate(null);
DateUtils.formatDate(null);
fail("IllegalArgumentException should habe been thrown");
} catch (IllegalArgumentException ex) {
// expected
// expected
}
try {
DateUtils.formatDate(new Date(), null);
DateUtils.formatDate(new Date(), null);
fail("IllegalArgumentException should habe been thrown");
} catch (IllegalArgumentException ex) {
// expected
// expected
}
}
@ -110,11 +110,11 @@ public class TestDateUtils extends TestCase {
calendar.set(Calendar.MILLISECOND, 0);
Date date1 = calendar.getTime();
String[] formats = new String[] {
DateUtils.PATTERN_RFC1036
};
Date date2 = DateUtils.parseDate("Friday, 14-Oct-05 00:00:00 GMT", formats, null);
assertEquals(date1, date2);
String[] formats = new String[] {
DateUtils.PATTERN_RFC1036
};
Date date2 = DateUtils.parseDate("Friday, 14-Oct-05 00:00:00 GMT", formats, null);
assertEquals(date1, date2);
calendar.set(1900, Calendar.JANUARY, 0, 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
@ -123,9 +123,9 @@ public class TestDateUtils extends TestCase {
calendar.set(1905, Calendar.OCTOBER, 14, 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
date1 = calendar.getTime();
date2 = DateUtils.parseDate("Friday, 14-Oct-05 00:00:00 GMT", formats, startDate);
assertEquals(date1, date2);
date2 = DateUtils.parseDate("Friday, 14-Oct-05 00:00:00 GMT", formats, startDate);
assertEquals(date1, date2);
}
public void testParseQuotedDate() throws Exception {
@ -135,11 +135,11 @@ public class TestDateUtils extends TestCase {
calendar.set(Calendar.MILLISECOND, 0);
Date date1 = calendar.getTime();
String[] formats = new String[] {
DateUtils.PATTERN_RFC1123
};
Date date2 = DateUtils.parseDate("'Fri, 14 Oct 2005 00:00:00 GMT'", formats);
assertEquals(date1, date2);
String[] formats = new String[] {
DateUtils.PATTERN_RFC1123
};
Date date2 = DateUtils.parseDate("'Fri, 14 Oct 2005 00:00:00 GMT'", formats);
assertEquals(date1, date2);
}
public void testBasicDateFormat() throws Exception {