diff --git a/buffer/src/main/java/io/netty/buffer/ChannelBuffer.java b/buffer/src/main/java/io/netty/buffer/ChannelBuffer.java index b4f90493a2..2c38e8c8c3 100644 --- a/buffer/src/main/java/io/netty/buffer/ChannelBuffer.java +++ b/buffer/src/main/java/io/netty/buffer/ChannelBuffer.java @@ -39,11 +39,10 @@ import java.nio.charset.UnsupportedCharsetException; *

Random Access Indexing

* * Just like an ordinary primitive byte array, {@link ChannelBuffer} uses - * zero-based indexing. - * It means the index of the first byte is always {@code 0} and the index of - * the last byte is always {@link #capacity() capacity - 1}. For example, to - * iterate all bytes of a buffer, you can do the following, regardless of - * its internal implementation: + * zero-based indexing. + * It means the index of the first byte is always {@code 0} and the index of the last byte is + * always {@link #capacity() capacity - 1}. For example, to iterate all bytes of a buffer, you + * can do the following, regardless of its internal implementation: * *
  * {@link ChannelBuffer} buffer = ...;
diff --git a/buffer/src/main/java/io/netty/buffer/ChannelBuffers.java b/buffer/src/main/java/io/netty/buffer/ChannelBuffers.java
index 80c5a56b78..c66efd388d 100644
--- a/buffer/src/main/java/io/netty/buffer/ChannelBuffers.java
+++ b/buffer/src/main/java/io/netty/buffer/ChannelBuffers.java
@@ -226,7 +226,8 @@ public final class ChannelBuffers {
      * More accurate estimation yields less unexpected reallocation overhead.
      * The new buffer's {@code readerIndex} and {@code writerIndex} are {@code 0}.
      */
-    public static ChannelBuffer dynamicBuffer(ByteOrder endianness, int estimatedLength, ChannelBufferFactory factory) {
+    public static ChannelBuffer dynamicBuffer(
+            ByteOrder endianness, int estimatedLength, ChannelBufferFactory factory) {
         return new DynamicChannelBuffer(endianness, estimatedLength, factory);
     }
 
@@ -1249,7 +1250,8 @@ public final class ChannelBuffers {
         return -1;
     }
 
-    private static int firstIndexOf(ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) {
+    private static int firstIndexOf(
+            ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) {
         fromIndex = Math.max(fromIndex, 0);
         if (fromIndex >= toIndex || buffer.capacity() == 0) {
             return -1;
@@ -1264,7 +1266,8 @@ public final class ChannelBuffers {
         return -1;
     }
 
-    private static int lastIndexOf(ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) {
+    private static int lastIndexOf(
+            ChannelBuffer buffer, int fromIndex, int toIndex, ChannelBufferIndexFinder indexFinder) {
         fromIndex = Math.min(fromIndex, buffer.capacity());
         if (fromIndex < 0 || buffer.capacity() == 0) {
             return -1;
diff --git a/buffer/src/main/java/io/netty/buffer/DirectChannelBufferFactory.java b/buffer/src/main/java/io/netty/buffer/DirectChannelBufferFactory.java
index 20b733dc62..0eb4aabf29 100644
--- a/buffer/src/main/java/io/netty/buffer/DirectChannelBufferFactory.java
+++ b/buffer/src/main/java/io/netty/buffer/DirectChannelBufferFactory.java
@@ -56,11 +56,11 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory {
 
     private final Object bigEndianLock = new Object();
     private final Object littleEndianLock = new Object();
-    private final int preallocatedBufferCapacity;
-    private ChannelBuffer preallocatedBigEndianBuffer;
-    private int preallocatedBigEndianBufferPosition;
-    private ChannelBuffer preallocatedLittleEndianBuffer;
-    private int preallocatedLittleEndianBufferPosition;
+    private final int preallocatedBufCapacity;
+    private ChannelBuffer preallocatedBEBuf;
+    private int preallocatedBEBufPos;
+    private ChannelBuffer preallocatedLEBuf;
+    private int preallocatedLEBufPos;
 
     /**
      * Creates a new factory whose default {@link ByteOrder} is
@@ -96,10 +96,10 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory {
         super(defaultOrder);
         if (preallocatedBufferCapacity <= 0) {
             throw new IllegalArgumentException(
-                    "preallocatedBufferCapacity must be greater than 0: " + preallocatedBufferCapacity);
+                    "preallocatedBufCapacity must be greater than 0: " + preallocatedBufferCapacity);
         }
 
-        this.preallocatedBufferCapacity = preallocatedBufferCapacity;
+        preallocatedBufCapacity = preallocatedBufferCapacity;
     }
 
     @Override
@@ -113,7 +113,7 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory {
         if (capacity == 0) {
             return ChannelBuffers.EMPTY_BUFFER;
         }
-        if (capacity >= preallocatedBufferCapacity) {
+        if (capacity >= preallocatedBufCapacity) {
             return ChannelBuffers.directBuffer(order, capacity);
         }
 
@@ -163,17 +163,17 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory {
     private ChannelBuffer allocateBigEndianBuffer(int capacity) {
         ChannelBuffer slice;
         synchronized (bigEndianLock) {
-            if (preallocatedBigEndianBuffer == null) {
-                preallocatedBigEndianBuffer = ChannelBuffers.directBuffer(ByteOrder.BIG_ENDIAN, preallocatedBufferCapacity);
-                slice = preallocatedBigEndianBuffer.slice(0, capacity);
-                preallocatedBigEndianBufferPosition = capacity;
-            } else if (preallocatedBigEndianBuffer.capacity() - preallocatedBigEndianBufferPosition >= capacity) {
-                slice = preallocatedBigEndianBuffer.slice(preallocatedBigEndianBufferPosition, capacity);
-                preallocatedBigEndianBufferPosition += capacity;
+            if (preallocatedBEBuf == null) {
+                preallocatedBEBuf = ChannelBuffers.directBuffer(ByteOrder.BIG_ENDIAN, preallocatedBufCapacity);
+                slice = preallocatedBEBuf.slice(0, capacity);
+                preallocatedBEBufPos = capacity;
+            } else if (preallocatedBEBuf.capacity() - preallocatedBEBufPos >= capacity) {
+                slice = preallocatedBEBuf.slice(preallocatedBEBufPos, capacity);
+                preallocatedBEBufPos += capacity;
             } else {
-                preallocatedBigEndianBuffer = ChannelBuffers.directBuffer(ByteOrder.BIG_ENDIAN, preallocatedBufferCapacity);
-                slice = preallocatedBigEndianBuffer.slice(0, capacity);
-                preallocatedBigEndianBufferPosition = capacity;
+                preallocatedBEBuf = ChannelBuffers.directBuffer(ByteOrder.BIG_ENDIAN, preallocatedBufCapacity);
+                slice = preallocatedBEBuf.slice(0, capacity);
+                preallocatedBEBufPos = capacity;
             }
         }
         return slice;
@@ -182,17 +182,17 @@ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory {
     private ChannelBuffer allocateLittleEndianBuffer(int capacity) {
         ChannelBuffer slice;
         synchronized (littleEndianLock) {
-            if (preallocatedLittleEndianBuffer == null) {
-                preallocatedLittleEndianBuffer = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, preallocatedBufferCapacity);
-                slice = preallocatedLittleEndianBuffer.slice(0, capacity);
-                preallocatedLittleEndianBufferPosition = capacity;
-            } else if (preallocatedLittleEndianBuffer.capacity() - preallocatedLittleEndianBufferPosition >= capacity) {
-                slice = preallocatedLittleEndianBuffer.slice(preallocatedLittleEndianBufferPosition, capacity);
-                preallocatedLittleEndianBufferPosition += capacity;
+            if (preallocatedLEBuf == null) {
+                preallocatedLEBuf = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, preallocatedBufCapacity);
+                slice = preallocatedLEBuf.slice(0, capacity);
+                preallocatedLEBufPos = capacity;
+            } else if (preallocatedLEBuf.capacity() - preallocatedLEBufPos >= capacity) {
+                slice = preallocatedLEBuf.slice(preallocatedLEBufPos, capacity);
+                preallocatedLEBufPos += capacity;
             } else {
-                preallocatedLittleEndianBuffer = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, preallocatedBufferCapacity);
-                slice = preallocatedLittleEndianBuffer.slice(0, capacity);
-                preallocatedLittleEndianBufferPosition = capacity;
+                preallocatedLEBuf = ChannelBuffers.directBuffer(ByteOrder.LITTLE_ENDIAN, preallocatedBufCapacity);
+                slice = preallocatedLEBuf.slice(0, capacity);
+                preallocatedLEBufPos = capacity;
             }
         }
         return slice;
diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
index b81c1edfd3..86a411f524 100644
--- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
+++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
@@ -707,7 +707,8 @@ public class HttpHeaders {
 
     /**
      * Adds a new date header with the specified name and value.  The specified
-     * value is formatted as defined in RFC2616
+     * value is formatted as defined in
+     * RFC2616
      */
     public static void addDateHeader(HttpMessage message, String name, Date value) {
         message.addHeader(name, value);
diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpMethod.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpMethod.java
index 5f766b4e0b..6a97242a56 100644
--- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpMethod.java
+++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpMethod.java
@@ -26,28 +26,32 @@ import java.util.Map;
  */
 public class HttpMethod implements Comparable {
     /**
-     * The OPTIONS method represents a request for information about the communication options available on the request/response
-     * chain identified by the Request-URI. This method allows the client to determine the options and/or requirements
-     * associated with a resource, or the capabilities of a server, without implying a resource action or initiating a
-     * resource retrieval.
+     * The OPTIONS method represents a request for information about the communication options
+     * available on the request/response chain identified by the Request-URI. This method allows
+     * the client to determine the options and/or requirements associated with a resource, or the
+     * capabilities of a server, without implying a resource action or initiating a resource
+     * retrieval.
      */
     public static final HttpMethod OPTIONS = new HttpMethod("OPTIONS");
 
     /**
-     * The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.
-     * If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity
-     * in the response and not the source text of the process, unless that text happens to be the output of the process.
+     * The GET method means retrieve whatever information (in the form of an entity) is identified
+     * by the Request-URI.  If the Request-URI refers to a data-producing process, it is the
+     * produced data which shall be returned as the entity in the response and not the source text
+     * of the process, unless that text happens to be the output of the process.
      */
     public static final HttpMethod GET = new HttpMethod("GET");
 
     /**
-     * The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.
+     * The HEAD method is identical to GET except that the server MUST NOT return a message-body
+     * in the response.
      */
     public static final HttpMethod HEAD = new HttpMethod("HEAD");
 
     /**
-     * The POST method is used to request that the origin server accept the entity enclosed in the request as a new
-     * subordinate of the resource identified by the Request-URI in the Request-Line.
+     * The POST method is used to request that the origin server accept the entity enclosed in the
+     * request as a new subordinate of the resource identified by the Request-URI in the
+     * Request-Line.
      */
     public static final HttpMethod POST = new HttpMethod("POST");
 
@@ -63,17 +67,20 @@ public class HttpMethod implements Comparable {
     public static final HttpMethod PATCH = new HttpMethod("PATCH");
 
     /**
-     * The DELETE method requests that the origin server delete the resource identified by the Request-URI.
+     * The DELETE method requests that the origin server delete the resource identified by the
+     * Request-URI.
      */
     public static final HttpMethod DELETE = new HttpMethod("DELETE");
 
     /**
-     * The TRACE method is used to invoke a remote, application-layer loop- back of the request message.
+     * The TRACE method is used to invoke a remote, application-layer loop- back of the request
+     * message.
      */
     public static final HttpMethod TRACE = new HttpMethod("TRACE");
 
     /**
-     * This specification reserves the method name CONNECT for use with a proxy that can dynamically switch to being a tunnel
+     * This specification reserves the method name CONNECT for use with a proxy that can dynamically
+     * switch to being a tunnel
      */
     public static final HttpMethod CONNECT = new HttpMethod("CONNECT");
 
diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseDecoder.java
index 200dc35f19..cf1826724b 100644
--- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseDecoder.java
+++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseDecoder.java
@@ -101,7 +101,9 @@ public class HttpResponseDecoder extends HttpMessageDecoder {
 
     @Override
     protected HttpMessage createMessage(String[] initialLine) {
-        return new DefaultHttpResponse(HttpVersion.valueOf(initialLine[0]), new HttpResponseStatus(Integer.valueOf(initialLine[1]), initialLine[2]));
+        return new DefaultHttpResponse(
+                HttpVersion.valueOf(initialLine[0]),
+                new HttpResponseStatus(Integer.valueOf(initialLine[1]), initialLine[2]));
     }
 
     @Override
diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java
index 16e5d5f841..c74c5150a3 100644
--- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java
+++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java
@@ -56,7 +56,8 @@ public class HttpResponseStatus implements Comparable {
     /**
      * 203 Non-Authoritative Information (since HTTP/1.1)
      */
-    public static final HttpResponseStatus NON_AUTHORITATIVE_INFORMATION = new HttpResponseStatus(203, "Non-Authoritative Information");
+    public static final HttpResponseStatus NON_AUTHORITATIVE_INFORMATION =
+            new HttpResponseStatus(203, "Non-Authoritative Information");
 
     /**
      * 204 No Content
@@ -151,7 +152,8 @@ public class HttpResponseStatus implements Comparable {
     /**
      * 407 Proxy Authentication Required
      */
-    public static final HttpResponseStatus PROXY_AUTHENTICATION_REQUIRED = new HttpResponseStatus(407, "Proxy Authentication Required");
+    public static final HttpResponseStatus PROXY_AUTHENTICATION_REQUIRED =
+            new HttpResponseStatus(407, "Proxy Authentication Required");
 
     /**
      * 408 Request Timeout
@@ -181,7 +183,8 @@ public class HttpResponseStatus implements Comparable {
     /**
      * 413 Request Entity Too Large
      */
-    public static final HttpResponseStatus REQUEST_ENTITY_TOO_LARGE = new HttpResponseStatus(413, "Request Entity Too Large");
+    public static final HttpResponseStatus REQUEST_ENTITY_TOO_LARGE =
+            new HttpResponseStatus(413, "Request Entity Too Large");
 
     /**
      * 414 Request-URI Too Long
@@ -191,12 +194,14 @@ public class HttpResponseStatus implements Comparable {
     /**
      * 415 Unsupported Media Type
      */
-    public static final HttpResponseStatus UNSUPPORTED_MEDIA_TYPE = new HttpResponseStatus(415, "Unsupported Media Type");
+    public static final HttpResponseStatus UNSUPPORTED_MEDIA_TYPE =
+            new HttpResponseStatus(415, "Unsupported Media Type");
 
     /**
      * 416 Requested Range Not Satisfiable
      */
-    public static final HttpResponseStatus REQUESTED_RANGE_NOT_SATISFIABLE = new HttpResponseStatus(416, "Requested Range Not Satisfiable");
+    public static final HttpResponseStatus REQUESTED_RANGE_NOT_SATISFIABLE =
+            new HttpResponseStatus(416, "Requested Range Not Satisfiable");
 
     /**
      * 417 Expectation Failed
@@ -231,7 +236,8 @@ public class HttpResponseStatus implements Comparable {
     /**
      * 500 Internal Server Error
      */
-    public static final HttpResponseStatus INTERNAL_SERVER_ERROR = new HttpResponseStatus(500, "Internal Server Error");
+    public static final HttpResponseStatus INTERNAL_SERVER_ERROR =
+            new HttpResponseStatus(500, "Internal Server Error");
 
     /**
      * 501 Not Implemented
@@ -256,12 +262,14 @@ public class HttpResponseStatus implements Comparable {
     /**
      * 505 HTTP Version Not Supported
      */
-    public static final HttpResponseStatus HTTP_VERSION_NOT_SUPPORTED = new HttpResponseStatus(505, "HTTP Version Not Supported");
+    public static final HttpResponseStatus HTTP_VERSION_NOT_SUPPORTED =
+            new HttpResponseStatus(505, "HTTP Version Not Supported");
 
     /**
      * 506 Variant Also Negotiates (RFC2295)
      */
-    public static final HttpResponseStatus VARIANT_ALSO_NEGOTIATES = new HttpResponseStatus(506, "Variant Also Negotiates");
+    public static final HttpResponseStatus VARIANT_ALSO_NEGOTIATES =
+            new HttpResponseStatus(506, "Variant Also Negotiates");
 
     /**
      * 507 Insufficient Storage (WebDAV, RFC4918)
diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java
index 9470c9b707..e5e37307ac 100644
--- a/codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java
+++ b/codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java
@@ -46,10 +46,10 @@ import java.util.Map;
  *
  * 

HashDOS vulnerability fix

* - * As a workaround to the HashDOS - * vulnerability, the decoder limits the maximum number of decoded key-value - * parameter pairs, up to {@literal 1024} by default, and you can configure it - * when you construct the decoder by passing an additional integer parameter. + * As a workaround to the HashDOS vulnerability, the decoder + * limits the maximum number of decoded key-value parameter pairs, up to {@literal 1024} by + * default, and you can configure it when you construct the decoder by passing an additional + * integer parameter. * * @see QueryStringEncoder * diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java index b653d8121d..e741e5e6c3 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java @@ -20,8 +20,8 @@ import io.netty.buffer.ChannelBuffers; import io.netty.util.CharsetUtil; /** - * Web Socket continuation frame containing continuation text or binary data. This is used for fragmented messages where - * the contents of a messages is contained more than 1 frame. + * Web Socket continuation frame containing continuation text or binary data. This is used for + * fragmented messages where the contents of a messages is contained more than 1 frame. */ public class ContinuationWebSocketFrame extends WebSocketFrame { @@ -35,10 +35,10 @@ public class ContinuationWebSocketFrame extends WebSocketFrame { } /** - * Creates a new continuation frame with the specified binary data. The final fragment flag is set to true. + * Creates a new continuation frame with the specified binary data. The final fragment flag is + * set to true. * - * @param binaryData - * the content of the frame. + * @param binaryData the content of the frame. */ public ContinuationWebSocketFrame(ChannelBuffer binaryData) { setBinaryData(binaryData); @@ -70,9 +70,11 @@ public class ContinuationWebSocketFrame extends WebSocketFrame { * @param binaryData * the content of the frame. * @param aggregatedText - * Aggregated text set by decoder on the final continuation frame of a fragmented text message + * Aggregated text set by decoder on the final continuation frame of a fragmented + * text message */ - public ContinuationWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData, String aggregatedText) { + public ContinuationWebSocketFrame( + boolean finalFragment, int rsv, ChannelBuffer binaryData, String aggregatedText) { setFinalFragment(finalFragment); setRsv(rsv); setBinaryData(binaryData); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/UTF8Exception.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/UTF8Exception.java index c4fdb964e9..9580b72073 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/UTF8Exception.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/UTF8Exception.java @@ -18,19 +18,20 @@ * * Copyright (c) 2008-2009 Bjoern Hoehrmann * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and - * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions - * of the Software. + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO - * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package io.netty.handler.codec.http.websocketx; diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/UTF8Output.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/UTF8Output.java index 4756f9afde..0cd07262f9 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/UTF8Output.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/UTF8Output.java @@ -18,19 +18,20 @@ * * Copyright (c) 2008-2009 Bjoern Hoehrmann * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - * documentation files (the "Software"), to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and - * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions - * of the Software. + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO - * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package io.netty.handler.codec.http.websocketx; @@ -41,20 +42,23 @@ final class UTF8Output { private static final int UTF8_ACCEPT = 0; private static final int UTF8_REJECT = 12; - private static final byte[] TYPES = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 11, - 6, 6, 6, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; + private static final byte[] TYPES = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, + 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 11, 6, 6, 6, 5, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8 }; - private static final byte[] STATES = { 0, 12, 24, 36, 60, 96, 84, 12, 12, 12, 48, 72, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 0, 12, 12, 12, 12, 12, 0, 12, 0, 12, 12, 12, 24, 12, 12, 12, 12, 12, 24, 12, 24, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 36, 12, 36, 12, 12, 12, 36, 12, 12, 12, 12, 12, 36, 12, 36, 12, 12, 12, 36, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12 }; + private static final byte[] STATES = { 0, 12, 24, 36, 60, 96, 84, 12, 12, 12, 48, 72, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0, 12, 12, 12, 12, 12, 0, 12, 0, 12, 12, + 12, 24, 12, 12, 12, 12, 12, 24, 12, 24, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, + 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, 12, 24, 12, 12, 12, 12, 12, 12, 12, 12, 12, 36, + 12, 36, 12, 12, 12, 36, 12, 12, 12, 12, 12, 36, 12, 36, 12, 12, 12, 36, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12 }; private int state = UTF8_ACCEPT; private int codep; diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java index 3f95f639a1..fc114a876a 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java @@ -401,7 +401,8 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder customHeaders, int maxFramePayloadLength) { if (version == WebSocketVersion.V13) { - return new WebSocketClientHandshaker13(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength); + return new WebSocketClientHandshaker13( + webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength); } if (version == WebSocketVersion.V08) { - return new WebSocketClientHandshaker08(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength); + return new WebSocketClientHandshaker08( + webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength); } if (version == WebSocketVersion.V00) { - return new WebSocketClientHandshaker00(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength); + return new WebSocketClientHandshaker00( + webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength); } throw new WebSocketHandshakeException("Protocol version " + version.toString() + " not supported."); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java index 7faa65fb08..f4be1b93a0 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java @@ -52,17 +52,18 @@ public class WebSocketServerHandshaker08 extends WebSocketServerHandshaker { * Constructor specifying the destination web socket location * * @param webSocketURL - * URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. + * URL for web socket communications. e.g "ws://myhost.com/mypath". + * Subsequent web socket frames will be sent to this URL. * @param subprotocols * CSV of supported protocols * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param maxFramePayloadLength - * Maximum allowable frame payload length. Setting this value to your application's requirement may - * reduce denial of service attacks using long data frames. + * Maximum allowable frame payload length. Setting this value to your application's + * requirement may reduce denial of service attacks using long data frames. */ - public WebSocketServerHandshaker08(String webSocketURL, String subprotocols, boolean allowExtensions, int maxFramePayloadLength) { + public WebSocketServerHandshaker08( + String webSocketURL, String subprotocols, boolean allowExtensions, int maxFramePayloadLength) { super(WebSocketVersion.V08, webSocketURL, subprotocols, maxFramePayloadLength); this.allowExtensions = allowExtensions; } diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java index e8b89c2392..95737bd23e 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java @@ -35,10 +35,8 @@ import io.netty.util.CharsetUtil; /** *

- * Performs server side opening and closing handshakes for RFC 6455 - * (originally web socket specification version draft-ietf-hybi-thewebsocketprotocol- - * 17). + * Performs server side opening and closing handshakes for RFC 6455 + * (originally web socket specification draft-ietf-hybi-thewebsocketprotocol-17). *

*/ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker { @@ -53,17 +51,18 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker { * Constructor specifying the destination web socket location * * @param webSocketURL - * URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. + * URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web + * socket frames will be sent to this URL. * @param subprotocols - * CSV of supported protocols + * CSV of supported protocols * @param allowExtensions - * Allow extensions to be used in the reserved bits of the web socket frame + * Allow extensions to be used in the reserved bits of the web socket frame * @param maxFramePayloadLength - * Maximum allowable frame payload length. Setting this value to your application's requirement may - * reduce denial of service attacks using long data frames. + * Maximum allowable frame payload length. Setting this value to your application's + * requirement may reduce denial of service attacks using long data frames. */ - public WebSocketServerHandshaker13(String webSocketURL, String subprotocols, boolean allowExtensions, int maxFramePayloadLength) { + public WebSocketServerHandshaker13( + String webSocketURL, String subprotocols, boolean allowExtensions, int maxFramePayloadLength) { super(WebSocketVersion.V13, webSocketURL, subprotocols, maxFramePayloadLength); this.allowExtensions = allowExtensions; } @@ -136,7 +135,8 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker { if (subprotocols != null) { String selectedSubprotocol = selectSubprotocol(subprotocols); if (selectedSubprotocol == null) { - throw new WebSocketHandshakeException("Requested subprotocol(s) not supported: " + subprotocols); + throw new WebSocketHandshakeException( + "Requested subprotocol(s) not supported: " + subprotocols); } else { res.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol); setSelectedSubprotocol(selectedSubprotocol); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java index ea45f5aa50..4e8b48f25d 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java @@ -40,8 +40,8 @@ public class WebSocketServerHandshakerFactory { * Constructor specifying the destination web socket location * * @param webSocketURL - * URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. + * URL for web socket communications. e.g "ws://myhost.com/mypath". + * Subsequent web socket frames will be sent to this URL. * @param subprotocols * CSV of supported protocols. Null if sub protocols not supported. * @param allowExtensions @@ -56,15 +56,15 @@ public class WebSocketServerHandshakerFactory { * Constructor specifying the destination web socket location * * @param webSocketURL - * URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. + * URL for web socket communications. e.g "ws://myhost.com/mypath". + * Subsequent web socket frames will be sent to this URL. * @param subprotocols * CSV of supported protocols. Null if sub protocols not supported. * @param allowExtensions * Allow extensions to be used in the reserved bits of the web socket frame * @param maxFramePayloadLength - * Maximum allowable frame payload length. Setting this value to your application's requirement may - * reduce denial of service attacks using long data frames. + * Maximum allowable frame payload length. Setting this value to your application's + * requirement may reduce denial of service attacks using long data frames. */ public WebSocketServerHandshakerFactory( String webSocketURL, String subprotocols, boolean allowExtensions, @@ -78,8 +78,8 @@ public class WebSocketServerHandshakerFactory { /** * Instances a new handshaker * - * @return A new WebSocketServerHandshaker for the requested web socket version. Null if web socket version is not - * supported. + * @return A new WebSocketServerHandshaker for the requested web socket version. Null if web + * socket version is not supported. */ public WebSocketServerHandshaker newHandshaker(HttpRequest req) { @@ -87,10 +87,12 @@ public class WebSocketServerHandshakerFactory { if (version != null) { if (version.equals(WebSocketVersion.V13.toHttpHeaderValue())) { // Version 13 of the wire protocol - RFC 6455 (version 17 of the draft hybi specification). - return new WebSocketServerHandshaker13(webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength); + return new WebSocketServerHandshaker13( + webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength); } else if (version.equals(WebSocketVersion.V08.toHttpHeaderValue())) { // Version 8 of the wire protocol - version 10 of the draft hybi specification. - return new WebSocketServerHandshaker08(webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength); + return new WebSocketServerHandshaker08( + webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength); } else { return null; } @@ -114,5 +116,4 @@ public class WebSocketServerHandshakerFactory { res.setHeader(Names.SEC_WEBSOCKET_VERSION, WebSocketVersion.V13.toHttpHeaderValue()); channel.write(res); } - } diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/package-info.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/package-info.java index 833d1c80fe..05fedcfaa8 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/package-info.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/package-info.java @@ -21,9 +21,10 @@ * This package supports different web socket specification versions (hence the X suffix). * The specification current supported are: * *

*

diff --git a/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspMethods.java b/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspMethods.java index 684722916d..7954749daa 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspMethods.java +++ b/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspMethods.java @@ -27,10 +27,11 @@ import java.util.Map; public final class RtspMethods { /** - * The OPTIONS method represents a request for information about the communication options available on the request/response - * chain identified by the Request-URI. This method allows the client to determine the options and/or requirements - * associated with a resource, or the capabilities of a server, without implying a resource action or initiating a - * resource retrieval. + * The OPTIONS method represents a request for information about the communication options + * available on the request/response chain identified by the Request-URI. This method allows + * the client to determine the options and/or requirements associated with a resource, or the + * capabilities of a server, without implying a resource action or initiating a resource + * retrieval. */ public static final HttpMethod OPTIONS = HttpMethod.OPTIONS; diff --git a/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspResponseStatuses.java b/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspResponseStatuses.java index 4c1c4ce084..b53548135e 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspResponseStatuses.java +++ b/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspResponseStatuses.java @@ -107,7 +107,8 @@ public final class RtspResponseStatuses { /** * 407 Proxy Authentication Required */ - public static final HttpResponseStatus PROXY_AUTHENTICATION_REQUIRED = HttpResponseStatus.PROXY_AUTHENTICATION_REQUIRED; + public static final HttpResponseStatus PROXY_AUTHENTICATION_REQUIRED = + HttpResponseStatus.PROXY_AUTHENTICATION_REQUIRED; /** * 408 Request Timeout diff --git a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java index 81a1d94b91..b2e2ed22ee 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java @@ -239,7 +239,8 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder { httpMessage.removeHeader("Proxy-Connection"); httpMessage.removeHeader(HttpHeaders.Names.TRANSFER_ENCODING); - SpdySynStreamFrame spdySynStreamFrame = new DefaultSpdySynStreamFrame(streamID, associatedToStreamID, priority); + SpdySynStreamFrame spdySynStreamFrame = + new DefaultSpdySynStreamFrame(streamID, associatedToStreamID, priority); // Unfold the first line of the message into name/value pairs if (httpMessage instanceof HttpRequest) { diff --git a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java index 1926a64999..03118ed910 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java +++ b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java @@ -777,7 +777,8 @@ public class SpdySessionHandler return false; } spdySession.acceptStream( - streamID, priority, remoteSideClosed, localSideClosed, initialSendWindowSize, initialReceiveWindowSize); + streamID, priority, remoteSideClosed, localSideClosed, + initialSendWindowSize, initialReceiveWindowSize); if (isRemoteInitiatedID(streamID)) { lastGoodStreamID = streamID; } diff --git a/codec/src/main/java/io/netty/handler/codec/FixedLengthFrameDecoder.java b/codec/src/main/java/io/netty/handler/codec/FixedLengthFrameDecoder.java index da6b1a16eb..2f83b9d8b7 100644 --- a/codec/src/main/java/io/netty/handler/codec/FixedLengthFrameDecoder.java +++ b/codec/src/main/java/io/netty/handler/codec/FixedLengthFrameDecoder.java @@ -52,8 +52,11 @@ public class FixedLengthFrameDecoder extends StreamToMessageDecoder { /** * Creates a new instance. * - * @param frameLength the length of the frame - * @param allocateFullBuffer true if the cumulative {@link ChannelBuffer} should use the {@link #frameLength} as its initial size + * @param frameLength + * the length of the frame + * @param allocateFullBuffer + * true if the cumulative {@link ChannelBuffer} should use the + * {@link #frameLength} as its initial size */ public FixedLengthFrameDecoder(int frameLength, boolean allocateFullBuffer) { if (frameLength <= 0) { diff --git a/codec/src/main/java/io/netty/handler/codec/base64/Base64.java b/codec/src/main/java/io/netty/handler/codec/base64/Base64.java index 858808f783..f10f88f1b1 100644 --- a/codec/src/main/java/io/netty/handler/codec/base64/Base64.java +++ b/codec/src/main/java/io/netty/handler/codec/base64/Base64.java @@ -28,7 +28,9 @@ import io.netty.buffer.HeapChannelBufferFactory; * Base64 notation. *

* The encoding and decoding algorithm in this class has been derived from - * Robert Harder's Public Domain Base64 Encoder/Decoder. + * Robert Harder's Public Domain + * Base64 Encoder/Decoder. + * * @apiviz.landmark * @apiviz.uses io.netty.handler.codec.base64.Base64Dialect */ @@ -125,7 +127,8 @@ public final class Base64 { return encode(src, off, len, Base64Dialect.STANDARD, bufferFactory); } - public static ChannelBuffer encode(ChannelBuffer src, int off, int len, Base64Dialect dialect, ChannelBufferFactory bufferFactory) { + public static ChannelBuffer encode( + ChannelBuffer src, int off, int len, Base64Dialect dialect, ChannelBufferFactory bufferFactory) { return encode(src, off, len, breakLines(dialect), dialect, bufferFactory); } diff --git a/codec/src/main/java/io/netty/handler/codec/base64/Base64Dialect.java b/codec/src/main/java/io/netty/handler/codec/base64/Base64Dialect.java index ce75aa7e20..27aecf23cf 100644 --- a/codec/src/main/java/io/netty/handler/codec/base64/Base64Dialect.java +++ b/codec/src/main/java/io/netty/handler/codec/base64/Base64Dialect.java @@ -23,7 +23,8 @@ package io.netty.handler.codec.base64; * Enumeration of supported Base64 dialects. *

* The internal lookup tables in this class has been derived from - * Robert Harder's Public Domain Base64 Encoder/Decoder. + * Robert Harder's Public Domain + * Base64 Encoder/Decoder. */ public enum Base64Dialect { /** diff --git a/codec/src/main/java/io/netty/handler/codec/bytes/ByteArrayDecoder.java b/codec/src/main/java/io/netty/handler/codec/bytes/ByteArrayDecoder.java index 31c65d9c19..171fade92f 100644 --- a/codec/src/main/java/io/netty/handler/codec/bytes/ByteArrayDecoder.java +++ b/codec/src/main/java/io/netty/handler/codec/bytes/ByteArrayDecoder.java @@ -59,7 +59,8 @@ public class ByteArrayDecoder extends MessageToMessageDecoder>(new HashMap>>())); + return new CachingClassResolver( + new ClassLoaderClassResolver(defaultClassLoader(classLoader)), + new WeakReferenceMap>(new HashMap>>())); } /** @@ -49,7 +51,9 @@ public final class ClassResolvers { * @return new instance of class resolver */ public static ClassResolver softCachingResolver(ClassLoader classLoader) { - return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new SoftReferenceMap>(new HashMap>>())); + return new CachingClassResolver( + new ClassLoaderClassResolver(defaultClassLoader(classLoader)), + new SoftReferenceMap>(new HashMap>>())); } /** @@ -60,7 +64,9 @@ public final class ClassResolvers { * @return new instance of class resolver */ public static ClassResolver weakCachingConcurrentResolver(ClassLoader classLoader) { - return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap>(new ConcurrentHashMap>>())); + return new CachingClassResolver( + new ClassLoaderClassResolver(defaultClassLoader(classLoader)), + new WeakReferenceMap>(new ConcurrentHashMap>>())); } /** @@ -71,7 +77,9 @@ public final class ClassResolvers { * @return new instance of class resolver */ public static ClassResolver softCachingConcurrentResolver(ClassLoader classLoader) { - return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new SoftReferenceMap>(new ConcurrentHashMap>>())); + return new CachingClassResolver( + new ClassLoaderClassResolver(defaultClassLoader(classLoader)), + new SoftReferenceMap>(new ConcurrentHashMap>>())); } static ClassLoader defaultClassLoader(ClassLoader classLoader) { diff --git a/common/src/main/java/io/netty/logging/JdkLoggerFactory.java b/common/src/main/java/io/netty/logging/JdkLoggerFactory.java index 83ad6f8b5d..aacbf25173 100644 --- a/common/src/main/java/io/netty/logging/JdkLoggerFactory.java +++ b/common/src/main/java/io/netty/logging/JdkLoggerFactory.java @@ -18,7 +18,7 @@ package io.netty.logging; /** * Logger factory which creates a - * java.util.logging + * java.util.logging * logger. */ public class JdkLoggerFactory extends InternalLoggerFactory { diff --git a/common/src/main/java/io/netty/util/SocketAddresses.java b/common/src/main/java/io/netty/util/SocketAddresses.java index fde64e25c8..e4a0b539ea 100644 --- a/common/src/main/java/io/netty/util/SocketAddresses.java +++ b/common/src/main/java/io/netty/util/SocketAddresses.java @@ -44,7 +44,8 @@ public final class SocketAddresses { localhost = InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }); } catch (UnknownHostException e1) { try { - localhost = InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }); + localhost = InetAddress.getByAddress( + new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }); } catch (UnknownHostException e2) { logger.error("Failed to resolve localhost", e2); } @@ -60,8 +61,7 @@ public final class SocketAddresses { loopbackIf = null; } - // check if the NetworkInterface is null, this is the case on my ubuntu dev machine but not on osx and windows. - // if so fail back the the first interface + // If null is returned, iterate over all the available network interfaces. if (loopbackIf == null) { try { for (Enumeration e = NetworkInterface.getNetworkInterfaces(); diff --git a/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java b/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java index 4046a3a582..01186c86c0 100644 --- a/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java +++ b/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java @@ -131,7 +131,8 @@ public class HttpStaticFileServerHandler extends ChannelInboundMessageHandlerAda SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince); - // Only compare up to the second because the datetime format we send to the client does not have milliseconds + // Only compare up to the second because the datetime format we send to the client + // does not have milliseconds long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000; long fileLastModifiedSeconds = file.lastModified() / 1000; if (ifModifiedSinceDateSeconds == fileLastModifiedSeconds) { @@ -270,7 +271,8 @@ public class HttpStaticFileServerHandler extends ChannelInboundMessageHandlerAda time.add(Calendar.SECOND, HTTP_CACHE_SECONDS); response.setHeader(HttpHeaders.Names.EXPIRES, dateFormatter.format(time.getTime())); response.setHeader(HttpHeaders.Names.CACHE_CONTROL, "private, max-age=" + HTTP_CACHE_SECONDS); - response.setHeader(HttpHeaders.Names.LAST_MODIFIED, dateFormatter.format(new Date(fileToCache.lastModified()))); + response.setHeader( + HttpHeaders.Names.LAST_MODIFIED, dateFormatter.format(new Date(fileToCache.lastModified()))); } /** diff --git a/example/src/main/java/io/netty/example/http/snoop/HttpSnoopServerHandler.java b/example/src/main/java/io/netty/example/http/snoop/HttpSnoopServerHandler.java index 21dcbfa883..bc8062f720 100644 --- a/example/src/main/java/io/netty/example/http/snoop/HttpSnoopServerHandler.java +++ b/example/src/main/java/io/netty/example/http/snoop/HttpSnoopServerHandler.java @@ -137,7 +137,8 @@ public class HttpSnoopServerHandler extends ChannelInboundMessageHandlerAdapter< if (keepAlive) { // Add 'Content-Length' header only for a keep-alive connection. response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes()); - // Add keep alive header as per http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01.html#Connection + // Add keep alive header as per: + // - http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01.html#Connection response.setHeader(CONNECTION, HttpHeaders.Values.KEEP_ALIVE); } diff --git a/example/src/main/java/io/netty/example/http/websocketx/server/WebSocketServerIndexPage.java b/example/src/main/java/io/netty/example/http/websocketx/server/WebSocketServerIndexPage.java index a3269fb7be..5182bae4ce 100644 --- a/example/src/main/java/io/netty/example/http/websocketx/server/WebSocketServerIndexPage.java +++ b/example/src/main/java/io/netty/example/http/websocketx/server/WebSocketServerIndexPage.java @@ -27,67 +27,50 @@ public final class WebSocketServerIndexPage { private static final String NEWLINE = "\r\n"; public static ChannelBuffer getContent(String webSocketLocation) { - return ChannelBuffers - .copiedBuffer( - "Web Socket Test" - + NEWLINE - + "" - + NEWLINE - + "" - + NEWLINE - + "

" - + NEWLINE - + "" - + "" - + NEWLINE + "

Output

" + NEWLINE - + "" - + NEWLINE + "
" + NEWLINE + "" + NEWLINE + "" + NEWLINE, - CharsetUtil.US_ASCII); + return ChannelBuffers.copiedBuffer( + "Web Socket Test" + NEWLINE + + "" + NEWLINE + + "" + NEWLINE + + "
" + NEWLINE + + "" + + "" + NEWLINE + + "

Output

" + NEWLINE + + "" + NEWLINE + + "
" + NEWLINE + + "" + NEWLINE + + "" + NEWLINE, CharsetUtil.US_ASCII); } private WebSocketServerIndexPage() { diff --git a/example/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java b/example/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java index a47e17b44b..db02ff8152 100644 --- a/example/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java +++ b/example/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java @@ -26,6 +26,7 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundMessageHandlerAdapter; +import io.netty.example.http.websocketx.server.WebSocketServerIndexPage; import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpRequest; @@ -71,7 +72,7 @@ public class WebSocketSslServerHandler extends ChannelInboundMessageHandlerAdapt if (req.getUri().equals("/")) { HttpResponse res = new DefaultHttpResponse(HTTP_1_1, OK); - ChannelBuffer content = WebSocketSslServerIndexPage.getContent(getWebSocketLocation(req)); + ChannelBuffer content = WebSocketServerIndexPage.getContent(getWebSocketLocation(req)); res.setHeader(CONTENT_TYPE, "text/html; charset=UTF-8"); setContentLength(res, content.readableBytes()); diff --git a/example/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java b/example/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java deleted file mode 100644 index 125041773c..0000000000 --- a/example/src/main/java/io/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2012 The Netty Project - * - * The Netty Project 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 - * - * 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. - */ -package io.netty.example.http.websocketx.sslserver; - -import io.netty.buffer.ChannelBuffer; -import io.netty.buffer.ChannelBuffers; -import io.netty.util.CharsetUtil; - -/** - * Generates the demo HTML page which is served at http://localhost:8080/ - */ -public final class WebSocketSslServerIndexPage { - - private static final String NEWLINE = "\r\n"; - - public static ChannelBuffer getContent(String webSocketLocation) { - return ChannelBuffers - .copiedBuffer( - "Web Socket Test" - + NEWLINE - + "" - + NEWLINE - + "" - + NEWLINE - + "
" - + NEWLINE - + "" - + "" - + NEWLINE + "

Output

" + NEWLINE - + "" - + NEWLINE + "
" + NEWLINE + "" + NEWLINE + "" + NEWLINE, - CharsetUtil.US_ASCII); - } - - private WebSocketSslServerIndexPage() { - // Unused - } -} diff --git a/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentClient.java b/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentClient.java index 1d47966316..8ac69303fe 100644 --- a/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentClient.java +++ b/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentClient.java @@ -30,7 +30,7 @@ import java.net.InetSocketAddress; * A UDP broadcast client that asks for a quote of the moment (QOTM) to * {@link QuoteOfTheMomentServer}. * - * Inspired by the official Java tutorial. + * Inspired by the official Java tutorial. */ public class QuoteOfTheMomentClient { diff --git a/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentServer.java b/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentServer.java index 11640027ff..184e21e58f 100644 --- a/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentServer.java +++ b/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentServer.java @@ -26,7 +26,7 @@ import java.net.InetSocketAddress; * A UDP server that responds to the QOTM (quote of the moment) request to a * {@link QuoteOfTheMomentClient}. * - * Inspired by the official Java tutorial. + * Inspired by the official Java tutorial. */ public class QuoteOfTheMomentServer { diff --git a/example/src/main/java/io/netty/example/securechat/SecureChatSslContextFactory.java b/example/src/main/java/io/netty/example/securechat/SecureChatSslContextFactory.java index 041fc322b1..f9dca7cc0a 100644 --- a/example/src/main/java/io/netty/example/securechat/SecureChatSslContextFactory.java +++ b/example/src/main/java/io/netty/example/securechat/SecureChatSslContextFactory.java @@ -18,6 +18,7 @@ package io.netty.example.securechat; import io.netty.handler.ssl.SslHandler; import java.security.KeyStore; +import java.security.SecureRandom; import java.security.Security; import javax.net.ssl.KeyManager; @@ -42,10 +43,10 @@ import javax.net.ssl.TrustManager; * {@link SslHandler}. *
  • When initializing an {@link SSLContext} on the client side, * specify the {@link KeyManager} that contains the client certificate as - * the first argument of {@link SSLContext#init(KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom)}.
  • + * the first argument of {@link SSLContext#init(KeyManager[], TrustManager[], SecureRandom)}. *
  • When initializing an {@link SSLContext} on the server side, * specify the proper {@link TrustManager} as the second argument of - * {@link SSLContext#init(KeyManager[], javax.net.ssl.TrustManager[], java.security.SecureRandom)} + * {@link SSLContext#init(KeyManager[], TrustManager[], SecureRandom)} * to validate the client certificate.
  • * */ diff --git a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java index 4c4e95ff45..47174ab023 100644 --- a/handler/src/main/java/io/netty/handler/ssl/SslHandler.java +++ b/handler/src/main/java/io/netty/handler/ssl/SslHandler.java @@ -62,9 +62,10 @@ import javax.net.ssl.SSLException; *

    Handshake

    *

    * If {@link #isIssueHandshake()} is {@code false} - * (default) you will need to take care of calling {@link #handshake()} by your own. In most situations were {@link SslHandler} is used in 'client mode' - * you want to issue a handshake once the connection was established. if {@link #setIssueHandshake(boolean)} is set to true you don't need to - * worry about this as the {@link SslHandler} will take care of it. + * (default) you will need to take care of calling {@link #handshake()} by your own. In most + * situations were {@link SslHandler} is used in 'client mode' you want to issue a handshake once + * the connection was established. if {@link #setIssueHandshake(boolean)} is set to true + * you don't need to worry about this as the {@link SslHandler} will take care of it. *

    * *

    Renegotiation

    @@ -83,7 +84,8 @@ import javax.net.ssl.SSLException; * * *

    Closing the session

    @@ -646,7 +648,8 @@ public class SslHandler @Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { if (!startTls && engine.getUseClientMode()) { - // issue and handshake and add a listener to it which will fire an exception event if an exception was thrown while doing the handshake + // issue and handshake and add a listener to it which will fire an exception event if + // an exception was thrown while doing the handshake handshake().addListener(new ChannelFutureListener() { @Override diff --git a/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java b/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java index a1a24ca550..aeb7df85e4 100644 --- a/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java +++ b/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java @@ -234,8 +234,9 @@ public class ChunkedWriteHandler if (endOfInput) { this.currentEvent = null; - // Register a listener which will close the input once the write is complete. This is needed because the Chunk may have - // some resource bound that can not be closed before its not written + // Register a listener which will close the input once the write is complete. + // This is needed because the Chunk may have some resource bound that can not + // be closed before its not written. // // See https://github.com/netty/netty/issues/303 f.addListener(new ChannelFutureListener() { diff --git a/pom.xml b/pom.xml index 1d1e1ea29e..5c45a53836 100644 --- a/pom.xml +++ b/pom.xml @@ -315,7 +315,7 @@ ${project.groupId} netty-build - 8 + 9-SNAPSHOT diff --git a/transport/src/main/java/io/netty/channel/ChannelHandler.java b/transport/src/main/java/io/netty/channel/ChannelHandler.java index ae8ae259ab..f5c8d78f74 100644 --- a/transport/src/main/java/io/netty/channel/ChannelHandler.java +++ b/transport/src/main/java/io/netty/channel/ChannelHandler.java @@ -143,7 +143,7 @@ import java.nio.channels.Channels; *
      * public final class DataServerState {
      *
    - *     public static final {@link ChannelLocal}<Boolean> loggedIn = new {@link ChannelLocal}<Boolean>() {
    + *     public static final {@link ChannelLocal}<Boolean> loggedIn = new {@link ChannelLocal}<>() {
      *         protected Boolean initialValue(Channel channel) {
      *             return false;
      *         }
    diff --git a/transport/src/main/java/io/netty/channel/ChannelHandlerAdapter.java b/transport/src/main/java/io/netty/channel/ChannelHandlerAdapter.java
    index cb720c9a93..c75fa73624 100644
    --- a/transport/src/main/java/io/netty/channel/ChannelHandlerAdapter.java
    +++ b/transport/src/main/java/io/netty/channel/ChannelHandlerAdapter.java
    @@ -28,7 +28,9 @@ public class ChannelHandlerAdapter extends ChannelStateHandlerAdapter implements
         }
     
         @Override
    -    public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelFuture future) throws Exception {
    +    public void connect(
    +            ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress,
    +            ChannelFuture future) throws Exception {
             ctx.connect(remoteAddress, localAddress, future);
         }
     
    diff --git a/transport/src/main/java/io/netty/channel/ChannelOperationHandler.java b/transport/src/main/java/io/netty/channel/ChannelOperationHandler.java
    index 8ea4a9e80d..80aa31677f 100644
    --- a/transport/src/main/java/io/netty/channel/ChannelOperationHandler.java
    +++ b/transport/src/main/java/io/netty/channel/ChannelOperationHandler.java
    @@ -19,7 +19,9 @@ import java.net.SocketAddress;
     
     public interface ChannelOperationHandler extends ChannelHandler {
         void bind(ChannelHandlerContext ctx, SocketAddress localAddress, ChannelFuture future) throws Exception;
    -    void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelFuture future) throws Exception;
    +    void connect(
    +            ChannelHandlerContext ctx, SocketAddress remoteAddress,
    +            SocketAddress localAddress, ChannelFuture future) throws Exception;
         void disconnect(ChannelHandlerContext ctx, ChannelFuture future) throws Exception;
         void close(ChannelHandlerContext ctx, ChannelFuture future) throws Exception;
         void deregister(ChannelHandlerContext ctx, ChannelFuture future) throws Exception;
    diff --git a/transport/src/main/java/io/netty/channel/DefaultChannelConfig.java b/transport/src/main/java/io/netty/channel/DefaultChannelConfig.java
    index 8469d8f458..9bb9b6f690 100644
    --- a/transport/src/main/java/io/netty/channel/DefaultChannelConfig.java
    +++ b/transport/src/main/java/io/netty/channel/DefaultChannelConfig.java
    @@ -37,7 +37,8 @@ public class DefaultChannelConfig implements ChannelConfig {
             return getOptions(null, CONNECT_TIMEOUT_MILLIS, WRITE_SPIN_COUNT);
         }
     
    -    protected Map, Object> getOptions(Map, Object> result, ChannelOption... options) {
    +    protected Map, Object> getOptions(
    +            Map, Object> result, ChannelOption... options) {
             if (result == null) {
                 result = new IdentityHashMap, Object>();
             }
    diff --git a/transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java b/transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java
    index 7e345f80ee..f65dcd2c18 100644
    --- a/transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java
    +++ b/transport/src/main/java/io/netty/channel/DefaultChannelPipeline.java
    @@ -86,7 +86,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
                 synchronized (this) {
                     checkDuplicateName(name);
                     final DefaultChannelHandlerContext nextCtx = head.next;
    -                final DefaultChannelHandlerContext newCtx = new DefaultChannelHandlerContext(this, executor, head, nextCtx, name, handler);
    +                final DefaultChannelHandlerContext newCtx =
    +                        new DefaultChannelHandlerContext(this, executor, head, nextCtx, name, handler);
     
                     if (!newCtx.channel().isRegistered() || newCtx.executor().inEventLoop()) {
                         addFirst0(name, nextCtx, newCtx);
    @@ -118,7 +119,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
     
         }
     
    -    private void addFirst0(final String name, DefaultChannelHandlerContext nextCtx, DefaultChannelHandlerContext newCtx) {
    +    private void addFirst0(
    +            final String name, DefaultChannelHandlerContext nextCtx, DefaultChannelHandlerContext newCtx) {
             callBeforeAdd(newCtx);
     
             if (nextCtx != null) {
    @@ -144,7 +146,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
                     checkDuplicateName(name);
     
                     final DefaultChannelHandlerContext oldTail = tail;
    -                final DefaultChannelHandlerContext newTail = new DefaultChannelHandlerContext(this, executor, oldTail, null, name, handler);
    +                final DefaultChannelHandlerContext newTail =
    +                        new DefaultChannelHandlerContext(this, executor, oldTail, null, name, handler);
     
                     if (!newTail.channel().isRegistered() || newTail.executor().inEventLoop()) {
                         addLast0(name, oldTail, newTail);
    @@ -177,7 +180,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
     
         }
     
    -    private void addLast0(final String name, DefaultChannelHandlerContext oldTail, DefaultChannelHandlerContext newTail) {
    +    private void addLast0(
    +            final String name, DefaultChannelHandlerContext oldTail, DefaultChannelHandlerContext newTail) {
             callBeforeAdd(newTail);
     
             oldTail.next = newTail;
    @@ -193,14 +197,16 @@ public class DefaultChannelPipeline implements ChannelPipeline {
         }
     
         @Override
    -    public ChannelPipeline addBefore(EventExecutor executor, String baseName, final String name, final ChannelHandler handler) {
    +    public ChannelPipeline addBefore(
    +            EventExecutor executor, String baseName, final String name, final ChannelHandler handler) {
             try {
                 Future future;
     
                 synchronized (this) {
                     final DefaultChannelHandlerContext ctx = getContextOrDie(baseName);
                     checkDuplicateName(name);
    -                final DefaultChannelHandlerContext newCtx = new DefaultChannelHandlerContext(this, executor, ctx.prev, ctx, name, handler);
    +                final DefaultChannelHandlerContext newCtx =
    +                        new DefaultChannelHandlerContext(this, executor, ctx.prev, ctx, name, handler);
     
                     if (!newCtx.channel().isRegistered() || newCtx.executor().inEventLoop()) {
                         addBefore0(name, ctx, newCtx);
    @@ -250,7 +256,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
         }
     
         @Override
    -    public ChannelPipeline addAfter(EventExecutor executor, String baseName, final String name, final ChannelHandler handler) {
    +    public ChannelPipeline addAfter(
    +            EventExecutor executor, String baseName, final String name, final ChannelHandler handler) {
     
             try {
                 Future future;
    @@ -261,7 +268,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
                         return addLast(name, handler);
                     }
                     checkDuplicateName(name);
    -                final DefaultChannelHandlerContext newCtx = new DefaultChannelHandlerContext(this, executor, ctx, ctx.next, name, handler);
    +                final DefaultChannelHandlerContext newCtx =
    +                        new DefaultChannelHandlerContext(this, executor, ctx, ctx.next, name, handler);
     
                     if (!newCtx.channel().isRegistered() || newCtx.executor().inEventLoop()) {
                         addAfter0(name, ctx, newCtx);
    @@ -531,7 +539,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
             return (T) replace(getContextOrDie(oldHandlerType), newName, newHandler);
         }
     
    -    private ChannelHandler replace(final DefaultChannelHandlerContext ctx, final String newName, final ChannelHandler newHandler) {
    +    private ChannelHandler replace(
    +            final DefaultChannelHandlerContext ctx, final String newName, final ChannelHandler newHandler) {
             try {
                 Future future;
                 synchronized (this) {
    @@ -542,7 +551,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
                             throw new NoSuchElementException();
                         }
                         final DefaultChannelHandlerContext oldTail = tail;
    -                    final DefaultChannelHandlerContext newTail = new DefaultChannelHandlerContext(this, null, oldTail, null, newName, newHandler);
    +                    final DefaultChannelHandlerContext newTail =
    +                            new DefaultChannelHandlerContext(this, null, oldTail, null, newName, newHandler);
     
                         if (!oldTail.channel().isRegistered() || oldTail.executor().inEventLoop()) {
                             removeLast0(oldTail);
    @@ -570,7 +580,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
                         DefaultChannelHandlerContext prev = ctx.prev;
                         DefaultChannelHandlerContext next = ctx.next;
     
    -                    final DefaultChannelHandlerContext newCtx = new DefaultChannelHandlerContext(this, ctx.executor, prev, next, newName, newHandler);
    +                    final DefaultChannelHandlerContext newCtx =
    +                            new DefaultChannelHandlerContext(this, ctx.executor, prev, next, newName, newHandler);
     
                         if (!newCtx.channel().isRegistered() || newCtx.executor().inEventLoop()) {
                             replace0(ctx, newName, newCtx);
    @@ -1263,7 +1274,8 @@ public class DefaultChannelPipeline implements ChannelPipeline {
             return bind(firstContext(ChannelHandlerType.OPERATION), localAddress, future);
         }
     
    -    ChannelFuture bind(final DefaultChannelHandlerContext ctx, final SocketAddress localAddress, final ChannelFuture future) {
    +    ChannelFuture bind(
    +            final DefaultChannelHandlerContext ctx, final SocketAddress localAddress, final ChannelFuture future) {
             if (localAddress == null) {
                 throw new NullPointerException("localAddress");
             }
    @@ -1297,7 +1309,9 @@ public class DefaultChannelPipeline implements ChannelPipeline {
             return connect(firstContext(ChannelHandlerType.OPERATION), remoteAddress, localAddress, future);
         }
     
    -    ChannelFuture connect(final DefaultChannelHandlerContext ctx, final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelFuture future) {
    +    ChannelFuture connect(
    +            final DefaultChannelHandlerContext ctx, final SocketAddress remoteAddress,
    +            final SocketAddress localAddress, final ChannelFuture future) {
             if (remoteAddress == null) {
                 throw new NullPointerException("remoteAddress");
             }
    diff --git a/transport/src/main/java/io/netty/channel/SingleThreadEventExecutor.java b/transport/src/main/java/io/netty/channel/SingleThreadEventExecutor.java
    index e2194ecc79..9dff1f83ad 100644
    --- a/transport/src/main/java/io/netty/channel/SingleThreadEventExecutor.java
    +++ b/transport/src/main/java/io/netty/channel/SingleThreadEventExecutor.java
    @@ -49,7 +49,8 @@ public abstract class SingleThreadEventExecutor extends AbstractExecutorService
         private static final long START_TIME = System.nanoTime();
         private static final AtomicLong nextTaskId = new AtomicLong();
     
    -    static final ThreadLocal CURRENT_EVENT_LOOP = new ThreadLocal();
    +    static final ThreadLocal CURRENT_EVENT_LOOP =
    +            new ThreadLocal();
     
         public static SingleThreadEventExecutor currentEventLoop() {
             return CURRENT_EVENT_LOOP.get();
    diff --git a/transport/src/main/java/io/netty/channel/socket/DatagramChannel.java b/transport/src/main/java/io/netty/channel/socket/DatagramChannel.java
    index 27965a4e62..d430a73524 100644
    --- a/transport/src/main/java/io/netty/channel/socket/DatagramChannel.java
    +++ b/transport/src/main/java/io/netty/channel/socket/DatagramChannel.java
    @@ -45,10 +45,12 @@ public interface DatagramChannel extends Channel {
          * Joins the specified multicast group at the specified interface.
          */
         ChannelFuture joinGroup(InetSocketAddress multicastAddress, NetworkInterface networkInterface);
    -    ChannelFuture joinGroup(InetSocketAddress multicastAddress, NetworkInterface networkInterface, ChannelFuture future);
    +    ChannelFuture joinGroup(
    +            InetSocketAddress multicastAddress, NetworkInterface networkInterface, ChannelFuture future);
     
         ChannelFuture joinGroup(InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source);
    -    ChannelFuture joinGroup(InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source, ChannelFuture future);
    +    ChannelFuture joinGroup(
    +            InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source, ChannelFuture future);
     
         /**
          * Leaves a multicast group.
    @@ -60,7 +62,8 @@ public interface DatagramChannel extends Channel {
          * Leaves a multicast group on a specified local interface.
          */
         ChannelFuture leaveGroup(InetSocketAddress multicastAddress, NetworkInterface networkInterface);
    -    ChannelFuture leaveGroup(InetSocketAddress multicastAddress, NetworkInterface networkInterface, ChannelFuture future);
    +    ChannelFuture leaveGroup(
    +            InetSocketAddress multicastAddress, NetworkInterface networkInterface, ChannelFuture future);
     
         /**
          * Leave the specified multicast group at the specified interface using the specified source.
    diff --git a/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java b/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java
    index 202539d028..eaf9f73aa8 100644
    --- a/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java
    +++ b/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java
    @@ -17,9 +17,9 @@ package io.netty.channel.socket;
     
     import io.netty.channel.ChannelConfig;
     
    -import java.net.DatagramSocket;
     import java.net.InetAddress;
     import java.net.NetworkInterface;
    +import java.net.StandardSocketOptions;
     
     /**
      * A {@link ChannelConfig} for a {@link DatagramChannel}.
    @@ -56,22 +56,22 @@ import java.net.NetworkInterface;
     public interface DatagramChannelConfig extends ChannelConfig {
     
         /**
    -     * Gets the {@code SO_SNDBUF} option.
    +     * Gets the {@link StandardSocketOptions#SO_SNDBUF} option.
          */
         int getSendBufferSize();
     
         /**
    -     * Sets the {@code SO_SNDBUF} option.
    +     * Sets the {@link StandardSocketOptions#SO_SNDBUF} option.
          */
         void setSendBufferSize(int sendBufferSize);
     
         /**
    -     * Gets the {@code SO_RCVBUF} option.
    +     * Gets the {@link StandardSocketOptions#SO_RCVBUF} option.
          */
         int getReceiveBufferSize();
     
         /**
    -     * Gets the {@code SO_RCVBUF} option.
    +     * Sets the {@link StandardSocketOptions#SO_RCVBUF} option.
          */
         void setReceiveBufferSize(int receiveBufferSize);
     
    @@ -80,44 +80,44 @@ public interface DatagramChannelConfig extends ChannelConfig {
         void setReceivePacketSize(int receivePacketSize);
     
         /**
    -     * Gets the traffic class.
    +     * Gets the {@link StandardSocketOptions#IP_TOS} option.
          */
         int getTrafficClass();
     
         /**
    -     * Sets the traffic class as specified in {@link DatagramSocket#setTrafficClass(int)}.
    +     * Sets the {@link StandardSocketOptions#IP_TOS} option.
          */
         void setTrafficClass(int trafficClass);
     
         /**
    -     * Gets the {@code SO_REUSEADDR} option.
    +     * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option.
          */
         boolean isReuseAddress();
     
         /**
    -     * Sets the {@code SO_REUSEADDR} option.
    +     * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option.
          */
         void setReuseAddress(boolean reuseAddress);
     
         /**
    -     * Gets the {@code SO_BROADCAST} option.
    +     * Gets the {@link StandardSocketOptions#SO_BROADCAST} option.
          */
         boolean isBroadcast();
     
         /**
    -     * Sets the {@code SO_BROADCAST} option.
    +     * Sets the {@link StandardSocketOptions#SO_BROADCAST} option.
          */
         void setBroadcast(boolean broadcast);
     
         /**
    -     * Gets the setting for local loopback of multicast datagrams.
    +     * Gets the {@link StandardSocketOptions#IP_MULTICAST_LOOP} option.
          *
          * @return {@code true} if and only if the loopback mode has been disabled
          */
         boolean isLoopbackModeDisabled();
     
         /**
    -     * Sets the setting for local loopback of multicast datagrams.
    +     * Sets the {@link StandardSocketOptions#IP_MULTICAST_LOOP} option.
          *
          * @param loopbackModeDisabled
          *        {@code true} if and only if the loopback mode has been disabled
    @@ -125,14 +125,12 @@ public interface DatagramChannelConfig extends ChannelConfig {
         void setLoopbackModeDisabled(boolean loopbackModeDisabled);
     
         /**
    -     * Gets the default time-to-live for multicast packets sent out on the
    -     * socket.
    +     * Gets the {@link StandardSocketOptions#IP_MULTICAST_TTL} option.
          */
         int getTimeToLive();
     
         /**
    -     * Sets the default time-to-live for multicast packets sent out on the
    -     * {@link DatagramChannel} in order to control the scope of the multicasts.
    +     * Sets the {@link StandardSocketOptions#IP_MULTICAST_TTL} option.
          */
         void setTimeToLive(int ttl);
     
    @@ -147,14 +145,12 @@ public interface DatagramChannelConfig extends ChannelConfig {
         void setInterface(InetAddress interfaceAddress);
     
         /**
    -     * Gets the network interface for outgoing multicast datagrams sent on
    -     * the {@link DatagramChannel}.
    +     * Gets the {@link StandardSocketOptions#IP_MULTICAST_IF} option.
          */
         NetworkInterface getNetworkInterface();
     
         /**
    -     * Sets the network interface for outgoing multicast datagrams sent on
    -     * the {@link DatagramChannel}.
    +     * Sets the {@link StandardSocketOptions#IP_MULTICAST_IF} option.
          */
         void setNetworkInterface(NetworkInterface networkInterface);
     }
    diff --git a/transport/src/main/java/io/netty/channel/socket/ServerSocketChannelConfig.java b/transport/src/main/java/io/netty/channel/socket/ServerSocketChannelConfig.java
    index f9f64109c8..66d7dc8a6b 100644
    --- a/transport/src/main/java/io/netty/channel/socket/ServerSocketChannelConfig.java
    +++ b/transport/src/main/java/io/netty/channel/socket/ServerSocketChannelConfig.java
    @@ -18,6 +18,7 @@ package io.netty.channel.socket;
     import io.netty.channel.ChannelConfig;
     
     import java.net.ServerSocket;
    +import java.net.StandardSocketOptions;
     
     /**
      * A {@link ChannelConfig} for a {@link ServerSocketChannel}.
    @@ -55,22 +56,22 @@ public interface ServerSocketChannelConfig extends ChannelConfig {
         void setBacklog(int backlog);
     
         /**
    -     * Gets the {@code SO_REUSEADDR} option.
    +     * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option.
          */
         boolean isReuseAddress();
     
         /**
    -     * Sets the {@code SO_REUSEADDR} option.
    +     * Sets the {@link StandardSocketOptions#SO_REUSEADDR} option.
          */
         void setReuseAddress(boolean reuseAddress);
     
         /**
    -     * Gets the {@code SO_RCVBUF} option.
    +     * Gets the {@link StandardSocketOptions#SO_RCVBUF} option.
          */
         int getReceiveBufferSize();
     
         /**
    -     * Sets the {@code SO_RCVBUF} option.
    +     * Gets the {@link StandardSocketOptions#SO_SNDBUF} option.
          */
         void setReceiveBufferSize(int receiveBufferSize);
     
    diff --git a/transport/src/main/java/io/netty/channel/socket/SocketChannelConfig.java b/transport/src/main/java/io/netty/channel/socket/SocketChannelConfig.java
    index 710d31dcb5..29815c0892 100644
    --- a/transport/src/main/java/io/netty/channel/socket/SocketChannelConfig.java
    +++ b/transport/src/main/java/io/netty/channel/socket/SocketChannelConfig.java
    @@ -18,6 +18,7 @@ package io.netty.channel.socket;
     import io.netty.channel.ChannelConfig;
     
     import java.net.Socket;
    +import java.net.StandardSocketOptions;
     
     /**
      * A {@link ChannelConfig} for a {@link SocketChannel}.
    @@ -50,72 +51,72 @@ import java.net.Socket;
     public interface SocketChannelConfig extends ChannelConfig {
     
         /**
    -     * Gets the {@code SO_TCPNODELAY} option.
    +     * Gets the {@link StandardSocketOptions#TCP_NODELAY} option.
          */
         boolean isTcpNoDelay();
     
         /**
    -     * Sets the {@code SO_TCPNODELAY} option.
    +     * Sets the {@link StandardSocketOptions#TCP_NODELAY} option.
          */
         void setTcpNoDelay(boolean tcpNoDelay);
     
         /**
    -     * Gets the {@code SO_LINGER} option.
    +     * Gets the {@link StandardSocketOptions#SO_LINGER} option.
          */
         int getSoLinger();
     
         /**
    -     * Sets the {@code SO_LINGER} option.
    +     * Sets the {@link StandardSocketOptions#SO_LINGER} option.
          */
         void setSoLinger(int soLinger);
     
         /**
    -     * Gets the {@code SO_SNDBUF} option.
    +     * Gets the {@link StandardSocketOptions#SO_SNDBUF} option.
          */
         int getSendBufferSize();
     
         /**
    -     * Sets the {@code SO_SNDBUF} option.
    +     * Sets the {@link StandardSocketOptions#SO_SNDBUF} option.
          */
         void setSendBufferSize(int sendBufferSize);
     
         /**
    -     * Gets the {@code SO_RCVBUF} option.
    +     * Gets the {@link StandardSocketOptions#SO_RCVBUF} option.
          */
         int getReceiveBufferSize();
     
         /**
    -     * Gets the {@code SO_RCVBUF} option.
    +     * Sets the {@link StandardSocketOptions#SO_RCVBUF} option.
          */
         void setReceiveBufferSize(int receiveBufferSize);
     
         /**
    -     * Gets the {@code SO_KEEPALIVE} option.
    +     * Gets the {@link StandardSocketOptions#SO_KEEPALIVE} option.
          */
         boolean isKeepAlive();
     
         /**
    -     * Sets the {@code SO_KEEPALIVE} option.
    +     * Sets the {@link StandardSocketOptions#SO_KEEPALIVE} option.
          */
         void setKeepAlive(boolean keepAlive);
     
         /**
    -     * Gets the traffic class.
    +     * Gets the {@link StandardSocketOptions#IP_TOS} option.
          */
         int getTrafficClass();
     
         /**
    -     * Sets the traffic class as specified in {@link Socket#setTrafficClass(int)}.
    +     * Sets the {@link StandardSocketOptions#IP_TOS} option.
          */
         void setTrafficClass(int trafficClass);
     
         /**
    -     * Gets the {@code SO_REUSEADDR} option.
    +     * Gets the {@link StandardSocketOptions#SO_REUSEADDR} option.
          */
         boolean isReuseAddress();
     
         /**
    -     * Sets the {@code SO_REUSEADDR} option.
    +     * Sets the {@link StandardSocketOptions#SO_REUSEADDR} option.
          */
         void setReuseAddress(boolean reuseAddress);
     
    @@ -123,6 +124,5 @@ public interface SocketChannelConfig extends ChannelConfig {
          * Sets the performance preferences as specified in
          * {@link Socket#setPerformancePreferences(int, int, int)}.
          */
    -    void setPerformancePreferences(
    -            int connectionTime, int latency, int bandwidth);
    +    void setPerformancePreferences(int connectionTime, int latency, int bandwidth);
     }
    diff --git a/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioChannel.java
    index fa42341f57..01f16cca80 100644
    --- a/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioChannel.java
    +++ b/transport/src/main/java/io/netty/channel/socket/nio/AbstractNioChannel.java
    @@ -113,7 +113,8 @@ public abstract class AbstractNioChannel extends AbstractChannel {
             }
     
             @Override
    -        public void connect(final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelFuture future) {
    +        public void connect(
    +                final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelFuture future) {
                 if (eventLoop().inEventLoop()) {
                     if (!ensureOpen(future)) {
                         return;
    diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java
    index db65ff179e..1963b9d54c 100644
    --- a/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java
    +++ b/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannel.java
    @@ -44,7 +44,8 @@ import java.util.Queue;
     /**
      * Provides an NIO based {@link io.netty.channel.socket.DatagramChannel}.
      */
    -public final class NioDatagramChannel extends AbstractNioMessageChannel implements io.netty.channel.socket.DatagramChannel {
    +public final class NioDatagramChannel
    +        extends AbstractNioMessageChannel implements io.netty.channel.socket.DatagramChannel {
     
         private final DatagramChannelConfig config;
         private final Map> memberships =
    @@ -299,7 +300,8 @@ public final class NioDatagramChannel extends AbstractNioMessageChannel implemen
         @Override
         public ChannelFuture leaveGroup(InetAddress multicastAddress, ChannelFuture future) {
             try {
    -            return leaveGroup(multicastAddress, NetworkInterface.getByInetAddress(localAddress().getAddress()), null, future);
    +            return leaveGroup(
    +                    multicastAddress, NetworkInterface.getByInetAddress(localAddress().getAddress()), null, future);
             } catch (SocketException e) {
                 future.setFailure(e);
             }
    @@ -348,7 +350,8 @@ public final class NioDatagramChannel extends AbstractNioMessageChannel implemen
                         while (keyIt.hasNext()) {
                             MembershipKey key = keyIt.next();
                             if (networkInterface.equals(key.networkInterface())) {
    -                           if (source == null && key.sourceAddress() == null || source != null && source.equals(key.sourceAddress())) {
    +                           if (source == null && key.sourceAddress() == null ||
    +                               source != null && source.equals(key.sourceAddress())) {
                                    key.drop();
                                    keyIt.remove();
                                }
    diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannelConfig.java b/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannelConfig.java
    index 98db8d02cc..b851438fb8 100644
    --- a/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannelConfig.java
    +++ b/transport/src/main/java/io/netty/channel/socket/nio/NioDatagramChannelConfig.java
    @@ -46,6 +46,12 @@ class NioDatagramChannelConfig extends DefaultDatagramChannelConfig {
             } catch (Exception e) {
                 // Not Java 7+
             }
    +        Class stdSocketOptionType = null;
    +        try {
    +            stdSocketOptionType = Class.forName("java.net.StandardSocketOptions", true, classLoader);
    +        } catch (Exception e) {
    +            // Not Java 7+
    +        }
     
             Object ipMulticastTtl = null;
             Object ipMulticastIf = null;
    @@ -54,19 +60,19 @@ class NioDatagramChannelConfig extends DefaultDatagramChannelConfig {
             Method setOption = null;
             if (socketOptionType != null) {
                 try {
    -                ipMulticastTtl = Class.forName("java.net.StandardSocketOptions", true, classLoader).getDeclaredField("IP_MULTICAST_TTL").get(null);
    +                ipMulticastTtl = stdSocketOptionType.getDeclaredField("IP_MULTICAST_TTL").get(null);
                 } catch (Exception e) {
                     throw new Error("cannot locate the IP_MULTICAST_TTL field", e);
                 }
     
                 try {
    -                ipMulticastIf = Class.forName("java.net.StandardSocketOptions", true, classLoader).getDeclaredField("IP_MULTICAST_IF").get(null);
    +                ipMulticastIf = stdSocketOptionType.getDeclaredField("IP_MULTICAST_IF").get(null);
                 } catch (Exception e) {
                     throw new Error("cannot locate the IP_MULTICAST_IF field", e);
                 }
     
                 try {
    -                ipMulticastLoop = Class.forName("java.net.StandardSocketOptions", true, classLoader).getDeclaredField("IP_MULTICAST_LOOP").get(null);
    +                ipMulticastLoop = stdSocketOptionType.getDeclaredField("IP_MULTICAST_LOOP").get(null);
                 } catch (Exception e) {
                     throw new Error("cannot locate the IP_MULTICAST_LOOP field", e);
                 }