From 8c08ae3178074e42c018b4175f10b8a0916fd3fc Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Fri, 1 Feb 2008 21:05:31 +0000 Subject: [PATCH] Fixup odd tab usage git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@617645 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/examples/client/ClientFormLogin.java | 6 +- .../client/ClientMultiThreadedExecution.java | 2 +- .../http/conn/ConnectTimeoutException.java | 2 +- .../org/apache/http/cookie/CookieOrigin.java | 46 +++++------ .../DefaultHttpRequestRetryHandler.java | 2 +- .../apache/http/impl/cookie/DateUtils.java | 12 +-- .../http/client/protocol/TestRedirects.java | 8 +- .../http/client/protocol/TestUriEscapes.java | 78 +++++++++---------- .../java/org/apache/http/conn/TestScheme.java | 58 +++++++------- .../client/TestBasicCredentialsProvider.java | 4 +- .../impl/cookie/TestCookieBestMatchSpec.java | 12 +-- .../http/impl/cookie/TestDateUtils.java | 60 +++++++------- 12 files changed, 145 insertions(+), 145 deletions(-) diff --git a/module-client/src/examples/org/apache/http/examples/client/ClientFormLogin.java b/module-client/src/examples/org/apache/http/examples/client/ClientFormLogin.java index 4317b82cf..6182d9381 100644 --- a/module-client/src/examples/org/apache/http/examples/client/ClientFormLogin.java +++ b/module-client/src/examples/org/apache/http/examples/client/ClientFormLogin.java @@ -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"), diff --git a/module-client/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java b/module-client/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java index 6e8aa7d41..f00d4a6ac 100644 --- a/module-client/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java +++ b/module-client/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java @@ -100,7 +100,7 @@ public class ClientMultiThreadedExecution { /** * A thread that performs a GET. - */ + */ static class GetThread extends Thread { private HttpClient httpClient; diff --git a/module-client/src/main/java/org/apache/http/conn/ConnectTimeoutException.java b/module-client/src/main/java/org/apache/http/conn/ConnectTimeoutException.java index 5f045c012..bca999937 100644 --- a/module-client/src/main/java/org/apache/http/conn/ConnectTimeoutException.java +++ b/module-client/src/main/java/org/apache/http/conn/ConnectTimeoutException.java @@ -44,7 +44,7 @@ import java.io.InterruptedIOException; public class ConnectTimeoutException extends InterruptedIOException { private static final long serialVersionUID = -4816682903149535989L; - + /** * Creates a ConnectTimeoutException with a null detail message. */ diff --git a/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java b/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java index 571db4425..4ac5f36c7 100644 --- a/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java +++ b/module-client/src/main/java/org/apache/http/cookie/CookieOrigin.java @@ -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() { diff --git a/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java b/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java index 80d5d381b..06b625e5a 100644 --- a/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java +++ b/module-client/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java @@ -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 */ diff --git a/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java b/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java index 4de956e5c..5a1fa3012 100644 --- a/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java +++ b/module-client/src/main/java/org/apache/http/impl/cookie/DateUtils.java @@ -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); diff --git a/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java b/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java index b317aac2a..4833f9976 100644 --- a/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java +++ b/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java @@ -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); diff --git a/module-client/src/test/java/org/apache/http/client/protocol/TestUriEscapes.java b/module-client/src/test/java/org/apache/http/client/protocol/TestUriEscapes.java index 10c0f7c6a..029035145 100644 --- a/module-client/src/test/java/org/apache/http/client/protocol/TestUriEscapes.java +++ b/module-client/src/test/java/org/apache/http/client/protocol/TestUriEscapes.java @@ -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); } } diff --git a/module-client/src/test/java/org/apache/http/conn/TestScheme.java b/module-client/src/test/java/org/apache/http/conn/TestScheme.java index 68a701831..021def71e 100644 --- a/module-client/src/test/java/org/apache/http/conn/TestScheme.java +++ b/module-client/src/test/java/org/apache/http/conn/TestScheme.java @@ -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 } } diff --git a/module-client/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java b/module-client/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java index 2288e5c94..c96459bbf 100644 --- a/module-client/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java +++ b/module-client/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java @@ -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)); } diff --git a/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java b/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java index b3e7956bd..93722f9a0 100644 --- a/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java +++ b/module-client/src/test/java/org/apache/http/impl/cookie/TestCookieBestMatchSpec.java @@ -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 Oleg Kalnichevski * - * @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()); } diff --git a/module-client/src/test/java/org/apache/http/impl/cookie/TestDateUtils.java b/module-client/src/test/java/org/apache/http/impl/cookie/TestDateUtils.java index ac83a520d..043db3bb3 100644 --- a/module-client/src/test/java/org/apache/http/impl/cookie/TestDateUtils.java +++ b/module-client/src/test/java/org/apache/http/impl/cookie/TestDateUtils.java @@ -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 {