Skip to content

Commit

Permalink
tabs -> spaces; removed trailing whilespaces; updated stylecheck defi…
Browse files Browse the repository at this point in the history
…nitions

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk@1425285 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ok2c committed Dec 22, 2012
1 parent bf40506 commit 20da309
Show file tree
Hide file tree
Showing 64 changed files with 210 additions and 211 deletions.
31 changes: 15 additions & 16 deletions hc-checkstyle.xml
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
Expand All @@ -33,12 +33,11 @@
<module name="FileLength">
<property name="max" value="3000" />
</module>
<!--<module name="FileTabCharacter">
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="[ \t]+$"/>
<property name="message" value="Trailing whitespace"/>
</module>
-->
</module>
Expand Up @@ -36,7 +36,7 @@
class BenchmarkConnection extends DefaultBHttpClientConnection {

private final Stats stats;

BenchmarkConnection(int bufsize, final Stats stats) {
super(bufsize);
this.stats = stats;
Expand Down
Expand Up @@ -86,8 +86,8 @@ public BenchmarkWorker(
this.targetHost = targetHost;
this.config = config;
this.httpProcessor = new ImmutableHttpProcessor(
new RequestContent(),
new RequestTargetHost(),
new RequestContent(),
new RequestTargetHost(),
new RequestConnControl(),
new RequestUserAgent("HttpCore-AB/1.1"),
new RequestExpectContinue());
Expand Down Expand Up @@ -122,18 +122,18 @@ public void run() {
try {
resetHeader(request);
if (!conn.isOpen()) {

Socket socket;
if (socketFactory != null) {
socket = socketFactory.createSocket();
} else {
socket = new Socket();
}

int timeout = config.getSocketTimeout();
socket.setSoTimeout(timeout);
socket.connect(new InetSocketAddress(hostname, port), timeout);

conn.bind(socket);
}

Expand Down
Expand Up @@ -33,7 +33,7 @@
class CountingInputStream extends FilterInputStream {

private final Stats stats;

CountingInputStream(final InputStream instream, final Stats stats) {
super(instream);
this.stats = stats;
Expand Down Expand Up @@ -74,5 +74,5 @@ public long skip(long n) throws IOException {
}
return bytesRead;
}

}
Expand Up @@ -33,7 +33,7 @@
class CountingOutputStream extends FilterOutputStream {

private final Stats stats;

CountingOutputStream(final OutputStream outstream, final Stats stats) {
super(outstream);
this.stats = stats;
Expand All @@ -56,5 +56,5 @@ public void write(byte[] b, int off, int len) throws IOException {
this.out.write(b, off, len);
this.stats.incTotalBytesSent(len);
}

}
Expand Up @@ -137,7 +137,7 @@ public void closed(final NHttpServerConnection conn) {
KeyManager[] keymanagers = kmfactory.getKeyManagers();
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(keymanagers, null, null);
connFactory = new SSLNHttpServerConnectionFactory(sslcontext,
connFactory = new SSLNHttpServerConnectionFactory(sslcontext,
null, ConnectionConfig.DEFAULT);
} else {
connFactory = new DefaultNHttpServerConnectionFactory(
Expand Down
Expand Up @@ -353,7 +353,7 @@ public synchronized String toString() {
buffer.append("]");
return buffer.toString();
}

public Socket getSocket() {
Channel channel = this.channel;
if (channel instanceof SocketChannel) {
Expand Down
Expand Up @@ -29,7 +29,7 @@

/**
* @since 4.0
*
*
* @deprecated (4.2)
*/
@Deprecated
Expand Down
Expand Up @@ -36,7 +36,7 @@
* operations on that session.
*
* @since 4.0
*
*
* @deprecated (4.2) use {@link IOSessionImpl}
*/
@Deprecated
Expand Down
Expand Up @@ -33,7 +33,7 @@

/**
* Factory for {@link NHttpMessageParser} instances.
*
*
* @since 4.3
*/
public interface NHttpMessageParserFactory<T extends HttpMessage> {
Expand Down
Expand Up @@ -32,7 +32,7 @@

/**
* Factory for {@link NHttpMessageWriter} instances.
*
*
* @since 4.3
*/
public interface NHttpMessageWriterFactory<T extends HttpMessage> {
Expand Down
Expand Up @@ -36,7 +36,7 @@
* A listener for available data on a non-blocking {@link ConsumingNHttpEntity}.
*
* @since 4.0
*
*
* @deprecated (4.2)
*/
@Deprecated
Expand Down
Expand Up @@ -73,7 +73,7 @@ public class NStringEntity extends AbstractHttpEntity
* Creates a NStringEntity with the specified content and content type.
*
* @param s content to be used. Not {@code null}.
* @param contentType content type to be used. May be {@code null}, in which case
* @param contentType content type to be used. May be {@code null}, in which case
* {@link ContentType#TEXT_PLAIN} is assumed.
*
* @throws IllegalArgumentException if the string parameter is null
Expand Down Expand Up @@ -109,7 +109,7 @@ public NStringEntity(final String s, final ContentType contentType) {
* is {@link HTTP#DEF_CONTENT_CHARSET} is assumed
*
* @throws IllegalArgumentException if the string parameter is null
* @throws UnsupportedCharsetException Thrown when the named charset is not available in
* @throws UnsupportedCharsetException Thrown when the named charset is not available in
* this instance of the Java virtual machine
*/
public NStringEntity(final String s, final String charset)
Expand All @@ -126,7 +126,7 @@ public NStringEntity(final String s, final String charset)
* is {@link HTTP#DEF_CONTENT_CHARSET} is assumed
*
* @throws IllegalArgumentException if the string parameter is null
*
*
* @since 4.2
*/
public NStringEntity(final String s, final Charset charset) {
Expand Down
Expand Up @@ -98,7 +98,7 @@ protected String getRequestPath(final HttpRequest request) {
}
return uriPath;
}

/**
* Looks up a handler matching the given request URI.
*
Expand Down
Expand Up @@ -38,7 +38,7 @@ public interface SocketAccessor {

/**
* Return the underlying socket
*
*
* @return - the underlying Socket, may be <code>null</code>.
*/
Socket getSocket();
Expand Down
Expand Up @@ -588,13 +588,13 @@ public String toString() {
buffer.append("]");
return buffer.toString();
}

public Socket getSocket(){
if (this.session instanceof SocketAccessor){
return ((SocketAccessor) this.session).getSocket();
} else {
return null;
}
if (this.session instanceof SocketAccessor){
return ((SocketAccessor) this.session).getSocket();
} else {
return null;
}
}

private class InternalByteChannel implements ByteChannel {
Expand Down
Expand Up @@ -90,10 +90,10 @@ protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConne

@Test
public void testResponsePrematureTermination() throws Exception {

final CountDownLatch latch = new CountDownLatch(1);
final HttpAsyncResponseProducer responseProducer = new HttpAsyncResponseProducer() {

public HttpResponse generateResponse() {
HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
BasicHttpEntity entity = new BasicHttpEntity();
Expand All @@ -102,25 +102,25 @@ public HttpResponse generateResponse() {
response.setEntity(entity);
return response;
}

public void close() throws IOException {
latch.countDown();
}

public void responseCompleted(final HttpContext context) {
}

public void produceContent(
final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
// suspend output
ioctrl.suspendOutput();
}

public void failed(final Exception ex) {
}

};

UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
registry.register("*", new HttpAsyncRequestHandler<HttpRequest>() {

Expand All @@ -131,13 +131,13 @@ public HttpAsyncRequestConsumer<HttpRequest> processRequest(
}

public void handle(
final HttpRequest data,
final HttpAsyncExchange httpExchange,
final HttpRequest data,
final HttpAsyncExchange httpExchange,
final HttpContext context)
throws HttpException, IOException {
httpExchange.submitResponse(responseProducer);
}

});
this.server.start(registry);

Expand All @@ -154,9 +154,9 @@ public void handle(
writer.write("Host: localhost\r\n");
writer.write("\r\n");
writer.flush();

Thread.sleep(250);

writer.close();
} finally {
socket.close();
Expand All @@ -167,16 +167,16 @@ public void handle(

@Test
public void testRequestCancelled() throws Exception {

final CountDownLatch latch = new CountDownLatch(1);
final Cancellable cancellable = new Cancellable() {

public boolean cancel() {
latch.countDown();
return true;
}
};

UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
registry.register("*", new HttpAsyncRequestHandler<HttpRequest>() {

Expand All @@ -187,14 +187,14 @@ public HttpAsyncRequestConsumer<HttpRequest> processRequest(
}

public void handle(
final HttpRequest data,
final HttpAsyncExchange httpExchange,
final HttpRequest data,
final HttpAsyncExchange httpExchange,
final HttpContext context)
throws HttpException, IOException {
httpExchange.setCallback(cancellable);
// do not submit a response;
}

});
this.server.start(registry);

Expand All @@ -211,9 +211,9 @@ public void handle(
writer.write("Host: localhost\r\n");
writer.write("\r\n");
writer.flush();

Thread.sleep(250);

writer.close();
} finally {
socket.close();
Expand Down

0 comments on commit 20da309

Please sign in to comment.