From f474fc609af1d401b601d2370ba0756b64654b1d Mon Sep 17 00:00:00 2001 From: Aaron Riekenberg Date: Sat, 20 Aug 2011 19:58:23 -0500 Subject: [PATCH 01/93] Add failImmediatelyOnTooLongFrameOption. --- .../frame/DelimiterBasedFrameDecoder.java | 27 ++++++++++++-- .../frame/LengthFieldBasedFrameDecoder.java | 36 +++++++++++++++---- .../frame/DelimiterBasedFrameDecoderTest.java | 21 +++++++++++ .../LengthFieldBasedFrameDecoderTest.java | 21 +++++++++++ 4 files changed, 96 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java index c45940b9c1..6f4dd99963 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java @@ -69,6 +69,7 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { private final boolean stripDelimiter; private boolean discardingTooLongFrame; private int tooLongFrameLength; + private boolean failImmediatelyOnTooLongFrame = false; /** * Creates a new instance. @@ -169,11 +170,11 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { discardingTooLongFrame = false; buffer.skipBytes(minFrameLength + minDelimLength); - // TODO Let user choose when the exception should be raised - early or late? - // If early, fail() should be called when discardingTooLongFrame is set to true. int tooLongFrameLength = this.tooLongFrameLength; this.tooLongFrameLength = 0; - fail(ctx, tooLongFrameLength); + if (!failImmediatelyOnTooLongFrame) { + fail(ctx, tooLongFrameLength); + } return null; } @@ -199,6 +200,9 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { tooLongFrameLength = buffer.readableBytes(); buffer.skipBytes(buffer.readableBytes()); discardingTooLongFrame = true; + if (failImmediatelyOnTooLongFrame) { + fail(ctx, tooLongFrameLength); + } } } else { // Still discarding the buffer since a delimiter is not found. @@ -209,6 +213,23 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { } } + /** + * Set the behavior when a frame longer than maxFrameLength is encountered. + * + * @param failImmediatelyOnTooLongFrame If false (the default) a {@link TooLongFrameException} + * is thrown if the length of the frame exceeds maxFrameLength, + * after the delimiter has been read. + * If true a {@link TooLongFrameException} is thrown immediately + * when the length of the frame exceeds maxFrameLength, + * regardless of whether a delimiter has been found yet. + */ + public DelimiterBasedFrameDecoder setFailImmediatelyOnTooLongFrame( + boolean failImmediatelyOnTooLongFrame) + { + this.failImmediatelyOnTooLongFrame = failImmediatelyOnTooLongFrame; + return this; + } + private void fail(ChannelHandlerContext ctx, long frameLength) { if (frameLength > 0) { Channels.fireExceptionCaught( diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java index 292f24a68e..ec67571642 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java @@ -198,6 +198,7 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { private boolean discardingTooLongFrame; private long tooLongFrameLength; private long bytesToDiscard; + private boolean failImmediatelyOnTooLongFrame = false; /** * Creates a new instance. @@ -290,7 +291,7 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { buffer.skipBytes(localBytesToDiscard); bytesToDiscard -= localBytesToDiscard; this.bytesToDiscard = bytesToDiscard; - failIfNecessary(ctx); + failIfNecessary(ctx, false); return null; } @@ -340,7 +341,7 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { tooLongFrameLength = frameLength; bytesToDiscard = frameLength - buffer.readableBytes(); buffer.skipBytes(buffer.readableBytes()); - failIfNecessary(ctx); + failIfNecessary(ctx, true); return null; } @@ -366,19 +367,25 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { return frame; } - private void failIfNecessary(ChannelHandlerContext ctx) { + private void failIfNecessary(ChannelHandlerContext ctx, boolean firstDetectionOfTooLongFrame) { if (bytesToDiscard == 0) { // Reset to the initial state and tell the handlers that // the frame was too large. - // TODO Let user choose when the exception should be raised - early or late? - // If early, fail() should be called when discardingTooLongFrame is set to true. long tooLongFrameLength = this.tooLongFrameLength; this.tooLongFrameLength = 0; discardingTooLongFrame = false; - fail(ctx, tooLongFrameLength); + if (!failImmediatelyOnTooLongFrame) + { + fail(ctx, tooLongFrameLength); + } } else { // Keep discarding. } + + if (firstDetectionOfTooLongFrame && failImmediatelyOnTooLongFrame) + { + fail(ctx, tooLongFrameLength); + } } /** @@ -402,6 +409,23 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { return frame; } + /** + * Set the behavior when a frame longer than maxFrameLength is encountered. + * + * @param failImmediatelyOnTooLongFrame If false (the default) a {@link TooLongFrameException} + * is thrown if the length of the frame exceeds maxFrameLength, + * after the delimiter has been read. + * If true a {@link TooLongFrameException} is thrown immediately + * when the length of the frame exceeds maxFrameLength, + * regardless of whether a delimiter has been found yet. + */ + public LengthFieldBasedFrameDecoder setFailImmediatelyOnTooLongFrame( + boolean failImmediatelyOnTooLongFrame) + { + this.failImmediatelyOnTooLongFrame = failImmediatelyOnTooLongFrame; + return this; + } + private void fail(ChannelHandlerContext ctx, long frameLength) { if (frameLength > 0) { Channels.fireExceptionCaught( diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java index ccd1bfe463..6d67acb0e4 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java @@ -46,4 +46,25 @@ public class DelimiterBasedFrameDecoderTest { Assert.assertEquals("A", buf.toString(CharsetUtil.ISO_8859_1)); } } + + @Test + public void testFailImmediatelyTooLongFrameRecovery() throws Exception { + DecoderEmbedder embedder = new DecoderEmbedder( + new DelimiterBasedFrameDecoder(1, Delimiters.nulDelimiter()). + setFailImmediatelyOnTooLongFrame(true)); + + for (int i = 0; i < 2; i ++) { + try { + embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 1, 2 })); + Assert.fail(CodecEmbedderException.class.getSimpleName() + " must be raised."); + } catch (CodecEmbedderException e) { + Assert.assertTrue(e.getCause() instanceof TooLongFrameException); + // Expected + } + + embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0, 'A', 0 })); + ChannelBuffer buf = embedder.poll(); + Assert.assertEquals("A", buf.toString(CharsetUtil.ISO_8859_1)); + } + } } diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoderTest.java index 777c4dc501..b1402f3c8a 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoderTest.java @@ -46,4 +46,25 @@ public class LengthFieldBasedFrameDecoderTest { Assert.assertEquals("A", buf.toString(CharsetUtil.ISO_8859_1)); } } + + @Test + public void testFailImmediatelyTooLongFrameRecovery() throws Exception { + DecoderEmbedder embedder = new DecoderEmbedder( + new LengthFieldBasedFrameDecoder(5, 0, 4, 0, 4). + setFailImmediatelyOnTooLongFrame(true)); + + for (int i = 0; i < 2; i ++) { + try { + embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0, 0, 0, 2 })); + Assert.fail(CodecEmbedderException.class.getSimpleName() + " must be raised."); + } catch (CodecEmbedderException e) { + Assert.assertTrue(e.getCause() instanceof TooLongFrameException); + // Expected + } + + embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0, 0, 0, 0, 0, 1, 'A' })); + ChannelBuffer buf = embedder.poll(); + Assert.assertEquals("A", buf.toString(CharsetUtil.ISO_8859_1)); + } + } } From c2417c253c48bac942decfe923743d2b09d63a5f Mon Sep 17 00:00:00 2001 From: Aaron Riekenberg Date: Sat, 20 Aug 2011 20:11:28 -0500 Subject: [PATCH 02/93] Cleanup failIfNecessary, fix comment. --- .../frame/LengthFieldBasedFrameDecoder.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java index ec67571642..f9bc135f50 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java @@ -374,18 +374,19 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { long tooLongFrameLength = this.tooLongFrameLength; this.tooLongFrameLength = 0; discardingTooLongFrame = false; - if (!failImmediatelyOnTooLongFrame) + if ((!failImmediatelyOnTooLongFrame) || + (failImmediatelyOnTooLongFrame && firstDetectionOfTooLongFrame)) { fail(ctx, tooLongFrameLength); } } else { - // Keep discarding. + // Keep discarding and notify handlers if necessary. + if (failImmediatelyOnTooLongFrame && firstDetectionOfTooLongFrame) + { + fail(ctx, this.tooLongFrameLength); + } } - if (firstDetectionOfTooLongFrame && failImmediatelyOnTooLongFrame) - { - fail(ctx, tooLongFrameLength); - } } /** @@ -414,10 +415,10 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { * * @param failImmediatelyOnTooLongFrame If false (the default) a {@link TooLongFrameException} * is thrown if the length of the frame exceeds maxFrameLength, - * after the delimiter has been read. + * after the entire frame has been read. * If true a {@link TooLongFrameException} is thrown immediately * when the length of the frame exceeds maxFrameLength, - * regardless of whether a delimiter has been found yet. + * regardless of whether the entire frame has been read. */ public LengthFieldBasedFrameDecoder setFailImmediatelyOnTooLongFrame( boolean failImmediatelyOnTooLongFrame) From bb5bbdc99e6f68e59aec6215f12a5f7774f10012 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Mon, 31 Oct 2011 15:19:50 -0700 Subject: [PATCH 03/93] Upgrade to JUnit 4.10 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 37a0e0106c..0754080c99 100644 --- a/pom.xml +++ b/pom.xml @@ -162,7 +162,7 @@ junit junit - 4.8.2 + 4.10 test From 56462ef91a6481c2926dbebadebc114c08a81a8b Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 1 Nov 2011 20:09:38 +0100 Subject: [PATCH 04/93] Encoder and Decoder that wrap and unwraps the array of bytes. See NETTY-357 --- .../handler/codec/bytes/ByteArrayDecoder.java | 84 +++++++++++++++++++ .../handler/codec/bytes/ByteArrayEncoder.java | 69 +++++++++++++++ .../handler/codec/bytes/package-info.java | 23 +++++ .../codec/bytes/ByteArrayDecoderTest.java | 64 ++++++++++++++ .../codec/bytes/ByteArrayEncoderTest.java | 65 ++++++++++++++ 5 files changed, 305 insertions(+) create mode 100644 src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/bytes/package-info.java create mode 100644 src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoderTest.java create mode 100644 src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoderTest.java diff --git a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java new file mode 100644 index 0000000000..9bd272d6cd --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java @@ -0,0 +1,84 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.bytes; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.channel.MessageEvent; +import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; +import org.jboss.netty.handler.codec.frame.LengthFieldPrepender; +import org.jboss.netty.handler.codec.oneone.OneToOneDecoder; + +/** + * Decodes a received {@link ChannelBuffer} into an array of bytes. + * A typical setup for TCP/IP would be: + *
+ * {@link ChannelPipeline} pipeline = ...;
+ *
+ * // Decoders
+ * pipeline.addLast("frameDecoder",
+ *                  new {@link LengthFieldBasedFrameDecoder}(1048576, 0, 4, 0, 4));
+ * pipeline.addLast("bytesDecoder",
+ *                  new {@link ByteArrayDecoder}());
+ *
+ * // Encoder
+ * pipeline.addLast("frameEncoder", new {@link LengthFieldPrepender}(4));
+ * pipeline.addLast("bytesEncoder", new {@link ByteArrayEncoder}());
+ * 
+ * and then you can use an array of bytes instead of a {@link ChannelBuffer} + * as a message: + *
+ * void messageReceived({@link ChannelHandlerContext} ctx, {@link MessageEvent} e) {
+ *     byte[] bytes = (byte[]) e.getMessage();
+ *     ...
+ * }
+ * 
+ * + * @author The Netty Project + * @author Tomasz Blachowicz (tblachowicz@gmail.com) + * + * @version $Rev$, $Date$ + */ +public class ByteArrayDecoder extends OneToOneDecoder { + + @Override + protected Object decode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { + if (!(msg instanceof ChannelBuffer)) { + return msg; + } + ChannelBuffer buf = (ChannelBuffer )msg; + byte[] array; + if (buf.hasArray()) { + if (buf.arrayOffset() == 0 && buf.readableBytes() == buf.capacity()) { + // we have no offset and the length is the same as the capacity. Its safe to reuse the array without copy it first + array = buf.array(); + } else { + // copy the ChannelBuffer to a byte array + array = new byte[buf.readableBytes()]; + buf.getBytes(0, array); + } + } else { + // copy the ChannelBuffer to a byte array + + array = new byte[buf.readableBytes()]; + buf.getBytes(0, array); + } + return array; + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java new file mode 100644 index 0000000000..1267f9b160 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java @@ -0,0 +1,69 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.bytes; + +import static org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.channel.MessageEvent; +import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; +import org.jboss.netty.handler.codec.frame.LengthFieldPrepender; +import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; + +/** + * Encodes the requested array of bytes into a {@link ChannelBuffer}. + * A typical setup for TCP/IP would be: + *
+ * {@link ChannelPipeline} pipeline = ...;
+ *
+ * // Decoders
+ * pipeline.addLast("frameDecoder",
+ *                  new {@link LengthFieldBasedFrameDecoder}(1048576, 0, 4, 0, 4));
+ * pipeline.addLast("bytesDecoder",
+ *                  new {@link ByteArrayDecoder}());
+ *
+ * // Encoder
+ * pipeline.addLast("frameEncoder", new {@link LengthFieldPrepender}(4));
+ * pipeline.addLast("bytesEncoder", new {@link ByteArrayEncoder}());
+ * 
+ * and then you can use an array of bytes instead of a {@link ChannelBuffer} + * as a message: + *
+ * void messageReceived({@link ChannelHandlerContext} ctx, {@link MessageEvent} e) {
+ *     byte[] bytes = (byte[]) e.getMessage();
+ *     ...
+ * }
+ * 
+ * + * @author The Netty Project + * @author Tomasz Blachowicz (tblachowicz@gmail.com) + * + * @version $Rev$, $Date$ + */ +public class ByteArrayEncoder extends OneToOneEncoder { + + @Override + protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { + if (!(msg instanceof byte[])) { + return msg; + } + return wrappedBuffer((byte[]) msg); + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/bytes/package-info.java b/src/main/java/org/jboss/netty/handler/codec/bytes/package-info.java new file mode 100644 index 0000000000..b09bfe8bfd --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/bytes/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * Red Hat 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. + */ + +/** + * Encoder and decoder which transform an array of bytes into a + * {@link org.jboss.netty.buffer.ChannelBuffer} and vice versa. + * + * @apiviz.exclude \.oneone\. + */ +package org.jboss.netty.handler.codec.bytes; diff --git a/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoderTest.java new file mode 100644 index 0000000000..380ed21108 --- /dev/null +++ b/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoderTest.java @@ -0,0 +1,64 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.bytes; + +import static org.hamcrest.core.Is.is; +import static org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer; +import static org.junit.Assert.assertThat; + +import java.util.Random; + +import org.jboss.netty.handler.codec.embedder.DecoderEmbedder; +import org.junit.Before; +import org.junit.Test; + +/** + * @author The Netty Project + * @author Tomasz Blachowicz (tblachowicz@gmail.com) + * @version $Rev$, $Date$ + */ +public class ByteArrayDecoderTest { + + private DecoderEmbedder embedder; + + @Before + public void setUp() { + embedder = new DecoderEmbedder(new ByteArrayDecoder()); + } + + @Test + public void testDecode() { + byte[] b = new byte[2048]; + new Random().nextBytes(b); + embedder.offer(wrappedBuffer(b)); + assertThat(embedder.poll(), is(b)); + } + + @Test + public void testDecodeEmpty() { + byte[] b = new byte[0]; + embedder.offer(wrappedBuffer(b)); + assertThat(embedder.poll(), is(b)); + } + + @Test + public void testDecodeOtherType() { + String str = "Meep!"; + embedder.offer(str); + assertThat(embedder.poll(), is((Object) str)); + } + +} diff --git a/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoderTest.java b/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoderTest.java new file mode 100644 index 0000000000..44ae01f524 --- /dev/null +++ b/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoderTest.java @@ -0,0 +1,65 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.bytes; + +import static org.hamcrest.core.Is.is; +import static org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer; +import static org.junit.Assert.assertThat; + +import java.util.Random; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.handler.codec.embedder.EncoderEmbedder; +import org.junit.Before; +import org.junit.Test; + +/** + * @author The Netty Project + * @author Tomasz Blachowicz (tblachowicz@gmail.com) + * @version $Rev$, $Date$ + */ +public class ByteArrayEncoderTest { + + private EncoderEmbedder embedder; + + @Before + public void setUp() { + embedder = new EncoderEmbedder(new ByteArrayEncoder()); + } + + @Test + public void testDecode() { + byte[] b = new byte[2048]; + new Random().nextBytes(b); + embedder.offer(b); + assertThat(embedder.poll(), is(wrappedBuffer(b))); + } + + @Test + public void testDecodeEmpty() { + byte[] b = new byte[0]; + embedder.offer(b); + assertThat(embedder.poll(), is(wrappedBuffer(b))); + } + + @Test + public void testDecodeOtherType() { + String str = "Meep!"; + embedder.offer(str); + assertThat(embedder.poll(), is((Object) str)); + } + +} From 84ed71d42dd951d7be5b14d37bcf56f383ecb965 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 2 Nov 2011 19:17:10 +0100 Subject: [PATCH 05/93] Use safe-construction when calling fireChannelOpen() etc. This code is based on the code of the following pull request: https://github.com/netty/netty/pull/18 It just make it apply again to current master --- .../channel/local/DefaultLocalChannel.java | 12 +++++++++-- .../DefaultLocalClientChannelFactory.java | 2 +- .../local/DefaultLocalServerChannel.java | 20 ++++++++++++++----- .../DefaultLocalServerChannelFactory.java | 2 +- .../channel/local/LocalClientChannelSink.java | 3 +-- .../http/HttpTunnelAcceptedChannel.java | 19 ++++++++++++++---- .../socket/http/HttpTunnelClientChannel.java | 13 ++++++++++-- .../http/HttpTunnelClientChannelFactory.java | 4 ++-- .../socket/http/HttpTunnelServerChannel.java | 15 ++++++++++---- .../http/HttpTunnelServerChannelFactory.java | 2 +- .../socket/nio/NioAcceptedSocketChannel.java | 15 ++++++++++---- .../socket/nio/NioClientSocketChannel.java | 11 ++++++++-- .../nio/NioClientSocketChannelFactory.java | 2 +- .../socket/nio/NioDatagramChannel.java | 12 ++++++++--- .../socket/nio/NioDatagramChannelFactory.java | 2 +- .../socket/nio/NioServerSocketChannel.java | 12 ++++++++--- .../nio/NioServerSocketChannelFactory.java | 2 +- .../nio/NioServerSocketPipelineSink.java | 6 ++---- .../socket/oio/OioAcceptedSocketChannel.java | 12 ++++++++++- .../socket/oio/OioClientSocketChannel.java | 12 ++++++++--- .../oio/OioClientSocketChannelFactory.java | 2 +- .../socket/oio/OioDatagramChannel.java | 12 ++++++++--- .../socket/oio/OioDatagramChannelFactory.java | 2 +- .../socket/oio/OioServerSocketChannel.java | 12 ++++++++--- .../oio/OioServerSocketChannelFactory.java | 2 +- .../oio/OioServerSocketPipelineSink.java | 8 ++------ 26 files changed, 154 insertions(+), 62 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java index 0e39600c61..455d43a578 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java @@ -59,7 +59,16 @@ final class DefaultLocalChannel extends AbstractChannel implements LocalChannel volatile LocalAddress localAddress; volatile LocalAddress remoteAddress; - DefaultLocalChannel(LocalServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, DefaultLocalChannel pairedChannel) { + static DefaultLocalChannel create(LocalServerChannel parent, + ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, + DefaultLocalChannel pairedChannel) { + DefaultLocalChannel instance = new DefaultLocalChannel(parent, factory, pipeline, sink, + pairedChannel); + fireChannelOpen(instance); + return instance; + } + + private DefaultLocalChannel(LocalServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, DefaultLocalChannel pairedChannel) { super(parent, factory, pipeline, sink); this.pairedChannel = pairedChannel; config = new DefaultChannelConfig(); @@ -73,7 +82,6 @@ final class DefaultLocalChannel extends AbstractChannel implements LocalChannel } }); - fireChannelOpen(this); } @Override diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalClientChannelFactory.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalClientChannelFactory.java index 8f80b8177f..aebf823ad1 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalClientChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalClientChannelFactory.java @@ -41,7 +41,7 @@ public class DefaultLocalClientChannelFactory implements LocalClientChannelFacto @Override public LocalChannel newChannel(ChannelPipeline pipeline) { - return new DefaultLocalChannel(null, this, pipeline, sink, null); + return DefaultLocalChannel.create(null, this, pipeline, sink, null); } /** diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannel.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannel.java index f79858339b..b187147fa1 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannel.java @@ -32,17 +32,27 @@ import org.jboss.netty.channel.DefaultServerChannelConfig; * @author Trustin Lee * @version $Rev$, $Date$ */ -final class DefaultLocalServerChannel extends AbstractServerChannel - implements LocalServerChannel { +final class DefaultLocalServerChannel extends AbstractServerChannel implements + LocalServerChannel { final ChannelConfig channelConfig; + final AtomicBoolean bound = new AtomicBoolean(); + volatile LocalAddress localAddress; - DefaultLocalServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { + static DefaultLocalServerChannel create(ChannelFactory factory, + ChannelPipeline pipeline, ChannelSink sink) { + DefaultLocalServerChannel instance = + new DefaultLocalServerChannel(factory, pipeline, sink); + fireChannelOpen(instance); + return instance; + } + + private DefaultLocalServerChannel(ChannelFactory factory, + ChannelPipeline pipeline, ChannelSink sink) { super(factory, pipeline, sink); channelConfig = new DefaultServerChannelConfig(); - fireChannelOpen(this); } @Override @@ -57,7 +67,7 @@ final class DefaultLocalServerChannel extends AbstractServerChannel @Override public LocalAddress getLocalAddress() { - return isBound()? localAddress : null; + return isBound() ? localAddress : null; } @Override diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java index 9379d472e9..496ba29f81 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java @@ -41,7 +41,7 @@ public class DefaultLocalServerChannelFactory implements LocalServerChannelFacto @Override public LocalServerChannel newChannel(ChannelPipeline pipeline) { - return new DefaultLocalServerChannel(this, pipeline, sink); + return DefaultLocalServerChannel.create(this, pipeline, sink); } /** diff --git a/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java b/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java index 891fe6c69f..421d7238d2 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java @@ -128,8 +128,7 @@ final class LocalClientChannelSink extends AbstractChannelSink { } future.setSuccess(); - DefaultLocalChannel acceptedChannel = new DefaultLocalChannel( - serverChannel, serverChannel.getFactory(), pipeline, this, channel); + DefaultLocalChannel acceptedChannel = DefaultLocalChannel.create(serverChannel, serverChannel.getFactory(), pipeline, this, channel); channel.pairedChannel = acceptedChannel; bind(channel, succeededFuture(channel), new LocalAddress(LocalAddress.EPHEMERAL)); diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannel.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannel.java index 5137bf15e3..6aa8c81405 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannel.java @@ -42,13 +42,27 @@ import org.jboss.netty.channel.socket.SocketChannelConfig; */ class HttpTunnelAcceptedChannel extends AbstractChannel implements SocketChannel, HttpTunnelAcceptedChannelReceiver { + private final HttpTunnelAcceptedChannelConfig config; private final HttpTunnelAcceptedChannelSink sink; private final InetSocketAddress remoteAddress; - protected HttpTunnelAcceptedChannel(HttpTunnelServerChannel parent, + protected static HttpTunnelAcceptedChannel create( + HttpTunnelServerChannel parent, ChannelFactory factory, + ChannelPipeline pipeline, HttpTunnelAcceptedChannelSink sink, + InetSocketAddress remoteAddress, + HttpTunnelAcceptedChannelConfig config) { + HttpTunnelAcceptedChannel instance = new HttpTunnelAcceptedChannel(parent, factory, pipeline, sink, + remoteAddress, config); + fireChannelOpen(instance); + fireChannelBound(instance, instance.getLocalAddress()); + fireChannelConnected(instance, instance.getRemoteAddress()); + return instance; + } + + private HttpTunnelAcceptedChannel(HttpTunnelServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline, HttpTunnelAcceptedChannelSink sink, InetSocketAddress remoteAddress, @@ -57,9 +71,6 @@ class HttpTunnelAcceptedChannel extends AbstractChannel implements this.config = config; this.sink = sink; this.remoteAddress = remoteAddress; - fireChannelOpen(this); - fireChannelBound(this, getLocalAddress()); - fireChannelConnected(this, getRemoteAddress()); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannel.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannel.java index 33f3db45f5..7e17e4798c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannel.java @@ -73,10 +73,20 @@ public class HttpTunnelClientChannel extends AbstractChannel implements private final SaturationManager saturationManager; + protected static HttpTunnelClientChannel create(ChannelFactory factory, + ChannelPipeline pipeline, HttpTunnelClientChannelSink sink, + ClientSocketChannelFactory outboundFactory, + ChannelGroup realConnections) { + HttpTunnelClientChannel instance = new HttpTunnelClientChannel(factory, pipeline, sink, + outboundFactory, realConnections); + Channels.fireChannelOpen(instance); + return instance; + } + /** * @see HttpTunnelClientChannelFactory#newChannel(ChannelPipeline) */ - protected HttpTunnelClientChannel(ChannelFactory factory, + private HttpTunnelClientChannel(ChannelFactory factory, ChannelPipeline pipeline, HttpTunnelClientChannelSink sink, ClientSocketChannelFactory outboundFactory, ChannelGroup realConnections) { @@ -97,7 +107,6 @@ public class HttpTunnelClientChannel extends AbstractChannel implements realConnections.add(sendChannel); realConnections.add(pollChannel); - Channels.fireChannelOpen(this); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelFactory.java index 381b861ed6..082b9229f7 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelFactory.java @@ -43,8 +43,8 @@ public class HttpTunnelClientChannelFactory implements @Override public HttpTunnelClientChannel newChannel(ChannelPipeline pipeline) { - return new HttpTunnelClientChannel(this, pipeline, - new HttpTunnelClientChannelSink(), factory, realConnections); + return HttpTunnelClientChannel.create(this, pipeline, new HttpTunnelClientChannelSink(), factory, + realConnections); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannel.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannel.java index f01c5fafa8..388d61b750 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannel.java @@ -49,18 +49,25 @@ public class HttpTunnelServerChannel extends AbstractServerChannel implements } }; - protected HttpTunnelServerChannel(HttpTunnelServerChannelFactory factory, + protected static HttpTunnelServerChannel create( + HttpTunnelServerChannelFactory factory, ChannelPipeline pipeline) { + HttpTunnelServerChannel instance = new HttpTunnelServerChannel(factory, pipeline); + Channels.fireChannelOpen(instance); + return instance; + } + + private HttpTunnelServerChannel(HttpTunnelServerChannelFactory factory, ChannelPipeline pipeline) { super(factory, pipeline, new HttpTunnelServerChannelSink()); messageSwitch = new ServerMessageSwitch(new TunnelCreator()); realChannel = factory.createRealChannel(this, messageSwitch); + // TODO fix calling of overrideable getPipeline() from constructor HttpTunnelServerChannelSink sink = (HttpTunnelServerChannelSink) getPipeline().getSink(); sink.setRealChannel(realChannel); sink.setCloseListener(CLOSE_FUTURE_PROXY); config = new HttpTunnelServerChannelConfig(realChannel); - Channels.fireChannelOpen(this); } @Override @@ -114,8 +121,8 @@ public class HttpTunnelServerChannel extends AbstractServerChannel implements HttpTunnelAcceptedChannelSink sink = new HttpTunnelAcceptedChannelSink(messageSwitch, newTunnelId, config); - return new HttpTunnelAcceptedChannel(HttpTunnelServerChannel.this, - getFactory(), childPipeline, sink, remoteAddress, config); + return HttpTunnelAcceptedChannel.create(HttpTunnelServerChannel.this, getFactory(), childPipeline, sink, + remoteAddress, config); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelFactory.java index ccb32514e2..32f3088e30 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelFactory.java @@ -42,7 +42,7 @@ public class HttpTunnelServerChannelFactory implements @Override public HttpTunnelServerChannel newChannel(ChannelPipeline pipeline) { - return new HttpTunnelServerChannel(this, pipeline); + return HttpTunnelServerChannel.create(this, pipeline); } ServerSocketChannel createRealChannel(HttpTunnelServerChannel channel, diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java index 3b7205595f..1e2f3fb992 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java @@ -36,7 +36,17 @@ final class NioAcceptedSocketChannel extends NioSocketChannel { final Thread bossThread; - NioAcceptedSocketChannel( + static NioAcceptedSocketChannel create(ChannelFactory factory, + ChannelPipeline pipeline, Channel parent, ChannelSink sink, + SocketChannel socket, NioWorker worker, Thread bossThread) { + NioAcceptedSocketChannel instance = new NioAcceptedSocketChannel( + factory, pipeline, parent, sink, socket, worker, bossThread); + instance.setConnected(); + fireChannelOpen(instance); + return instance; + } + + private NioAcceptedSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, Channel parent, ChannelSink sink, SocketChannel socket, NioWorker worker, Thread bossThread) { @@ -44,8 +54,5 @@ final class NioAcceptedSocketChannel extends NioSocketChannel { super(parent, factory, pipeline, sink, socket, worker); this.bossThread = bossThread; - - setConnected(); - fireChannelOpen(this); } } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java index c550f67fc3..f4687050ff 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java @@ -76,11 +76,18 @@ final class NioClientSocketChannel extends NioSocketChannel { // Does not need to be volatile as it's accessed by only one thread. long connectDeadlineNanos; - NioClientSocketChannel( + static NioClientSocketChannel create(ChannelFactory factory, + ChannelPipeline pipeline, ChannelSink sink, NioWorker worker) { + NioClientSocketChannel instance = + new NioClientSocketChannel(factory, pipeline, sink, worker); + fireChannelOpen(instance); + return instance; + } + + private NioClientSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, NioWorker worker) { super(null, factory, pipeline, sink, newSocket(), worker); - fireChannelOpen(this); } } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java index 1733e2a89d..b9f06d639d 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java @@ -137,7 +137,7 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory @Override public SocketChannel newChannel(ChannelPipeline pipeline) { - return new NioClientSocketChannel(this, pipeline, sink, sink.nextWorker()); + return NioClientSocketChannel.create(this, pipeline, sink, sink.nextWorker()); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java index 8719712d88..724a1f44b9 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java @@ -119,15 +119,21 @@ class NioDatagramChannel extends AbstractChannel private volatile InetSocketAddress localAddress; volatile InetSocketAddress remoteAddress; - NioDatagramChannel(final ChannelFactory factory, + static NioDatagramChannel create(ChannelFactory factory, + ChannelPipeline pipeline, ChannelSink sink, NioDatagramWorker worker) { + NioDatagramChannel instance = + new NioDatagramChannel(factory, pipeline, sink, worker); + fireChannelOpen(instance); + return instance; + } + + private NioDatagramChannel(final ChannelFactory factory, final ChannelPipeline pipeline, final ChannelSink sink, final NioDatagramWorker worker) { super(null, factory, pipeline, sink); this.worker = worker; datagramChannel = openNonBlockingChannel(); config = new DefaultNioDatagramChannelConfig(datagramChannel.socket()); - - fireChannelOpen(this); } private DatagramChannel openNonBlockingChannel() { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelFactory.java index f909a9d9ea..201f8a75c4 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelFactory.java @@ -125,7 +125,7 @@ public class NioDatagramChannelFactory implements DatagramChannelFactory { @Override public DatagramChannel newChannel(final ChannelPipeline pipeline) { - return new NioDatagramChannel(this, pipeline, sink, sink.nextWorker()); + return NioDatagramChannel.create(this, pipeline, sink, sink.nextWorker()); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java index 4cf7293adf..c3296f7db1 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java @@ -53,7 +53,15 @@ class NioServerSocketChannel extends AbstractServerChannel volatile Selector selector; private final ServerSocketChannelConfig config; - NioServerSocketChannel( + static NioServerSocketChannel create(ChannelFactory factory, + ChannelPipeline pipeline, ChannelSink sink) { + NioServerSocketChannel instance = + new NioServerSocketChannel(factory, pipeline, sink); + fireChannelOpen(instance); + return instance; + } + + private NioServerSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { @@ -81,8 +89,6 @@ class NioServerSocketChannel extends AbstractServerChannel } config = new DefaultServerSocketChannelConfig(socket.socket()); - - fireChannelOpen(this); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java index f2be2fcd50..161b5b96b0 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java @@ -140,7 +140,7 @@ public class NioServerSocketChannelFactory implements ServerSocketChannelFactory @Override public ServerSocketChannel newChannel(ChannelPipeline pipeline) { - return new NioServerSocketChannel(this, pipeline, sink); + return NioServerSocketChannel.create(this, pipeline, sink); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java index b24279a746..a8076b39a2 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java @@ -271,10 +271,8 @@ class NioServerSocketPipelineSink extends AbstractChannelSink { ChannelPipeline pipeline = channel.getConfig().getPipelineFactory().getPipeline(); NioWorker worker = nextWorker(); - worker.register(new NioAcceptedSocketChannel( - channel.getFactory(), pipeline, channel, - NioServerSocketPipelineSink.this, acceptedSocket, - worker, currentThread), null); + worker.register(NioAcceptedSocketChannel.create(channel.getFactory(), pipeline, channel, + NioServerSocketPipelineSink.this, acceptedSocket, worker, currentThread), null); } catch (Exception e) { logger.warn( "Failed to initialize an accepted socket.", e); diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java index 16781e5c1c..93a52f8b43 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java @@ -41,7 +41,17 @@ class OioAcceptedSocketChannel extends OioSocketChannel { private final PushbackInputStream in; private final OutputStream out; - OioAcceptedSocketChannel( + static OioAcceptedSocketChannel create(Channel parent, + ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, + Socket socket) { + OioAcceptedSocketChannel instance = new OioAcceptedSocketChannel( + parent, factory, pipeline, sink, socket); + fireChannelOpen(instance); + fireChannelBound(instance, instance.getLocalAddress()); + return instance; + } + + private OioAcceptedSocketChannel( Channel parent, ChannelFactory factory, ChannelPipeline pipeline, diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannel.java index 2bf38f3621..d8465e7e1e 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannel.java @@ -38,14 +38,20 @@ class OioClientSocketChannel extends OioSocketChannel { volatile PushbackInputStream in; volatile OutputStream out; - OioClientSocketChannel( + static OioClientSocketChannel create(ChannelFactory factory, + ChannelPipeline pipeline, ChannelSink sink) { + OioClientSocketChannel instance = + new OioClientSocketChannel(factory, pipeline, sink); + fireChannelOpen(instance); + return instance; + } + + private OioClientSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { super(null, factory, pipeline, sink, new Socket()); - - fireChannelOpen(this); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java index c63fe84802..48f006ecb6 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java @@ -97,7 +97,7 @@ public class OioClientSocketChannelFactory implements ClientSocketChannelFactory @Override public SocketChannel newChannel(ChannelPipeline pipeline) { - return new OioClientSocketChannel(this, pipeline, sink); + return OioClientSocketChannel.create(this, pipeline, sink); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java index 9b905f5bc1..889bb035a4 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java @@ -53,7 +53,15 @@ final class OioDatagramChannel extends AbstractChannel private volatile InetSocketAddress localAddress; volatile InetSocketAddress remoteAddress; - OioDatagramChannel( + static OioDatagramChannel create(ChannelFactory factory, + ChannelPipeline pipeline, ChannelSink sink) { + OioDatagramChannel instance = + new OioDatagramChannel(factory, pipeline, sink); + fireChannelOpen(instance); + return instance; + } + + private OioDatagramChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { @@ -74,8 +82,6 @@ final class OioDatagramChannel extends AbstractChannel "Failed to configure the datagram socket timeout.", e); } config = new DefaultDatagramChannelConfig(socket); - - fireChannelOpen(this); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java index 60d8b53e3e..886b5ca50d 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java @@ -96,7 +96,7 @@ public class OioDatagramChannelFactory implements DatagramChannelFactory { @Override public DatagramChannel newChannel(ChannelPipeline pipeline) { - return new OioDatagramChannel(this, pipeline, sink); + return OioDatagramChannel.create(this, pipeline, sink); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java index 77f6b9a570..fdea2d3956 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java @@ -52,7 +52,15 @@ class OioServerSocketChannel extends AbstractServerChannel final Lock shutdownLock = new ReentrantLock(); private final ServerSocketChannelConfig config; - OioServerSocketChannel( + static OioServerSocketChannel create(ChannelFactory factory, + ChannelPipeline pipeline, ChannelSink sink) { + OioServerSocketChannel instance = + new OioServerSocketChannel(factory, pipeline, sink); + fireChannelOpen(instance); + return instance; + } + + private OioServerSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { @@ -80,8 +88,6 @@ class OioServerSocketChannel extends AbstractServerChannel } config = new DefaultServerSocketChannelConfig(socket); - - fireChannelOpen(this); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java index 22114c08c4..1b448750ba 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java @@ -117,7 +117,7 @@ public class OioServerSocketChannelFactory implements ServerSocketChannelFactory @Override public ServerSocketChannel newChannel(ChannelPipeline pipeline) { - return new OioServerSocketChannel(this, pipeline, sink); + return OioServerSocketChannel.create(this, pipeline, sink); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java index 4001e2d2c6..f829f8a824 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java @@ -205,12 +205,8 @@ class OioServerSocketPipelineSink extends AbstractChannelSink { ChannelPipeline pipeline = channel.getConfig().getPipelineFactory().getPipeline(); final OioAcceptedSocketChannel acceptedChannel = - new OioAcceptedSocketChannel( - channel, - channel.getFactory(), - pipeline, - OioServerSocketPipelineSink.this, - acceptedSocket); + OioAcceptedSocketChannel.create(channel, channel.getFactory(), + pipeline, OioServerSocketPipelineSink.this, acceptedSocket); DeadLockProofWorker.start( workerExecutor, new OioWorker(acceptedChannel)); From 31b319a5dc531d8c02c400d312ab9e85e90e614b Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 3 Nov 2011 11:25:24 +0100 Subject: [PATCH 06/93] Release the cumulation buffer after firing upstream so we don't end up with a "leak" because of a very big ChannelBuffer. This patch is extracted of the pull request 39. Thanks to arya for the patch --- .../org/jboss/netty/handler/codec/frame/FrameDecoder.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java index b0a91c182c..a3e173d168 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java @@ -298,6 +298,10 @@ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler { unfoldAndFireMessageReceived(context, remoteAddress, frame); } + + if (!cumulation.readable()) { + this.cumulation = null; + } } private void unfoldAndFireMessageReceived(ChannelHandlerContext context, SocketAddress remoteAddress, Object result) { From 57a6d390144e3653a3c7f11da40603a6d251432d Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 3 Nov 2011 19:19:00 +0100 Subject: [PATCH 07/93] Replace tabs by spaces --- .../channel/iostream/IOStreamAddress.java | 31 +-- .../channel/iostream/IOStreamChannel.java | 74 +++--- .../channel/iostream/IOStreamChannelSink.java | 217 +++++++++--------- 3 files changed, 160 insertions(+), 162 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/iostream/IOStreamAddress.java b/src/main/java/org/jboss/netty/channel/iostream/IOStreamAddress.java index e85c90e939..326e4a0927 100755 --- a/src/main/java/org/jboss/netty/channel/iostream/IOStreamAddress.java +++ b/src/main/java/org/jboss/netty/channel/iostream/IOStreamAddress.java @@ -20,29 +20,30 @@ import java.io.OutputStream; import java.net.SocketAddress; /** - * A {@link java.net.SocketAddress} implementation holding an {@link java.io.InputStream} and an {@link java.io.OutputStream} instance used as - * "remote" address to connect to with a {@link IOStreamChannel}. - * + * A {@link java.net.SocketAddress} implementation holding an + * {@link java.io.InputStream} and an {@link java.io.OutputStream} instance used + * as "remote" address to connect to with a {@link IOStreamChannel}. + * * @author Daniel Bimschas * @author Dennis Pfisterer */ public class IOStreamAddress extends SocketAddress { - private final InputStream inputStream; + private final InputStream inputStream; - private final OutputStream outputStream; + private final OutputStream outputStream; - public IOStreamAddress(final InputStream inputStream, final OutputStream outputStream) { + public IOStreamAddress(final InputStream inputStream, final OutputStream outputStream) { - this.inputStream = inputStream; - this.outputStream = outputStream; - } + this.inputStream = inputStream; + this.outputStream = outputStream; + } - public InputStream getInputStream() { - return inputStream; - } + public InputStream getInputStream() { + return inputStream; + } - public OutputStream getOutputStream() { - return outputStream; - } + public OutputStream getOutputStream() { + return outputStream; + } } diff --git a/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannel.java b/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannel.java index 67bb4b7a97..980ac68123 100755 --- a/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannel.java +++ b/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannel.java @@ -15,59 +15,59 @@ */ package org.jboss.netty.channel.iostream; - import org.jboss.netty.channel.*; import java.net.SocketAddress; /** - * A channel to an {@link java.io.InputStream} and an {@link java.io.OutputStream}. - * + * A channel to an {@link java.io.InputStream} and an + * {@link java.io.OutputStream}. + * * @author Daniel Bimschas * @author Dennis Pfisterer */ public class IOStreamChannel extends AbstractChannel { - IOStreamChannel(final ChannelFactory factory, final ChannelPipeline pipeline, final ChannelSink sink) { - super(null, factory, pipeline, sink); - } + IOStreamChannel(final ChannelFactory factory, final ChannelPipeline pipeline, final ChannelSink sink) { + super(null, factory, pipeline, sink); + } - @Override - public ChannelConfig getConfig() { - return ((IOStreamChannelSink) getPipeline().getSink()).getConfig(); - } + @Override + public ChannelConfig getConfig() { + return ((IOStreamChannelSink) getPipeline().getSink()).getConfig(); + } - @Override - public boolean isBound() { - return ((IOStreamChannelSink) getPipeline().getSink()).isBound(); - } + @Override + public boolean isBound() { + return ((IOStreamChannelSink) getPipeline().getSink()).isBound(); + } - @Override - public boolean isConnected() { - return ((IOStreamChannelSink) getPipeline().getSink()).isConnected(); - } + @Override + public boolean isConnected() { + return ((IOStreamChannelSink) getPipeline().getSink()).isConnected(); + } - @Override - public SocketAddress getLocalAddress() { - return null; - } + @Override + public SocketAddress getLocalAddress() { + return null; + } - @Override - public SocketAddress getRemoteAddress() { - return ((IOStreamChannelSink) getPipeline().getSink()).getRemoteAddress(); - } + @Override + public SocketAddress getRemoteAddress() { + return ((IOStreamChannelSink) getPipeline().getSink()).getRemoteAddress(); + } - @Override - public ChannelFuture bind(final SocketAddress localAddress) { - throw new UnsupportedOperationException(); - } + @Override + public ChannelFuture bind(final SocketAddress localAddress) { + throw new UnsupportedOperationException(); + } - @Override - public ChannelFuture unbind() { - throw new UnsupportedOperationException(); - } + @Override + public ChannelFuture unbind() { + throw new UnsupportedOperationException(); + } - void doSetClosed() { - setClosed(); - } + void doSetClosed() { + setClosed(); + } } diff --git a/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannelSink.java b/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannelSink.java index ecd14eb1d9..f14804d5bc 100755 --- a/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannelSink.java @@ -26,153 +26,150 @@ import java.util.concurrent.ExecutorService; import static org.jboss.netty.channel.Channels.*; /** - * A {@link org.jboss.netty.channel.ChannelSink} implementation which reads from an {@link java.io.InputStream} and - * writes to an {@link java.io.OutputStream}. - * + * A {@link org.jboss.netty.channel.ChannelSink} implementation which reads from + * an {@link java.io.InputStream} and writes to an {@link java.io.OutputStream}. + * * @author Daniel Bimschas * @author Dennis Pfisterer */ public class IOStreamChannelSink extends AbstractChannelSink { - private static class ReadRunnable implements Runnable { + private static class ReadRunnable implements Runnable { - private final IOStreamChannelSink channelSink; + private final IOStreamChannelSink channelSink; - public ReadRunnable(final IOStreamChannelSink channelSink) { - this.channelSink = channelSink; - } + public ReadRunnable(final IOStreamChannelSink channelSink) { + this.channelSink = channelSink; + } - @Override - public void run() { + @Override + public void run() { - PushbackInputStream in = channelSink.inputStream; + PushbackInputStream in = channelSink.inputStream; - while (channelSink.channel.isOpen()) { + while (channelSink.channel.isOpen()) { - byte[] buf; - int readBytes; - try { - int bytesToRead = in.available(); - if (bytesToRead > 0) { - buf = new byte[bytesToRead]; - readBytes = in.read(buf); - } else { - // peek into the stream if it was closed (value=-1) - int b = in.read(); - if (b < 0) { - break; - } - // push back the byte which was read too much - in.unread(b); - continue; - } - } catch (Throwable t) { - if (!channelSink.channel.getCloseFuture().isDone()) { - fireExceptionCaught(channelSink.channel, t); - } - break; - } + byte[] buf; + int readBytes; + try { + int bytesToRead = in.available(); + if (bytesToRead > 0) { + buf = new byte[bytesToRead]; + readBytes = in.read(buf); + } else { + // peek into the stream if it was closed (value=-1) + int b = in.read(); + if (b < 0) { + break; + } + // push back the byte which was read too much + in.unread(b); + continue; + } + } catch (Throwable t) { + if (!channelSink.channel.getCloseFuture().isDone()) { + fireExceptionCaught(channelSink.channel, t); + } + break; + } - fireMessageReceived(channelSink.channel, ChannelBuffers.wrappedBuffer(buf, 0, readBytes)); - } + fireMessageReceived(channelSink.channel, ChannelBuffers.wrappedBuffer(buf, 0, readBytes)); + } - // Clean up. - close(channelSink.channel); - } - } + // Clean up. + close(channelSink.channel); + } + } - private final ExecutorService executorService; + private final ExecutorService executorService; - private IOStreamChannel channel; + private IOStreamChannel channel; - public IOStreamChannelSink(final ExecutorService executorService) { - this.executorService = executorService; - } + public IOStreamChannelSink(final ExecutorService executorService) { + this.executorService = executorService; + } - public boolean isConnected() { - return inputStream != null && outputStream != null; - } + public boolean isConnected() { + return inputStream != null && outputStream != null; + } - public IOStreamAddress getRemoteAddress() { - return remoteAddress; - } + public IOStreamAddress getRemoteAddress() { + return remoteAddress; + } - public boolean isBound() { - return false; - } + public boolean isBound() { + return false; + } - public ChannelConfig getConfig() { - return config; - } + public ChannelConfig getConfig() { + return config; + } - public void setChannel(final IOStreamChannel channel) { - this.channel = channel; - } + public void setChannel(final IOStreamChannel channel) { + this.channel = channel; + } - private IOStreamAddress remoteAddress; + private IOStreamAddress remoteAddress; - private OutputStream outputStream; + private OutputStream outputStream; - private PushbackInputStream inputStream; + private PushbackInputStream inputStream; - private ChannelConfig config = new DefaultChannelConfig(); + private ChannelConfig config = new DefaultChannelConfig(); - @Override - public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e) throws Exception { + @Override + public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e) throws Exception { - final ChannelFuture future = e.getFuture(); + final ChannelFuture future = e.getFuture(); - if (e instanceof ChannelStateEvent) { + if (e instanceof ChannelStateEvent) { - final ChannelStateEvent stateEvent = (ChannelStateEvent) e; - final ChannelState state = stateEvent.getState(); - final Object value = stateEvent.getValue(); + final ChannelStateEvent stateEvent = (ChannelStateEvent) e; + final ChannelState state = stateEvent.getState(); + final Object value = stateEvent.getValue(); - switch (state) { + switch (state) { - case OPEN: - if (Boolean.FALSE.equals(value)) { - outputStream = null; - inputStream = null; - ((IOStreamChannel) e.getChannel()).doSetClosed(); - } - break; + case OPEN: + if (Boolean.FALSE.equals(value)) { + outputStream = null; + inputStream = null; + ((IOStreamChannel) e.getChannel()).doSetClosed(); + } + break; - case BOUND: - throw new UnsupportedOperationException(); + case BOUND: + throw new UnsupportedOperationException(); - case CONNECTED: - if (value != null) { - remoteAddress = (IOStreamAddress) value; - outputStream = remoteAddress.getOutputStream(); - inputStream = new PushbackInputStream(remoteAddress.getInputStream()); - executorService.execute(new ReadRunnable(this)); - future.setSuccess(); - } - break; + case CONNECTED: + if (value != null) { + remoteAddress = (IOStreamAddress) value; + outputStream = remoteAddress.getOutputStream(); + inputStream = new PushbackInputStream(remoteAddress.getInputStream()); + executorService.execute(new ReadRunnable(this)); + future.setSuccess(); + } + break; - case INTEREST_OPS: - // TODO implement - throw new UnsupportedOperationException(); + case INTEREST_OPS: + // TODO implement + throw new UnsupportedOperationException(); - } + } - } else if (e instanceof MessageEvent) { + } else if (e instanceof MessageEvent) { - final MessageEvent event = (MessageEvent) e; - if (event.getMessage() instanceof ChannelBuffer) { + final MessageEvent event = (MessageEvent) e; + if (event.getMessage() instanceof ChannelBuffer) { - final ChannelBuffer buffer = (ChannelBuffer) event.getMessage(); - buffer.readBytes(outputStream, buffer.readableBytes()); - outputStream.flush(); - future.setSuccess(); + final ChannelBuffer buffer = (ChannelBuffer) event.getMessage(); + buffer.readBytes(outputStream, buffer.readableBytes()); + outputStream.flush(); + future.setSuccess(); - } else { - throw new IllegalArgumentException( - "Only ChannelBuffer objects are supported to be written onto the IOStreamChannelSink! " - + "Please check if the encoder pipeline is configured correctly." - ); - } - } - } + } else { + throw new IllegalArgumentException("Only ChannelBuffer objects are supported to be written onto the IOStreamChannelSink! " + "Please check if the encoder pipeline is configured correctly."); + } + } + } } From 2449f0354077bcf18a0f7f4c012d51093c579cef Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 3 Nov 2011 20:32:23 +0100 Subject: [PATCH 08/93] Remove not used SerialVersionUID fields --- .../jboss/netty/util/internal/ConcurrentIdentityHashMap.java | 2 -- .../java/org/jboss/netty/util/internal/LinkedTransferQueue.java | 1 - 2 files changed, 3 deletions(-) diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java index d0ab933c50..9e06a05fee 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java @@ -1226,8 +1226,6 @@ public final class ConcurrentIdentityHashMap extends AbstractMap */ static class SimpleEntry implements Entry { - private static final long serialVersionUID = -8144765946475398746L; - private final K key; private V value; diff --git a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java index 463c62529f..7ca6974c1a 100644 --- a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java +++ b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java @@ -544,7 +544,6 @@ public class LinkedTransferQueue extends AbstractQueue private static final AtomicReferenceFieldUpdater itemUpdater = AtomicFieldUpdaterUtil.newRefUpdater(Node.class, Object.class, "item"); - private static final long serialVersionUID = -3375979862319811754L; } /** head of the queue; null until first enqueue */ From b82ee7341c200ef430f04efe8260419b45279519 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 3 Nov 2011 20:33:32 +0100 Subject: [PATCH 09/93] IOStreamAddress is Serializable so add SerialVersionUID field --- .../org/jboss/netty/channel/iostream/IOStreamAddress.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/jboss/netty/channel/iostream/IOStreamAddress.java b/src/main/java/org/jboss/netty/channel/iostream/IOStreamAddress.java index 326e4a0927..9f9fc29730 100755 --- a/src/main/java/org/jboss/netty/channel/iostream/IOStreamAddress.java +++ b/src/main/java/org/jboss/netty/channel/iostream/IOStreamAddress.java @@ -29,6 +29,11 @@ import java.net.SocketAddress; */ public class IOStreamAddress extends SocketAddress { + /** + * + */ + private static final long serialVersionUID = -4382415449059935960L; + private final InputStream inputStream; private final OutputStream outputStream; From 5094bdc0cc302e2702525c40dfe1f735549f5a52 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 4 Nov 2011 19:18:28 +0100 Subject: [PATCH 10/93] Replace tabs with spaces --- .../org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java | 2 +- .../org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java index 9bd272d6cd..d23e6f7057 100644 --- a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java @@ -75,7 +75,7 @@ public class ByteArrayDecoder extends OneToOneDecoder { } else { // copy the ChannelBuffer to a byte array - array = new byte[buf.readableBytes()]; + array = new byte[buf.readableBytes()]; buf.getBytes(0, array); } return array; diff --git a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java index 1267f9b160..80cde19306 100644 --- a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java @@ -64,6 +64,6 @@ public class ByteArrayEncoder extends OneToOneEncoder { return msg; } return wrappedBuffer((byte[]) msg); - } + } } From d176f4ae83fd4fd50bffaec50e28c46314a1009c Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 4 Nov 2011 19:28:15 +0100 Subject: [PATCH 11/93] Replace tabs with spaces --- .../http/websocketx/BinaryWebSocketFrame.java | 72 +-- .../http/websocketx/CloseWebSocketFrame.java | 46 +- .../ContinuationWebSocketFrame.java | 204 +++---- .../http/websocketx/PingWebSocketFrame.java | 72 +-- .../http/websocketx/PongWebSocketFrame.java | 69 +-- .../http/websocketx/TextWebSocketFrame.java | 182 +++--- .../codec/http/websocketx/UTF8Exception.java | 8 +- .../codec/http/websocketx/UTF8Output.java | 78 ++- .../websocketx/WebSocket00FrameDecoder.java | 167 +++--- .../websocketx/WebSocket00FrameEncoder.java | 115 ++-- .../websocketx/WebSocket08FrameDecoder.java | 550 +++++++++--------- .../websocketx/WebSocket08FrameEncoder.java | 190 +++--- .../websocketx/WebSocketClientHandshaker.java | 301 +++++----- .../WebSocketClientHandshaker00.java | 335 ++++++----- .../WebSocketClientHandshaker10.java | 251 ++++---- .../WebSocketClientHandshakerFactory.java | 54 +- .../codec/http/websocketx/WebSocketFrame.java | 92 ++- .../http/websocketx/WebSocketFrameType.java | 2 +- .../WebSocketHandshakeException.java | 14 +- .../websocketx/WebSocketServerHandshaker.java | 272 ++++----- .../WebSocketServerHandshaker00.java | 260 ++++----- .../WebSocketServerHandshaker10.java | 214 +++---- .../WebSocketServerHandshakerFactory.java | 135 +++-- .../WebSocketSpecificationVersion.java | 26 +- 24 files changed, 1844 insertions(+), 1865 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/BinaryWebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/BinaryWebSocketFrame.java index 2e04c3ce25..fd52192ba5 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/BinaryWebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/BinaryWebSocketFrame.java @@ -25,44 +25,44 @@ import org.jboss.netty.buffer.ChannelBuffers; */ public class BinaryWebSocketFrame extends WebSocketFrame { - /** - * Creates a new empty binary frame. - */ - public BinaryWebSocketFrame() { - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } + /** + * Creates a new empty binary frame. + */ + public BinaryWebSocketFrame() { + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } - /** - * Creates a new binary frame with the specified binary data. The final - * fragment flag is set to true. - * - * @param binaryData - * the content of the frame. - */ - public BinaryWebSocketFrame(ChannelBuffer binaryData) { - this.setBinaryData(binaryData); - } + /** + * Creates a new binary frame with the specified binary data. The final + * fragment flag is set to true. + * + * @param binaryData + * the content of the frame. + */ + public BinaryWebSocketFrame(ChannelBuffer binaryData) { + this.setBinaryData(binaryData); + } - /** - * Creates a new binary frame with the specified binary data and the final - * fragment flag. - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - * @param binaryData - * the content of the frame. - */ - public BinaryWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - this.setBinaryData(binaryData); - } + /** + * Creates a new binary frame with the specified binary data and the final + * fragment flag. + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + * @param binaryData + * the content of the frame. + */ + public BinaryWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + this.setBinaryData(binaryData); + } - @Override - public String toString() { - return getClass().getSimpleName() + "(data: " + getBinaryData() + ')'; - } + @Override + public String toString() { + return getClass().getSimpleName() + "(data: " + getBinaryData() + ')'; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java index cc607df36c..732893c715 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java @@ -24,28 +24,28 @@ import org.jboss.netty.buffer.ChannelBuffers; */ public class CloseWebSocketFrame extends WebSocketFrame { - /** - * Creates a new empty close frame. - */ - public CloseWebSocketFrame() { - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } + /** + * Creates a new empty close frame. + */ + public CloseWebSocketFrame() { + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } - /** - * Creates a new close frame - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - */ - public CloseWebSocketFrame(boolean finalFragment, int rsv) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - } - - @Override - public String toString() { - return getClass().getSimpleName(); - } + /** + * Creates a new close frame + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + */ + public CloseWebSocketFrame(boolean finalFragment, int rsv) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + } + + @Override + public String toString() { + return getClass().getSimpleName(); + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java index ec7db870f7..fd613fb97c 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java @@ -28,117 +28,117 @@ import org.jboss.netty.util.CharsetUtil; */ public class ContinuationWebSocketFrame extends WebSocketFrame { - private String aggregatedText = null; + private String aggregatedText = null; - /** - * Creates a new empty continuation frame. - */ - public ContinuationWebSocketFrame() { - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } + /** + * Creates a new empty continuation frame. + */ + public ContinuationWebSocketFrame() { + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } - /** - * 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. - */ - public ContinuationWebSocketFrame(ChannelBuffer binaryData) { - this.setBinaryData(binaryData); - } + /** + * 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. + */ + public ContinuationWebSocketFrame(ChannelBuffer binaryData) { + this.setBinaryData(binaryData); + } - /** - * Creates a new continuation frame with the specified binary data - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - * @param binaryData - * the content of the frame. - */ - public ContinuationWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - this.setBinaryData(binaryData); - } + /** + * Creates a new continuation frame with the specified binary data + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + * @param binaryData + * the content of the frame. + */ + public ContinuationWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + this.setBinaryData(binaryData); + } - /** - * Creates a new continuation frame with the specified binary data - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - * @param binaryData - * the content of the frame. - * @param aggregatedText - * 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) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - this.setBinaryData(binaryData); - this.aggregatedText = aggregatedText; - } + /** + * Creates a new continuation frame with the specified binary data + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + * @param binaryData + * the content of the frame. + * @param aggregatedText + * 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) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + this.setBinaryData(binaryData); + this.aggregatedText = aggregatedText; + } - /** - * Creates a new continuation frame with the specified text data - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - * @param text - * text content of the frame. - */ - public ContinuationWebSocketFrame(boolean finalFragment, int rsv, String text) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - this.setText(text); - } + /** + * Creates a new continuation frame with the specified text data + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + * @param text + * text content of the frame. + */ + public ContinuationWebSocketFrame(boolean finalFragment, int rsv, String text) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + this.setText(text); + } - /** - * Returns the text data in this frame - */ - public String getText() { - if (this.getBinaryData() == null) { - return null; - } - return this.getBinaryData().toString(CharsetUtil.UTF_8); - } + /** + * Returns the text data in this frame + */ + public String getText() { + if (this.getBinaryData() == null) { + return null; + } + return this.getBinaryData().toString(CharsetUtil.UTF_8); + } - /** - * Sets the string for this frame - * - * @param text - * text to store - */ - public void setText(String text) { - if (text == null || text.isEmpty()) { - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } else { - this.setBinaryData(ChannelBuffers.copiedBuffer(text, CharsetUtil.UTF_8)); - } - } + /** + * Sets the string for this frame + * + * @param text + * text to store + */ + public void setText(String text) { + if (text == null || text.isEmpty()) { + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } else { + this.setBinaryData(ChannelBuffers.copiedBuffer(text, CharsetUtil.UTF_8)); + } + } - @Override - public String toString() { - return getClass().getSimpleName() + "(data: " + getBinaryData() + ')'; - } + @Override + public String toString() { + return getClass().getSimpleName() + "(data: " + getBinaryData() + ')'; + } - /** - * Aggregated text returned by decoder on the final continuation frame of a - * fragmented text message - */ - public String getAggregatedText() { - return aggregatedText; - } + /** + * Aggregated text returned by decoder on the final continuation frame of a + * fragmented text message + */ + public String getAggregatedText() { + return aggregatedText; + } - public void setAggregatedText(String aggregatedText) { - this.aggregatedText = aggregatedText; - } + public void setAggregatedText(String aggregatedText) { + this.aggregatedText = aggregatedText; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/PingWebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/PingWebSocketFrame.java index 857afd4484..48c9ea4f9c 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/PingWebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/PingWebSocketFrame.java @@ -25,43 +25,43 @@ import org.jboss.netty.buffer.ChannelBuffers; */ public class PingWebSocketFrame extends WebSocketFrame { - /** - * Creates a new empty ping frame. - */ - public PingWebSocketFrame() { - this.setFinalFragment(true); - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } + /** + * Creates a new empty ping frame. + */ + public PingWebSocketFrame() { + this.setFinalFragment(true); + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } - /** - * Creates a new ping frame with the specified binary data. - * - * @param binaryData - * the content of the frame. - */ - public PingWebSocketFrame(ChannelBuffer binaryData) { - this.setBinaryData(binaryData); - } + /** + * Creates a new ping frame with the specified binary data. + * + * @param binaryData + * the content of the frame. + */ + public PingWebSocketFrame(ChannelBuffer binaryData) { + this.setBinaryData(binaryData); + } - /** - * Creates a new ping frame with the specified binary data - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - * @param binaryData - * the content of the frame. - */ - public PingWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - this.setBinaryData(binaryData); - } - - @Override - public String toString() { - return getClass().getSimpleName() + "(data: " + getBinaryData() + ')'; - } + /** + * Creates a new ping frame with the specified binary data + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + * @param binaryData + * the content of the frame. + */ + public PingWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + this.setBinaryData(binaryData); + } + + @Override + public String toString() { + return getClass().getSimpleName() + "(data: " + getBinaryData() + ')'; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/PongWebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/PongWebSocketFrame.java index 19ea1350f8..123000964f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/PongWebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/PongWebSocketFrame.java @@ -25,41 +25,42 @@ import org.jboss.netty.buffer.ChannelBuffers; */ public class PongWebSocketFrame extends WebSocketFrame { - /** - * Creates a new empty pong frame. - */ - public PongWebSocketFrame() { - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } + /** + * Creates a new empty pong frame. + */ + public PongWebSocketFrame() { + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } - /** - * Creates a new pong frame with the specified binary data. - * - * @param binaryData - * the content of the frame. - */ - public PongWebSocketFrame(ChannelBuffer binaryData) { - this.setBinaryData(binaryData); - } + /** + * Creates a new pong frame with the specified binary data. + * + * @param binaryData + * the content of the frame. + */ + public PongWebSocketFrame(ChannelBuffer binaryData) { + this.setBinaryData(binaryData); + } - /** - * Creates a new pong frame with the specified binary data - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - * @param binaryData - * the content of the frame. - */ - public PongWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - this.setBinaryData(binaryData); - } - @Override - public String toString() { - return getClass().getSimpleName() + "(data: " + getBinaryData() + ')'; - } + /** + * Creates a new pong frame with the specified binary data + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + * @param binaryData + * the content of the frame. + */ + public PongWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + this.setBinaryData(binaryData); + } + + @Override + public String toString() { + return getClass().getSimpleName() + "(data: " + getBinaryData() + ')'; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/TextWebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/TextWebSocketFrame.java index fa16845e0d..97e0d45ebc 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/TextWebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/TextWebSocketFrame.java @@ -27,102 +27,102 @@ import org.jboss.netty.util.CharsetUtil; */ public class TextWebSocketFrame extends WebSocketFrame { - /** - * Creates a new empty text frame. - */ - public TextWebSocketFrame() { - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } + /** + * Creates a new empty text frame. + */ + public TextWebSocketFrame() { + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } - /** - * Creates a new text frame with the specified text string. The final - * fragment flag is set to true. - * - * @param text - * String to put in the frame - */ - public TextWebSocketFrame(String text) { - if (text == null || text.isEmpty()) { - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } else { - this.setBinaryData(ChannelBuffers.copiedBuffer(text, CharsetUtil.UTF_8)); - } - } + /** + * Creates a new text frame with the specified text string. The final + * fragment flag is set to true. + * + * @param text + * String to put in the frame + */ + public TextWebSocketFrame(String text) { + if (text == null || text.isEmpty()) { + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } else { + this.setBinaryData(ChannelBuffers.copiedBuffer(text, CharsetUtil.UTF_8)); + } + } - /** - * Creates a new text frame with the specified binary data. The final - * fragment flag is set to true. - * - * @param binaryData - * the content of the frame. Must be UTF-8 encoded - */ - public TextWebSocketFrame(ChannelBuffer binaryData) { - this.setBinaryData(binaryData); - } + /** + * Creates a new text frame with the specified binary data. The final + * fragment flag is set to true. + * + * @param binaryData + * the content of the frame. Must be UTF-8 encoded + */ + public TextWebSocketFrame(ChannelBuffer binaryData) { + this.setBinaryData(binaryData); + } - /** - * Creates a new text frame with the specified text string. The final - * fragment flag is set to true. - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - * @param text - * String to put in the frame - */ - public TextWebSocketFrame(boolean finalFragment, int rsv, String text) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - if (text == null || text.isEmpty()) { - this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); - } else { - this.setBinaryData(ChannelBuffers.copiedBuffer(text, CharsetUtil.UTF_8)); - } - } + /** + * Creates a new text frame with the specified text string. The final + * fragment flag is set to true. + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + * @param text + * String to put in the frame + */ + public TextWebSocketFrame(boolean finalFragment, int rsv, String text) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + if (text == null || text.isEmpty()) { + this.setBinaryData(ChannelBuffers.EMPTY_BUFFER); + } else { + this.setBinaryData(ChannelBuffers.copiedBuffer(text, CharsetUtil.UTF_8)); + } + } - /** - * Creates a new text frame with the specified binary data. The final - * fragment flag is set to true. - * - * @param finalFragment - * flag indicating if this frame is the final fragment - * @param rsv - * reserved bits used for protocol extensions - * @param binaryData - * the content of the frame. Must be UTF-8 encoded - */ - public TextWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { - this.setFinalFragment(finalFragment); - this.setRsv(rsv); - this.setBinaryData(binaryData); - } + /** + * Creates a new text frame with the specified binary data. The final + * fragment flag is set to true. + * + * @param finalFragment + * flag indicating if this frame is the final fragment + * @param rsv + * reserved bits used for protocol extensions + * @param binaryData + * the content of the frame. Must be UTF-8 encoded + */ + public TextWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData) { + this.setFinalFragment(finalFragment); + this.setRsv(rsv); + this.setBinaryData(binaryData); + } - /** - * Returns the text data in this frame - */ - public String getText() { - if (this.getBinaryData() == null) { - return null; - } - return this.getBinaryData().toString(CharsetUtil.UTF_8); - } + /** + * Returns the text data in this frame + */ + public String getText() { + if (this.getBinaryData() == null) { + return null; + } + return this.getBinaryData().toString(CharsetUtil.UTF_8); + } - /** - * Sets the string for this frame - * - * @param text - * text to store - */ - public void setText(String text) { - if (text == null) { - throw new NullPointerException("text"); - } - this.setBinaryData(ChannelBuffers.copiedBuffer(text, CharsetUtil.UTF_8)); - } + /** + * Sets the string for this frame + * + * @param text + * text to store + */ + public void setText(String text) { + if (text == null) { + throw new NullPointerException("text"); + } + this.setBinaryData(ChannelBuffers.copiedBuffer(text, CharsetUtil.UTF_8)); + } - @Override - public String toString() { - return getClass().getSimpleName() + "(text: " + getText() + ')'; - } + @Override + public String toString() { + return getClass().getSimpleName() + "(text: " + getText() + ')'; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Exception.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Exception.java index 358f52684a..fbffd9c7eb 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Exception.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Exception.java @@ -27,9 +27,9 @@ package org.jboss.netty.handler.codec.http.websocketx; * @author Vibul Imtarnasan */ public class UTF8Exception extends RuntimeException { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public UTF8Exception(String reason) { - super(reason); - } + public UTF8Exception(String reason) { + super(reason); + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Output.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Output.java index 9e33df9bc0..2efe690871 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Output.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Output.java @@ -27,58 +27,50 @@ package org.jboss.netty.handler.codec.http.websocketx; * @author Vibul Imtarnasan */ public class UTF8Output { - private static final int UTF8_ACCEPT = 0; - private static final int UTF8_REJECT = 12; + 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 = 0; + private int state = UTF8_ACCEPT; + private int codep = 0; - private final StringBuilder stringBuilder; + private final StringBuilder stringBuilder; - public UTF8Output(byte[] bytes) { - stringBuilder = new StringBuilder(bytes.length); - write(bytes); - } + public UTF8Output(byte[] bytes) { + stringBuilder = new StringBuilder(bytes.length); + write(bytes); + } - public void write(byte[] bytes) { - for (byte b : bytes) { - write(b); - } - } + public void write(byte[] bytes) { + for (byte b : bytes) { + write(b); + } + } - public void write(int b) { - byte type = TYPES[b & 0xFF]; + public void write(int b) { + byte type = TYPES[b & 0xFF]; - codep = (state != UTF8_ACCEPT) ? (b & 0x3f) | (codep << 6) : (0xff >> type) & (b); + codep = (state != UTF8_ACCEPT) ? (b & 0x3f) | (codep << 6) : (0xff >> type) & (b); - state = STATES[state + type]; + state = STATES[state + type]; - if (state == UTF8_ACCEPT) { - stringBuilder.append((char) codep); - } else if (state == UTF8_REJECT) { - throw new UTF8Exception("bytes are not UTF-8"); - } - } + if (state == UTF8_ACCEPT) { + stringBuilder.append((char) codep); + } else if (state == UTF8_REJECT) { + throw new UTF8Exception("bytes are not UTF-8"); + } + } - public String toString() { - if (state != UTF8_ACCEPT) { - throw new UTF8Exception("bytes are not UTF-8"); - } - return stringBuilder.toString(); - } + public String toString() { + if (state != UTF8_ACCEPT) { + throw new UTF8Exception("bytes are not UTF-8"); + } + return stringBuilder.toString(); + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameDecoder.java index 4698d32b31..c577a38d9a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameDecoder.java @@ -39,102 +39,101 @@ import org.jboss.netty.handler.codec.replay.VoidEnum; */ public class WebSocket00FrameDecoder extends ReplayingDecoder { - public static final int DEFAULT_MAX_FRAME_SIZE = 16384; + public static final int DEFAULT_MAX_FRAME_SIZE = 16384; - private final int maxFrameSize; - private boolean receivedClosingHandshake; + private final int maxFrameSize; + private boolean receivedClosingHandshake; - public WebSocket00FrameDecoder() { - this(DEFAULT_MAX_FRAME_SIZE); - } + public WebSocket00FrameDecoder() { + this(DEFAULT_MAX_FRAME_SIZE); + } - /** - * Creates a new instance of {@code WebSocketFrameDecoder} with the - * specified {@code maxFrameSize}. If the client sends a frame size larger - * than {@code maxFrameSize}, the channel will be closed. - * - * @param maxFrameSize - * the maximum frame size to decode - */ - public WebSocket00FrameDecoder(int maxFrameSize) { - this.maxFrameSize = maxFrameSize; - } + /** + * Creates a new instance of {@code WebSocketFrameDecoder} with the + * specified {@code maxFrameSize}. If the client sends a frame size larger + * than {@code maxFrameSize}, the channel will be closed. + * + * @param maxFrameSize + * the maximum frame size to decode + */ + public WebSocket00FrameDecoder(int maxFrameSize) { + this.maxFrameSize = maxFrameSize; + } - @Override - protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, VoidEnum state) - throws Exception { + @Override + protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, VoidEnum state) throws Exception { - // Discard all data received if closing handshake was received before. - if (receivedClosingHandshake) { - buffer.skipBytes(actualReadableBytes()); - return null; - } + // Discard all data received if closing handshake was received before. + if (receivedClosingHandshake) { + buffer.skipBytes(actualReadableBytes()); + return null; + } - // Decode a frame otherwise. - byte type = buffer.readByte(); - if ((type & 0x80) == 0x80) { - // If the MSB on type is set, decode the frame length - return decodeBinaryFrame(type, buffer); - } else { - // Decode a 0xff terminated UTF-8 string - return decodeTextFrame(type, buffer); - } - } + // Decode a frame otherwise. + byte type = buffer.readByte(); + if ((type & 0x80) == 0x80) { + // If the MSB on type is set, decode the frame length + return decodeBinaryFrame(type, buffer); + } else { + // Decode a 0xff terminated UTF-8 string + return decodeTextFrame(type, buffer); + } + } - private WebSocketFrame decodeBinaryFrame(byte type, ChannelBuffer buffer) throws TooLongFrameException { - long frameSize = 0; - int lengthFieldSize = 0; - byte b; - do { - b = buffer.readByte(); - frameSize <<= 7; - frameSize |= b & 0x7f; - if (frameSize > maxFrameSize) { - throw new TooLongFrameException(); - } - lengthFieldSize++; - if (lengthFieldSize > 8) { - // Perhaps a malicious peer? - throw new TooLongFrameException(); - } - } while ((b & 0x80) == 0x80); + private WebSocketFrame decodeBinaryFrame(byte type, ChannelBuffer buffer) throws TooLongFrameException { + long frameSize = 0; + int lengthFieldSize = 0; + byte b; + do { + b = buffer.readByte(); + frameSize <<= 7; + frameSize |= b & 0x7f; + if (frameSize > maxFrameSize) { + throw new TooLongFrameException(); + } + lengthFieldSize++; + if (lengthFieldSize > 8) { + // Perhaps a malicious peer? + throw new TooLongFrameException(); + } + } while ((b & 0x80) == 0x80); - if (type == ((byte) 0xFF) && frameSize == 0) { - receivedClosingHandshake = true; - return new CloseWebSocketFrame(); - } + if (type == ((byte) 0xFF) && frameSize == 0) { + receivedClosingHandshake = true; + return new CloseWebSocketFrame(); + } - return new BinaryWebSocketFrame(buffer.readBytes((int) frameSize)); - } + return new BinaryWebSocketFrame(buffer.readBytes((int) frameSize)); + } - private WebSocketFrame decodeTextFrame(byte type, ChannelBuffer buffer) throws TooLongFrameException { - int ridx = buffer.readerIndex(); - int rbytes = actualReadableBytes(); - int delimPos = buffer.indexOf(ridx, ridx + rbytes, (byte) 0xFF); - if (delimPos == -1) { - // Frame delimiter (0xFF) not found - if (rbytes > maxFrameSize) { - // Frame length exceeded the maximum - throw new TooLongFrameException(); - } else { - // Wait until more data is received - return null; - } - } + private WebSocketFrame decodeTextFrame(byte type, ChannelBuffer buffer) throws TooLongFrameException { + int ridx = buffer.readerIndex(); + int rbytes = actualReadableBytes(); + int delimPos = buffer.indexOf(ridx, ridx + rbytes, (byte) 0xFF); + if (delimPos == -1) { + // Frame delimiter (0xFF) not found + if (rbytes > maxFrameSize) { + // Frame length exceeded the maximum + throw new TooLongFrameException(); + } else { + // Wait until more data is received + return null; + } + } - int frameSize = delimPos - ridx; - if (frameSize > maxFrameSize) { - throw new TooLongFrameException(); - } + int frameSize = delimPos - ridx; + if (frameSize > maxFrameSize) { + throw new TooLongFrameException(); + } - ChannelBuffer binaryData = buffer.readBytes(frameSize); - buffer.skipBytes(1); + ChannelBuffer binaryData = buffer.readBytes(frameSize); + buffer.skipBytes(1); - int ffDelimPos = binaryData.indexOf(binaryData.readerIndex(), binaryData.writerIndex(), (byte) 0xFF); - if (ffDelimPos >= 0) { - throw new IllegalArgumentException("a text frame should not contain 0xFF."); - } + int ffDelimPos = binaryData.indexOf(binaryData.readerIndex(), binaryData.writerIndex(), (byte) 0xFF); + if (ffDelimPos >= 0) { + throw new IllegalArgumentException("a text frame should not contain 0xFF."); + } - return new TextWebSocketFrame(binaryData); - } + return new TextWebSocketFrame(binaryData); + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java index 0ad6025e03..fd0463a36e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java @@ -39,65 +39,64 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; @Sharable public class WebSocket00FrameEncoder extends OneToOneEncoder { - @Override - protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { - if (msg instanceof WebSocketFrame) { - WebSocketFrame frame = (WebSocketFrame) msg; - if (frame instanceof TextWebSocketFrame) { - // Text frame - ChannelBuffer data = frame.getBinaryData(); - ChannelBuffer encoded = channel.getConfig().getBufferFactory() - .getBuffer(data.order(), data.readableBytes() + 2); - encoded.writeByte((byte) 0x00); - encoded.writeBytes(data, data.readerIndex(), data.readableBytes()); - encoded.writeByte((byte) 0xFF); - return encoded; - } else if (frame instanceof CloseWebSocketFrame) { - // Close frame - ChannelBuffer data = frame.getBinaryData(); - ChannelBuffer encoded = channel.getConfig().getBufferFactory().getBuffer(data.order(), 2); - encoded.writeByte((byte) 0xFF); - encoded.writeByte((byte) 0x00); - return encoded; - } else { - // Binary frame - ChannelBuffer data = frame.getBinaryData(); - int dataLen = data.readableBytes(); - ChannelBuffer encoded = channel.getConfig().getBufferFactory().getBuffer(data.order(), dataLen + 5); + @Override + protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { + if (msg instanceof WebSocketFrame) { + WebSocketFrame frame = (WebSocketFrame) msg; + if (frame instanceof TextWebSocketFrame) { + // Text frame + ChannelBuffer data = frame.getBinaryData(); + ChannelBuffer encoded = channel.getConfig().getBufferFactory().getBuffer(data.order(), data.readableBytes() + 2); + encoded.writeByte((byte) 0x00); + encoded.writeBytes(data, data.readerIndex(), data.readableBytes()); + encoded.writeByte((byte) 0xFF); + return encoded; + } else if (frame instanceof CloseWebSocketFrame) { + // Close frame + ChannelBuffer data = frame.getBinaryData(); + ChannelBuffer encoded = channel.getConfig().getBufferFactory().getBuffer(data.order(), 2); + encoded.writeByte((byte) 0xFF); + encoded.writeByte((byte) 0x00); + return encoded; + } else { + // Binary frame + ChannelBuffer data = frame.getBinaryData(); + int dataLen = data.readableBytes(); + ChannelBuffer encoded = channel.getConfig().getBufferFactory().getBuffer(data.order(), dataLen + 5); - // Encode type. - encoded.writeByte((byte) 0x80); + // Encode type. + encoded.writeByte((byte) 0x80); - // Encode length. - int b1 = dataLen >>> 28 & 0x7F; - int b2 = dataLen >>> 14 & 0x7F; - int b3 = dataLen >>> 7 & 0x7F; - int b4 = dataLen & 0x7F; - if (b1 == 0) { - if (b2 == 0) { - if (b3 == 0) { - encoded.writeByte(b4); - } else { - encoded.writeByte(b3 | 0x80); - encoded.writeByte(b4); - } - } else { - encoded.writeByte(b2 | 0x80); - encoded.writeByte(b3 | 0x80); - encoded.writeByte(b4); - } - } else { - encoded.writeByte(b1 | 0x80); - encoded.writeByte(b2 | 0x80); - encoded.writeByte(b3 | 0x80); - encoded.writeByte(b4); - } + // Encode length. + int b1 = dataLen >>> 28 & 0x7F; + int b2 = dataLen >>> 14 & 0x7F; + int b3 = dataLen >>> 7 & 0x7F; + int b4 = dataLen & 0x7F; + if (b1 == 0) { + if (b2 == 0) { + if (b3 == 0) { + encoded.writeByte(b4); + } else { + encoded.writeByte(b3 | 0x80); + encoded.writeByte(b4); + } + } else { + encoded.writeByte(b2 | 0x80); + encoded.writeByte(b3 | 0x80); + encoded.writeByte(b4); + } + } else { + encoded.writeByte(b1 | 0x80); + encoded.writeByte(b2 | 0x80); + encoded.writeByte(b3 | 0x80); + encoded.writeByte(b4); + } - // Encode binary data. - encoded.writeBytes(data, data.readerIndex(), dataLen); - return encoded; - } - } - return msg; - } + // Encode binary data. + encoded.writeBytes(data, data.readerIndex(), dataLen); + return encoded; + } + } + return msg; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java index 2b76491502..181d39b441 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java @@ -51,320 +51,322 @@ import org.jboss.netty.logging.InternalLoggerFactory; /** * Decodes a web socket frame from wire protocol version 8 format. This code was - * forked from webbit and modified. + * forked from webbit and + * modified. * - * @author Aslak Hellesøy + * @author Aslak Hellesøy * @author Vibul Imtarnasan */ public class WebSocket08FrameDecoder extends ReplayingDecoder { - private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameDecoder.class); + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameDecoder.class); - private static final byte OPCODE_CONT = 0x0; - private static final byte OPCODE_TEXT = 0x1; - private static final byte OPCODE_BINARY = 0x2; - private static final byte OPCODE_CLOSE = 0x8; - private static final byte OPCODE_PING = 0x9; - private static final byte OPCODE_PONG = 0xA; + private static final byte OPCODE_CONT = 0x0; + private static final byte OPCODE_TEXT = 0x1; + private static final byte OPCODE_BINARY = 0x2; + private static final byte OPCODE_CLOSE = 0x8; + private static final byte OPCODE_PING = 0x9; + private static final byte OPCODE_PONG = 0xA; - private UTF8Output fragmentedFramesText = null; - private int fragmentedFramesCount = 0; + private UTF8Output fragmentedFramesText = null; + private int fragmentedFramesCount = 0; - private boolean frameFinalFlag; - private int frameRsv; - private int frameOpcode; - private long framePayloadLength; - private ChannelBuffer framePayload = null; - private int framePayloadBytesRead = 0; - private ChannelBuffer maskingKey; + private boolean frameFinalFlag; + private int frameRsv; + private int frameOpcode; + private long framePayloadLength; + private ChannelBuffer framePayload = null; + private int framePayloadBytesRead = 0; + private ChannelBuffer maskingKey; - private boolean allowExtensions = false; - private boolean maskedPayload = false; - private boolean receivedClosingHandshake = false; + private boolean allowExtensions = false; + private boolean maskedPayload = false; + private boolean receivedClosingHandshake = false; - public static enum State { - FRAME_START, MASKING_KEY, PAYLOAD, CORRUPT - } + public static enum State { + FRAME_START, MASKING_KEY, PAYLOAD, CORRUPT + } - /** - * Constructor - * - * @param maskedPayload - * Web socket servers must set this to true processed incoming - * masked payload. Client implementations must set this to false. - * @param allowExtensions - * Flag to allow reserved extension bits to be used or not - */ - public WebSocket08FrameDecoder(boolean maskedPayload, boolean allowExtensions) { - super(State.FRAME_START); - this.maskedPayload = maskedPayload; - this.allowExtensions = allowExtensions; - } + /** + * Constructor + * + * @param maskedPayload + * Web socket servers must set this to true processed incoming + * masked payload. Client implementations must set this to false. + * @param allowExtensions + * Flag to allow reserved extension bits to be used or not + */ + public WebSocket08FrameDecoder(boolean maskedPayload, boolean allowExtensions) { + super(State.FRAME_START); + this.maskedPayload = maskedPayload; + this.allowExtensions = allowExtensions; + } - @Override - protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, State state) - throws Exception { + @Override + protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, State state) throws Exception { - // Discard all data received if closing handshake was received before. - if (receivedClosingHandshake) { - buffer.skipBytes(actualReadableBytes()); - return null; - } + // Discard all data received if closing handshake was received before. + if (receivedClosingHandshake) { + buffer.skipBytes(actualReadableBytes()); + return null; + } - switch (state) { - case FRAME_START: - framePayloadBytesRead = 0; - framePayloadLength = -1; - framePayload = null; + switch (state) { + case FRAME_START: + framePayloadBytesRead = 0; + framePayloadLength = -1; + framePayload = null; - // FIN, RSV, OPCODE - byte b = buffer.readByte(); - frameFinalFlag = (b & 0x80) != 0; - frameRsv = (b & 0x70) >> 4; - frameOpcode = (b & 0x0F); + // FIN, RSV, OPCODE + byte b = buffer.readByte(); + frameFinalFlag = (b & 0x80) != 0; + frameRsv = (b & 0x70) >> 4; + frameOpcode = (b & 0x0F); - logger.debug("Decoding WebSocket Frame opCode=" + frameOpcode); + logger.debug("Decoding WebSocket Frame opCode=" + frameOpcode); - // MASK, PAYLOAD LEN 1 - b = buffer.readByte(); - boolean frameMasked = (b & 0x80) != 0; - int framePayloadLen1 = (b & 0x7F); + // MASK, PAYLOAD LEN 1 + b = buffer.readByte(); + boolean frameMasked = (b & 0x80) != 0; + int framePayloadLen1 = (b & 0x7F); - if (frameRsv != 0 && !this.allowExtensions) { - protocolViolation(channel, "RSV != 0 and no extension negotiated, RSV:" + frameRsv); - return null; - } + if (frameRsv != 0 && !this.allowExtensions) { + protocolViolation(channel, "RSV != 0 and no extension negotiated, RSV:" + frameRsv); + return null; + } - if (this.maskedPayload && !frameMasked) { - protocolViolation(channel, "unmasked client to server frame"); - return null; - } - if (frameOpcode > 7) { // control frame (have MSB in opcode set) + if (this.maskedPayload && !frameMasked) { + protocolViolation(channel, "unmasked client to server frame"); + return null; + } + if (frameOpcode > 7) { // control frame (have MSB in opcode set) - // control frames MUST NOT be fragmented - if (!frameFinalFlag) { - protocolViolation(channel, "fragmented control frame"); - return null; - } + // control frames MUST NOT be fragmented + if (!frameFinalFlag) { + protocolViolation(channel, "fragmented control frame"); + return null; + } - // control frames MUST have payload 125 octets or less - if (framePayloadLen1 > 125) { - protocolViolation(channel, "control frame with payload length > 125 octets"); - return null; - } + // control frames MUST have payload 125 octets or less + if (framePayloadLen1 > 125) { + protocolViolation(channel, "control frame with payload length > 125 octets"); + return null; + } - // check for reserved control frame opcodes - if (!(frameOpcode == OPCODE_CLOSE || frameOpcode == OPCODE_PING || frameOpcode == OPCODE_PONG)) { - protocolViolation(channel, "control frame using reserved opcode " + frameOpcode); - return null; - } + // check for reserved control frame opcodes + if (!(frameOpcode == OPCODE_CLOSE || frameOpcode == OPCODE_PING || frameOpcode == OPCODE_PONG)) { + protocolViolation(channel, "control frame using reserved opcode " + frameOpcode); + return null; + } - // close frame : if there is a body, the first two bytes of the - // body MUST be a 2-byte - // unsigned integer (in network byte order) representing a - // status code - if (frameOpcode == 8 && framePayloadLen1 == 1) { - protocolViolation(channel, "received close control frame with payload len 1"); - return null; - } - } else { // data frame - // check for reserved data frame opcodes - if (!(frameOpcode == OPCODE_CONT || frameOpcode == OPCODE_TEXT || frameOpcode == OPCODE_BINARY)) { - protocolViolation(channel, "data frame using reserved opcode " + frameOpcode); - return null; - } + // close frame : if there is a body, the first two bytes of the + // body MUST be a 2-byte + // unsigned integer (in network byte order) representing a + // status code + if (frameOpcode == 8 && framePayloadLen1 == 1) { + protocolViolation(channel, "received close control frame with payload len 1"); + return null; + } + } else { // data frame + // check for reserved data frame opcodes + if (!(frameOpcode == OPCODE_CONT || frameOpcode == OPCODE_TEXT || frameOpcode == OPCODE_BINARY)) { + protocolViolation(channel, "data frame using reserved opcode " + frameOpcode); + return null; + } - // check opcode vs message fragmentation state 1/2 - if (fragmentedFramesCount == 0 && frameOpcode == OPCODE_CONT) { - protocolViolation(channel, "received continuation data frame outside fragmented message"); - return null; - } + // check opcode vs message fragmentation state 1/2 + if (fragmentedFramesCount == 0 && frameOpcode == OPCODE_CONT) { + protocolViolation(channel, "received continuation data frame outside fragmented message"); + return null; + } - // check opcode vs message fragmentation state 2/2 - if (fragmentedFramesCount != 0 && frameOpcode != OPCODE_CONT && frameOpcode != OPCODE_PING) { - protocolViolation(channel, "received non-continuation data frame while inside fragmented message"); - return null; - } - } + // check opcode vs message fragmentation state 2/2 + if (fragmentedFramesCount != 0 && frameOpcode != OPCODE_CONT && frameOpcode != OPCODE_PING) { + protocolViolation(channel, "received non-continuation data frame while inside fragmented message"); + return null; + } + } - if (framePayloadLen1 == 126) { - framePayloadLength = buffer.readUnsignedShort(); - if (framePayloadLength < 126) { - protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); - return null; - } - } else if (framePayloadLen1 == 127) { - framePayloadLength = buffer.readLong(); - // TODO: check if it's bigger than 0x7FFFFFFFFFFFFFFF, Maybe - // just check if it's negative? + if (framePayloadLen1 == 126) { + framePayloadLength = buffer.readUnsignedShort(); + if (framePayloadLength < 126) { + protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); + return null; + } + } else if (framePayloadLen1 == 127) { + framePayloadLength = buffer.readLong(); + // TODO: check if it's bigger than 0x7FFFFFFFFFFFFFFF, Maybe + // just check if it's negative? - if (framePayloadLength < 65536) { - protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); - return null; - } - } else { - framePayloadLength = framePayloadLen1; - } + if (framePayloadLength < 65536) { + protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); + return null; + } + } else { + framePayloadLength = framePayloadLen1; + } - //logger.debug("Frame length=" + framePayloadLength); - checkpoint(State.MASKING_KEY); - case MASKING_KEY: - if (this.maskedPayload){ - maskingKey = buffer.readBytes(4); - } - checkpoint(State.PAYLOAD); - case PAYLOAD: - // Some times, the payload may not be delivered in 1 nice packet - // We need to accumulate the data until we have it all - int rbytes = actualReadableBytes(); - ChannelBuffer payloadBuffer = null; + // logger.debug("Frame length=" + framePayloadLength); + checkpoint(State.MASKING_KEY); + case MASKING_KEY: + if (this.maskedPayload) { + maskingKey = buffer.readBytes(4); + } + checkpoint(State.PAYLOAD); + case PAYLOAD: + // Some times, the payload may not be delivered in 1 nice packet + // We need to accumulate the data until we have it all + int rbytes = actualReadableBytes(); + ChannelBuffer payloadBuffer = null; - int willHaveReadByteCount = framePayloadBytesRead + rbytes; - //logger.debug("Frame rbytes=" + rbytes + " willHaveReadByteCount=" + willHaveReadByteCount + " framePayloadLength=" + framePayloadLength); - if (willHaveReadByteCount == framePayloadLength) { - // We have all our content so proceed to process - payloadBuffer = buffer.readBytes(rbytes); - } else if (willHaveReadByteCount < framePayloadLength) { - // We don't have all our content so accumulate payload. - // Returning null means we will get called back - payloadBuffer = buffer.readBytes(rbytes); - if (framePayload == null) { - framePayload = channel.getConfig().getBufferFactory().getBuffer(toFrameLength(framePayloadLength)); - } - framePayload.writeBytes(payloadBuffer); - framePayloadBytesRead = framePayloadBytesRead + rbytes; - - // Return null to wait for more bytes to arrive - return null; - } else if (willHaveReadByteCount > framePayloadLength) { - // We have more than what we need so read up to the end of frame - // Leave the remainder in the buffer for next frame - payloadBuffer = buffer.readBytes(toFrameLength(framePayloadLength - framePayloadBytesRead)); - } + int willHaveReadByteCount = framePayloadBytesRead + rbytes; + // logger.debug("Frame rbytes=" + rbytes + " willHaveReadByteCount=" + // + willHaveReadByteCount + " framePayloadLength=" + + // framePayloadLength); + if (willHaveReadByteCount == framePayloadLength) { + // We have all our content so proceed to process + payloadBuffer = buffer.readBytes(rbytes); + } else if (willHaveReadByteCount < framePayloadLength) { + // We don't have all our content so accumulate payload. + // Returning null means we will get called back + payloadBuffer = buffer.readBytes(rbytes); + if (framePayload == null) { + framePayload = channel.getConfig().getBufferFactory().getBuffer(toFrameLength(framePayloadLength)); + } + framePayload.writeBytes(payloadBuffer); + framePayloadBytesRead = framePayloadBytesRead + rbytes; - // Now we have all the data, the next checkpoint must be the next - // frame - checkpoint(State.FRAME_START); + // Return null to wait for more bytes to arrive + return null; + } else if (willHaveReadByteCount > framePayloadLength) { + // We have more than what we need so read up to the end of frame + // Leave the remainder in the buffer for next frame + payloadBuffer = buffer.readBytes(toFrameLength(framePayloadLength - framePayloadBytesRead)); + } - // Take the data that we have in this packet - if (framePayload == null) { - framePayload = payloadBuffer; - } else { - framePayload.writeBytes(payloadBuffer); - } - - // Unmask data if needed - if (this.maskedPayload) { - unmask(framePayload); - } + // Now we have all the data, the next checkpoint must be the next + // frame + checkpoint(State.FRAME_START); - // Processing for fragmented messages - String aggregatedText = null; - if (frameFinalFlag) { - // Final frame of the sequence. Apparently ping frames are - // allowed in the middle of a fragmented message - if (frameOpcode != OPCODE_PING) { - fragmentedFramesCount = 0; + // Take the data that we have in this packet + if (framePayload == null) { + framePayload = payloadBuffer; + } else { + framePayload.writeBytes(payloadBuffer); + } - // Check text for UTF8 correctness - if (frameOpcode == OPCODE_TEXT || fragmentedFramesText != null) { - // Check UTF-8 correctness for this payload - checkUTF8String(channel, framePayload.array()); + // Unmask data if needed + if (this.maskedPayload) { + unmask(framePayload); + } - // This does a second check to make sure UTF-8 - // correctness for entire text message - aggregatedText = fragmentedFramesText.toString(); + // Processing for fragmented messages + String aggregatedText = null; + if (frameFinalFlag) { + // Final frame of the sequence. Apparently ping frames are + // allowed in the middle of a fragmented message + if (frameOpcode != OPCODE_PING) { + fragmentedFramesCount = 0; - fragmentedFramesText = null; - } - } - } else { - // Not final frame so we can expect more frames in the - // fragmented sequence - if (fragmentedFramesCount == 0) { - // First text or binary frame for a fragmented set - fragmentedFramesText = null; - if (frameOpcode == OPCODE_TEXT) { - checkUTF8String(channel, framePayload.array()); - } - } else { - // Subsequent frames - only check if init frame is text - if (fragmentedFramesText != null) { - checkUTF8String(channel, framePayload.array()); - } - } + // Check text for UTF8 correctness + if (frameOpcode == OPCODE_TEXT || fragmentedFramesText != null) { + // Check UTF-8 correctness for this payload + checkUTF8String(channel, framePayload.array()); - // Increment counter - fragmentedFramesCount++; - } + // This does a second check to make sure UTF-8 + // correctness for entire text message + aggregatedText = fragmentedFramesText.toString(); - // Return the frame - if (frameOpcode == OPCODE_TEXT) { - return new TextWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_BINARY) { - return new BinaryWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_PING) { - return new PingWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_PONG) { - return new PongWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_CONT) { - return new ContinuationWebSocketFrame(frameFinalFlag, frameRsv, framePayload, aggregatedText); - } else if (frameOpcode == OPCODE_CLOSE) { - this.receivedClosingHandshake = true; - return new CloseWebSocketFrame(frameFinalFlag, frameRsv); - } else { - throw new UnsupportedOperationException("Cannot decode web socket frame with opcode: " + frameOpcode); - } - case CORRUPT: - // If we don't keep reading Netty will throw an exception saying - // we can't return null if no bytes read and state not changed. - buffer.readByte(); - return null; - default: - throw new Error("Shouldn't reach here."); - } - } + fragmentedFramesText = null; + } + } + } else { + // Not final frame so we can expect more frames in the + // fragmented sequence + if (fragmentedFramesCount == 0) { + // First text or binary frame for a fragmented set + fragmentedFramesText = null; + if (frameOpcode == OPCODE_TEXT) { + checkUTF8String(channel, framePayload.array()); + } + } else { + // Subsequent frames - only check if init frame is text + if (fragmentedFramesText != null) { + checkUTF8String(channel, framePayload.array()); + } + } - private void unmask(ChannelBuffer frame) { - byte[] bytes = frame.array(); - for (int i = 0; i < bytes.length; i++) { - frame.setByte(i, frame.getByte(i) ^ maskingKey.getByte(i % 4)); - } - } + // Increment counter + fragmentedFramesCount++; + } - private void protocolViolation(Channel channel, String reason) throws CorruptedFrameException { - checkpoint(State.CORRUPT); - if (channel.isConnected()) { - channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); - channel.close().awaitUninterruptibly(); - } - throw new CorruptedFrameException(reason); - } + // Return the frame + if (frameOpcode == OPCODE_TEXT) { + return new TextWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_BINARY) { + return new BinaryWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_PING) { + return new PingWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_PONG) { + return new PongWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_CONT) { + return new ContinuationWebSocketFrame(frameFinalFlag, frameRsv, framePayload, aggregatedText); + } else if (frameOpcode == OPCODE_CLOSE) { + this.receivedClosingHandshake = true; + return new CloseWebSocketFrame(frameFinalFlag, frameRsv); + } else { + throw new UnsupportedOperationException("Cannot decode web socket frame with opcode: " + frameOpcode); + } + case CORRUPT: + // If we don't keep reading Netty will throw an exception saying + // we can't return null if no bytes read and state not changed. + buffer.readByte(); + return null; + default: + throw new Error("Shouldn't reach here."); + } + } - private int toFrameLength(long l) throws TooLongFrameException { - if (l > Integer.MAX_VALUE) { - throw new TooLongFrameException("Length:" + l); - } else { - return (int) l; - } - } + private void unmask(ChannelBuffer frame) { + byte[] bytes = frame.array(); + for (int i = 0; i < bytes.length; i++) { + frame.setByte(i, frame.getByte(i) ^ maskingKey.getByte(i % 4)); + } + } - private void checkUTF8String(Channel channel, byte[] bytes) throws CorruptedFrameException { - try { - // StringBuilder sb = new StringBuilder("UTF8 " + bytes.length + - // " bytes: "); - // for (byte b : bytes) { - // sb.append(Integer.toHexString(b)).append(" "); - // } - // logger.debug(sb.toString()); + private void protocolViolation(Channel channel, String reason) throws CorruptedFrameException { + checkpoint(State.CORRUPT); + if (channel.isConnected()) { + channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); + channel.close().awaitUninterruptibly(); + } + throw new CorruptedFrameException(reason); + } - if (fragmentedFramesText == null) { - fragmentedFramesText = new UTF8Output(bytes); - } else { - fragmentedFramesText.write(bytes); - } - } catch (UTF8Exception ex) { - protocolViolation(channel, "invalid UTF-8 bytes"); - } - } + private int toFrameLength(long l) throws TooLongFrameException { + if (l > Integer.MAX_VALUE) { + throw new TooLongFrameException("Length:" + l); + } else { + return (int) l; + } + } + + private void checkUTF8String(Channel channel, byte[] bytes) throws CorruptedFrameException { + try { + // StringBuilder sb = new StringBuilder("UTF8 " + bytes.length + + // " bytes: "); + // for (byte b : bytes) { + // sb.append(Integer.toHexString(b)).append(" "); + // } + // logger.debug(sb.toString()); + + if (fragmentedFramesText == null) { + fragmentedFramesText = new UTF8Output(bytes); + } else { + fragmentedFramesText.write(bytes); + } + } catch (UTF8Exception ex) { + protocolViolation(channel, "invalid UTF-8 bytes"); + } + } } \ No newline at end of file diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameEncoder.java index 10005c55ab..35538e3ddf 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameEncoder.java @@ -52,7 +52,8 @@ import org.jboss.netty.logging.InternalLoggerFactory; /** *

* Encodes a web socket frame into wire protocol version 8 format. This code was - * forked from webbit and modified. + * forked from webbit and + * modified. *

* * @author Aslak Hellesøy @@ -60,115 +61,114 @@ import org.jboss.netty.logging.InternalLoggerFactory; */ public class WebSocket08FrameEncoder extends OneToOneEncoder { - private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameEncoder.class); + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameEncoder.class); - private static final byte OPCODE_CONT = 0x0; - private static final byte OPCODE_TEXT = 0x1; - private static final byte OPCODE_BINARY = 0x2; - private static final byte OPCODE_CLOSE = 0x8; - private static final byte OPCODE_PING = 0x9; - private static final byte OPCODE_PONG = 0xA; + private static final byte OPCODE_CONT = 0x0; + private static final byte OPCODE_TEXT = 0x1; + private static final byte OPCODE_BINARY = 0x2; + private static final byte OPCODE_CLOSE = 0x8; + private static final byte OPCODE_PING = 0x9; + private static final byte OPCODE_PONG = 0xA; - private boolean maskPayload = false; + private boolean maskPayload = false; - /** - * Constructor - * - * @param maskPayload - * Web socket clients must set this to true to mask payload. - * Server implementations must set this to false. - */ - public WebSocket08FrameEncoder(boolean maskPayload) { - this.maskPayload = maskPayload; - } + /** + * Constructor + * + * @param maskPayload + * Web socket clients must set this to true to mask payload. + * Server implementations must set this to false. + */ + public WebSocket08FrameEncoder(boolean maskPayload) { + this.maskPayload = maskPayload; + } - @Override - protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { + @Override + protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { - byte[] mask = null; + byte[] mask = null; - if (msg instanceof WebSocketFrame) { - WebSocketFrame frame = (WebSocketFrame) msg; - ChannelBuffer data = frame.getBinaryData(); - if (data == null) { - data = ChannelBuffers.EMPTY_BUFFER; - } + if (msg instanceof WebSocketFrame) { + WebSocketFrame frame = (WebSocketFrame) msg; + ChannelBuffer data = frame.getBinaryData(); + if (data == null) { + data = ChannelBuffers.EMPTY_BUFFER; + } - byte opcode; - if (frame instanceof TextWebSocketFrame) { - opcode = OPCODE_TEXT; - } else if (frame instanceof PingWebSocketFrame) { - opcode = OPCODE_PING; - } else if (frame instanceof PongWebSocketFrame) { - opcode = OPCODE_PONG; - } else if (frame instanceof CloseWebSocketFrame) { - opcode = OPCODE_CLOSE; - } else if (frame instanceof BinaryWebSocketFrame) { - opcode = OPCODE_BINARY; - } else if (frame instanceof ContinuationWebSocketFrame) { - opcode = OPCODE_CONT; - } else { - throw new UnsupportedOperationException("Cannot encode frame of type: " + frame.getClass().getName()); - } + byte opcode; + if (frame instanceof TextWebSocketFrame) { + opcode = OPCODE_TEXT; + } else if (frame instanceof PingWebSocketFrame) { + opcode = OPCODE_PING; + } else if (frame instanceof PongWebSocketFrame) { + opcode = OPCODE_PONG; + } else if (frame instanceof CloseWebSocketFrame) { + opcode = OPCODE_CLOSE; + } else if (frame instanceof BinaryWebSocketFrame) { + opcode = OPCODE_BINARY; + } else if (frame instanceof ContinuationWebSocketFrame) { + opcode = OPCODE_CONT; + } else { + throw new UnsupportedOperationException("Cannot encode frame of type: " + frame.getClass().getName()); + } - int length = data.readableBytes(); + int length = data.readableBytes(); - logger.debug("Encoding WebSocket Frame opCode=" + opcode + " length=" + length); + logger.debug("Encoding WebSocket Frame opCode=" + opcode + " length=" + length); - int b0 = 0; - if (frame.isFinalFragment()) { - b0 |= (1 << 7); - } - b0 |= (frame.getRsv() % 8) << 4; - b0 |= opcode % 128; + int b0 = 0; + if (frame.isFinalFragment()) { + b0 |= (1 << 7); + } + b0 |= (frame.getRsv() % 8) << 4; + b0 |= opcode % 128; - ChannelBuffer header; - ChannelBuffer body; + ChannelBuffer header; + ChannelBuffer body; - if (opcode == OPCODE_PING && length > 125) { - throw new TooLongFrameException("invalid payload for PING (payload length must be <= 125, was " - + length); - } + if (opcode == OPCODE_PING && length > 125) { + throw new TooLongFrameException("invalid payload for PING (payload length must be <= 125, was " + length); + } - int maskLength = this.maskPayload ? 4 : 0; - if (length <= 125) { - header = ChannelBuffers.buffer(2 + maskLength); - header.writeByte(b0); - byte b = (byte) (this.maskPayload ? (0x80 | (byte) length) : (byte) length); - header.writeByte(b); - } else if (length <= 0xFFFF) { - header = ChannelBuffers.buffer(4 + maskLength); - header.writeByte(b0); - header.writeByte(this.maskPayload ? (0xFE) : 126); - header.writeByte((length >>> 8) & 0xFF); - header.writeByte((length) & 0xFF); - } else { - header = ChannelBuffers.buffer(10 + maskLength); - header.writeByte(b0); - header.writeByte(this.maskPayload ? (0xFF) : 127); - header.writeLong(length); - } + int maskLength = this.maskPayload ? 4 : 0; + if (length <= 125) { + header = ChannelBuffers.buffer(2 + maskLength); + header.writeByte(b0); + byte b = (byte) (this.maskPayload ? (0x80 | (byte) length) : (byte) length); + header.writeByte(b); + } else if (length <= 0xFFFF) { + header = ChannelBuffers.buffer(4 + maskLength); + header.writeByte(b0); + header.writeByte(this.maskPayload ? (0xFE) : 126); + header.writeByte((length >>> 8) & 0xFF); + header.writeByte((length) & 0xFF); + } else { + header = ChannelBuffers.buffer(10 + maskLength); + header.writeByte(b0); + header.writeByte(this.maskPayload ? (0xFF) : 127); + header.writeLong(length); + } - // Write payload - if (this.maskPayload) { - Integer random = (int) (Math.random() * Integer.MAX_VALUE); - mask = ByteBuffer.allocate(4).putInt(random).array(); - header.writeBytes(mask); + // Write payload + if (this.maskPayload) { + Integer random = (int) (Math.random() * Integer.MAX_VALUE); + mask = ByteBuffer.allocate(4).putInt(random).array(); + header.writeBytes(mask); - body = ChannelBuffers.buffer(length); - int counter = 0; - while (data.readableBytes() > 0) { - byte byteData = data.readByte(); - body.writeByte(byteData ^ mask[+counter++ % 4]); - } - } else { - body = data; - } - return ChannelBuffers.wrappedBuffer(header, body); - } + body = ChannelBuffers.buffer(length); + int counter = 0; + while (data.readableBytes() > 0) { + byte byteData = data.readByte(); + body.writeByte(byteData ^ mask[+counter++ % 4]); + } + } else { + body = data; + } + return ChannelBuffers.wrappedBuffer(header, body); + } - // If not websocket, then just return the message - return msg; - } + // If not websocket, then just return the message + return msg; + } } \ No newline at end of file diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java index 4ee63b0bc6..d40ea276ff 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java @@ -34,178 +34,177 @@ import org.jboss.netty.util.CharsetUtil; */ public abstract class WebSocketClientHandshaker { - private URI webSocketURL; + private URI webSocketURL; - private WebSocketSpecificationVersion version = WebSocketSpecificationVersion.UNKNOWN; + private WebSocketSpecificationVersion version = WebSocketSpecificationVersion.UNKNOWN; - private boolean openingHandshakeCompleted = false; + private boolean openingHandshakeCompleted = false; - private String subProtocolRequest = null; + private String subProtocolRequest = null; - private String subProtocolResponse = null; + private String subProtocolResponse = null; - /** - * - * @param webSocketURL - * @param version - * @param subProtocol - */ - public WebSocketClientHandshaker(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol) { - this.webSocketURL = webSocketURL; - this.version = version; - this.subProtocolRequest = subProtocol; - } + /** + * + * @param webSocketURL + * @param version + * @param subProtocol + */ + public WebSocketClientHandshaker(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol) { + this.webSocketURL = webSocketURL; + this.version = version; + this.subProtocolRequest = subProtocol; + } - /** - * Returns the URI to the web socket. e.g. "ws://myhost.com/path" - */ - public URI getWebSocketURL() { - return webSocketURL; - } + /** + * Returns the URI to the web socket. e.g. "ws://myhost.com/path" + */ + public URI getWebSocketURL() { + return webSocketURL; + } - protected void setWebSocketURL(URI webSocketURL) { - this.webSocketURL = webSocketURL; - } + protected void setWebSocketURL(URI webSocketURL) { + this.webSocketURL = webSocketURL; + } - /** - * Version of the web socket specification that is being used - */ - public WebSocketSpecificationVersion getVersion() { - return version; - } + /** + * Version of the web socket specification that is being used + */ + public WebSocketSpecificationVersion getVersion() { + return version; + } - protected void setVersion(WebSocketSpecificationVersion version) { - this.version = version; - } + protected void setVersion(WebSocketSpecificationVersion version) { + this.version = version; + } - /** - * Flag to indicate if the opening handshake is complete - */ - public boolean isOpeningHandshakeCompleted() { - return openingHandshakeCompleted; - } + /** + * Flag to indicate if the opening handshake is complete + */ + public boolean isOpeningHandshakeCompleted() { + return openingHandshakeCompleted; + } - protected void setOpenningHandshakeCompleted(boolean openningHandshakeCompleted) { - this.openingHandshakeCompleted = openningHandshakeCompleted; - } + protected void setOpenningHandshakeCompleted(boolean openningHandshakeCompleted) { + this.openingHandshakeCompleted = openningHandshakeCompleted; + } - /** - * Returns the sub protocol request sent to the server as specified in the - * constructor - */ - public String getSubProtocolRequest() { - return subProtocolRequest; - } + /** + * Returns the sub protocol request sent to the server as specified in the + * constructor + */ + public String getSubProtocolRequest() { + return subProtocolRequest; + } - protected void setSubProtocolRequest(String subProtocolRequest) { - this.subProtocolRequest = subProtocolRequest; - } + protected void setSubProtocolRequest(String subProtocolRequest) { + this.subProtocolRequest = subProtocolRequest; + } - /** - * Returns the sub protocol response and sent by the server. Only available - * after end of handshake. - */ - public String getSubProtocolResponse() { - return subProtocolResponse; - } + /** + * Returns the sub protocol response and sent by the server. Only available + * after end of handshake. + */ + public String getSubProtocolResponse() { + return subProtocolResponse; + } - protected void setSubProtocolResponse(String subProtocolResponse) { - this.subProtocolResponse = subProtocolResponse; - } + protected void setSubProtocolResponse(String subProtocolResponse) { + this.subProtocolResponse = subProtocolResponse; + } - /** - * Performs the opening handshake - * - * @param ctx - * Channel context - * @param channel - * Channel - */ - public abstract void beginOpeningHandshake(ChannelHandlerContext ctx, Channel channel); + /** + * Performs the opening handshake + * + * @param ctx + * Channel context + * @param channel + * Channel + */ + public abstract void beginOpeningHandshake(ChannelHandlerContext ctx, Channel channel); - /** - * Performs the closing handshake - * - * @param ctx - * Channel context - * @param response - * HTTP response containing the closing handshake details - */ - public abstract void endOpeningHandshake(ChannelHandlerContext ctx, HttpResponse response) - throws WebSocketHandshakeException; + /** + * Performs the closing handshake + * + * @param ctx + * Channel context + * @param response + * HTTP response containing the closing handshake details + */ + public abstract void endOpeningHandshake(ChannelHandlerContext ctx, HttpResponse response) throws WebSocketHandshakeException; - /** - * Performs an MD5 hash - * - * @param bytes - * Data to hash - * @return Hashed data - */ - protected byte[] md5(byte[] bytes) { - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - return md.digest(bytes); - } catch (NoSuchAlgorithmException e) { - throw new InternalError("MD5 not supported on this platform"); - } - } + /** + * Performs an MD5 hash + * + * @param bytes + * Data to hash + * @return Hashed data + */ + protected byte[] md5(byte[] bytes) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + return md.digest(bytes); + } catch (NoSuchAlgorithmException e) { + throw new InternalError("MD5 not supported on this platform"); + } + } - /** - * Performs an SHA-1 hash - * - * @param bytes - * Data to hash - * @return Hashed data - */ - protected byte[] sha1(byte[] bytes) { - try { - MessageDigest md = MessageDigest.getInstance("SHA1"); - return md.digest(bytes); - } catch (NoSuchAlgorithmException e) { - throw new InternalError("SHA-1 not supported on this platform"); - } - } + /** + * Performs an SHA-1 hash + * + * @param bytes + * Data to hash + * @return Hashed data + */ + protected byte[] sha1(byte[] bytes) { + try { + MessageDigest md = MessageDigest.getInstance("SHA1"); + return md.digest(bytes); + } catch (NoSuchAlgorithmException e) { + throw new InternalError("SHA-1 not supported on this platform"); + } + } - /** - * Base 64 encoding - * - * @param bytes - * Bytes to encode - * @return encoded string - */ - protected String base64Encode(byte[] bytes) { - ChannelBuffer hashed = ChannelBuffers.wrappedBuffer(bytes); - return Base64.encode(hashed).toString(CharsetUtil.UTF_8); - } - - /** - * Creates some random bytes - * - * @param size - * Number of random bytes to create - * @return random bytes - */ - protected byte[] createRandomBytes(int size) { - byte[] bytes = new byte[size]; + /** + * Base 64 encoding + * + * @param bytes + * Bytes to encode + * @return encoded string + */ + protected String base64Encode(byte[] bytes) { + ChannelBuffer hashed = ChannelBuffers.wrappedBuffer(bytes); + return Base64.encode(hashed).toString(CharsetUtil.UTF_8); + } - for (int i = 0; i < size; i++) { - bytes[i] = (byte) createRandomNumber(0, 255); - } + /** + * Creates some random bytes + * + * @param size + * Number of random bytes to create + * @return random bytes + */ + protected byte[] createRandomBytes(int size) { + byte[] bytes = new byte[size]; - return bytes; - } + for (int i = 0; i < size; i++) { + bytes[i] = (byte) createRandomNumber(0, 255); + } - /** - * Generates a random number - * - * @param min - * Minimum value - * @param max - * Maximum value - * @return Random number - */ - protected int createRandomNumber(int min, int max) { - int rand = (int) (Math.random() * max + min); - return rand; - } + return bytes; + } + + /** + * Generates a random number + * + * @param min + * Minimum value + * @param max + * Maximum value + * @return Random number + */ + protected int createRandomNumber(int min, int max) { + int rand = (int) (Math.random() * max + min); + return rand; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java index 524abb6932..17515192fc 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java @@ -47,203 +47,200 @@ import org.jboss.netty.handler.codec.http.HttpVersion; */ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker { - private byte[] expectedChallengeResponseBytes = null; + private byte[] expectedChallengeResponseBytes = null; - /** - * Constructor specifying the destination web socket location and version to - * initiate - * - * @param webSocketURL - * URL for web socket communications. e.g - * "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. - * @param version - * Version of web socket specification to use to connect to the - * server - * @param subProtocol - * Sub protocol request sent to the server. - */ - public WebSocketClientHandshaker00(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol) { - super(webSocketURL, version, subProtocol); - return; - } + /** + * Constructor specifying the destination web socket location and version to + * initiate + * + * @param webSocketURL + * URL for web socket communications. e.g + * "ws://myhost.com/mypath". Subsequent web socket frames will be + * sent to this URL. + * @param version + * Version of web socket specification to use to connect to the + * server + * @param subProtocol + * Sub protocol request sent to the server. + */ + public WebSocketClientHandshaker00(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol) { + super(webSocketURL, version, subProtocol); + return; + } - /** - *

- * Sends the opening request to the server: - *

- * - *
-	 * GET /demo HTTP/1.1
-	 * Upgrade: WebSocket
-	 * Connection: Upgrade
-	 * Host: example.com
-	 * Origin: http://example.com
-	 * Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5
-	 * Sec-WebSocket-Key2: 12998 5 Y3 1  .P00
-	 * 
-	 * ^n:ds[4U
-	 * 
- * - * @param ctx - * Channel context - * @param channel - * Channel into which we can write our request - */ - @Override - public void beginOpeningHandshake(ChannelHandlerContext ctx, Channel channel) { - // Make keys - int spaces1 = createRandomNumber(1, 12); - int spaces2 = createRandomNumber(1, 12); + /** + *

+ * Sends the opening request to the server: + *

+ * + *
+     * GET /demo HTTP/1.1
+     * Upgrade: WebSocket
+     * Connection: Upgrade
+     * Host: example.com
+     * Origin: http://example.com
+     * Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5
+     * Sec-WebSocket-Key2: 12998 5 Y3 1  .P00
+     * 
+     * ^n:ds[4U
+     * 
+ * + * @param ctx + * Channel context + * @param channel + * Channel into which we can write our request + */ + @Override + public void beginOpeningHandshake(ChannelHandlerContext ctx, Channel channel) { + // Make keys + int spaces1 = createRandomNumber(1, 12); + int spaces2 = createRandomNumber(1, 12); - int max1 = Integer.MAX_VALUE / spaces1; - int max2 = Integer.MAX_VALUE / spaces2; + int max1 = Integer.MAX_VALUE / spaces1; + int max2 = Integer.MAX_VALUE / spaces2; - int number1 = createRandomNumber(0, max1); - int number2 = createRandomNumber(0, max2); + int number1 = createRandomNumber(0, max1); + int number2 = createRandomNumber(0, max2); - int product1 = number1 * spaces1; - int product2 = number2 * spaces2; + int product1 = number1 * spaces1; + int product2 = number2 * spaces2; - String key1 = Integer.toString(product1); - String key2 = Integer.toString(product2); + String key1 = Integer.toString(product1); + String key2 = Integer.toString(product2); - key1 = insertRandomCharacters(key1); - key2 = insertRandomCharacters(key2); + key1 = insertRandomCharacters(key1); + key2 = insertRandomCharacters(key2); - key1 = insertSpaces(key1, spaces1); - key2 = insertSpaces(key2, spaces2); + key1 = insertSpaces(key1, spaces1); + key2 = insertSpaces(key2, spaces2); - byte[] key3 = createRandomBytes(8); + byte[] key3 = createRandomBytes(8); - ByteBuffer buffer = ByteBuffer.allocate(4); - buffer.putInt(number1); - byte[] number1Array = buffer.array(); - buffer = ByteBuffer.allocate(4); - buffer.putInt(number2); - byte[] number2Array = buffer.array(); + ByteBuffer buffer = ByteBuffer.allocate(4); + buffer.putInt(number1); + byte[] number1Array = buffer.array(); + buffer = ByteBuffer.allocate(4); + buffer.putInt(number2); + byte[] number2Array = buffer.array(); - byte[] challenge = new byte[16]; - System.arraycopy(number1Array, 0, challenge, 0, 4); - System.arraycopy(number2Array, 0, challenge, 4, 4); - System.arraycopy(key3, 0, challenge, 8, 8); - this.expectedChallengeResponseBytes = md5(challenge); + byte[] challenge = new byte[16]; + System.arraycopy(number1Array, 0, challenge, 0, 4); + System.arraycopy(number2Array, 0, challenge, 4, 4); + System.arraycopy(key3, 0, challenge, 8, 8); + this.expectedChallengeResponseBytes = md5(challenge); - // Get path - URI wsURL = this.getWebSocketURL(); - String path = wsURL.getPath(); - if (wsURL.getQuery() != null && wsURL.getQuery().length() > 0) { - path = wsURL.getPath() + "?" + wsURL.getQuery(); - } + // Get path + URI wsURL = this.getWebSocketURL(); + String path = wsURL.getPath(); + if (wsURL.getQuery() != null && wsURL.getQuery().length() > 0) { + path = wsURL.getPath() + "?" + wsURL.getQuery(); + } - // Format request - HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); - request.addHeader(Names.UPGRADE, Values.WEBSOCKET); - request.addHeader(Names.CONNECTION, Values.UPGRADE); - request.addHeader(Names.HOST, wsURL.getHost()); - request.addHeader(Names.ORIGIN, "http://" + wsURL.getHost()); - request.addHeader(Names.SEC_WEBSOCKET_KEY1, key1); - request.addHeader(Names.SEC_WEBSOCKET_KEY2, key2); - if (this.getSubProtocolRequest() != null && !this.getSubProtocolRequest().equals("")) { - request.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, this.getSubProtocolRequest()); - } - request.setContent(ChannelBuffers.copiedBuffer(key3)); + // Format request + HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); + request.addHeader(Names.UPGRADE, Values.WEBSOCKET); + request.addHeader(Names.CONNECTION, Values.UPGRADE); + request.addHeader(Names.HOST, wsURL.getHost()); + request.addHeader(Names.ORIGIN, "http://" + wsURL.getHost()); + request.addHeader(Names.SEC_WEBSOCKET_KEY1, key1); + request.addHeader(Names.SEC_WEBSOCKET_KEY2, key2); + if (this.getSubProtocolRequest() != null && !this.getSubProtocolRequest().equals("")) { + request.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, this.getSubProtocolRequest()); + } + request.setContent(ChannelBuffers.copiedBuffer(key3)); - channel.write(request); + channel.write(request); - ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket00FrameEncoder()); - } + ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket00FrameEncoder()); + } - /** - *

- * Process server response: - *

- * - *
-	 * HTTP/1.1 101 WebSocket Protocol Handshake
-	 * Upgrade: WebSocket
-	 * Connection: Upgrade
-	 * Sec-WebSocket-Origin: http://example.com
-	 * Sec-WebSocket-Location: ws://example.com/demo
-	 * Sec-WebSocket-Protocol: sample
-	 * 
-	 * 8jKS'y:G*Co,Wxa-
-	 * 
- * - * @param ctx - * Channel context - * @param response - * HTTP response returned from the server for the request sent by - * beginOpeningHandshake00(). - * @throws WebSocketHandshakeException - */ - @Override - public void endOpeningHandshake(ChannelHandlerContext ctx, HttpResponse response) - throws WebSocketHandshakeException { - final HttpResponseStatus status = new HttpResponseStatus(101, "WebSocket Protocol Handshake"); + /** + *

+ * Process server response: + *

+ * + *
+     * HTTP/1.1 101 WebSocket Protocol Handshake
+     * Upgrade: WebSocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Origin: http://example.com
+     * Sec-WebSocket-Location: ws://example.com/demo
+     * Sec-WebSocket-Protocol: sample
+     * 
+     * 8jKS'y:G*Co,Wxa-
+     * 
+ * + * @param ctx + * Channel context + * @param response + * HTTP response returned from the server for the request sent by + * beginOpeningHandshake00(). + * @throws WebSocketHandshakeException + */ + @Override + public void endOpeningHandshake(ChannelHandlerContext ctx, HttpResponse response) throws WebSocketHandshakeException { + final HttpResponseStatus status = new HttpResponseStatus(101, "WebSocket Protocol Handshake"); - if (!response.getStatus().equals(status)) { - throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus()); - } + if (!response.getStatus().equals(status)) { + throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus()); + } - String upgrade = response.getHeader(Names.UPGRADE); - if (upgrade == null || !upgrade.equals(Values.WEBSOCKET)) { - throw new WebSocketHandshakeException("Invalid handshake response upgrade: " - + response.getHeader(Names.UPGRADE)); - } + String upgrade = response.getHeader(Names.UPGRADE); + if (upgrade == null || !upgrade.equals(Values.WEBSOCKET)) { + throw new WebSocketHandshakeException("Invalid handshake response upgrade: " + response.getHeader(Names.UPGRADE)); + } - String connection = response.getHeader(Names.CONNECTION); - if (connection == null || !connection.equals(Values.UPGRADE)) { - throw new WebSocketHandshakeException("Invalid handshake response connection: " - + response.getHeader(Names.CONNECTION)); - } + String connection = response.getHeader(Names.CONNECTION); + if (connection == null || !connection.equals(Values.UPGRADE)) { + throw new WebSocketHandshakeException("Invalid handshake response connection: " + response.getHeader(Names.CONNECTION)); + } - byte[] challenge = response.getContent().array(); - if (!Arrays.equals(challenge, expectedChallengeResponseBytes)) { - throw new WebSocketHandshakeException("Invalid challenge"); - } + byte[] challenge = response.getContent().array(); + if (!Arrays.equals(challenge, expectedChallengeResponseBytes)) { + throw new WebSocketHandshakeException("Invalid challenge"); + } - String protocol = response.getHeader(Names.SEC_WEBSOCKET_PROTOCOL); - this.setSubProtocolResponse(protocol); + String protocol = response.getHeader(Names.SEC_WEBSOCKET_PROTOCOL); + this.setSubProtocolResponse(protocol); - ctx.getPipeline().replace("decoder", "ws-decoder", new WebSocket00FrameDecoder()); + ctx.getPipeline().replace("decoder", "ws-decoder", new WebSocket00FrameDecoder()); - this.setOpenningHandshakeCompleted(true); - return; - } + this.setOpenningHandshakeCompleted(true); + return; + } - private String insertRandomCharacters(String key) { - int count = createRandomNumber(1, 12); + private String insertRandomCharacters(String key) { + int count = createRandomNumber(1, 12); - char[] randomChars = new char[count]; - int randCount = 0; - while (randCount < count) { - int rand = (int) (Math.random() * 0x7e + 0x21); - if (((0x21 < rand) && (rand < 0x2f)) || ((0x3a < rand) && (rand < 0x7e))) { - randomChars[randCount] = (char) rand; - randCount += 1; - } - } + char[] randomChars = new char[count]; + int randCount = 0; + while (randCount < count) { + int rand = (int) (Math.random() * 0x7e + 0x21); + if (((0x21 < rand) && (rand < 0x2f)) || ((0x3a < rand) && (rand < 0x7e))) { + randomChars[randCount] = (char) rand; + randCount += 1; + } + } - for (int i = 0; i < count; i++) { - int split = createRandomNumber(0, key.length()); - String part1 = key.substring(0, split); - String part2 = key.substring(split); - key = part1 + randomChars[i] + part2; - } + for (int i = 0; i < count; i++) { + int split = createRandomNumber(0, key.length()); + String part1 = key.substring(0, split); + String part2 = key.substring(split); + key = part1 + randomChars[i] + part2; + } - return key; - } + return key; + } - private String insertSpaces(String key, int spaces) { - for (int i = 0; i < spaces; i++) { - int split = createRandomNumber(1, key.length() - 1); - String part1 = key.substring(0, split); - String part2 = key.substring(split); - key = part1 + " " + part2; - } + private String insertSpaces(String key, int spaces) { + for (int i = 0; i < spaces; i++) { + int split = createRandomNumber(1, key.length() - 1); + String part1 = key.substring(0, split); + String part2 = key.substring(split); + key = part1 + " " + part2; + } - return key; - } + return key; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java index 5a6db45850..0049ad4646 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java @@ -43,152 +43,147 @@ import org.jboss.netty.util.CharsetUtil; */ public class WebSocketClientHandshaker10 extends WebSocketClientHandshaker { - private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketClientHandshaker10.class); + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketClientHandshaker10.class); - public static final String MAGIC_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + public static final String MAGIC_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; - private String expectedChallengeResponseString = null; + private String expectedChallengeResponseString = null; - private String protocol = null; + private String protocol = null; - private boolean allowExtensions = false; + private boolean allowExtensions = false; - /** - * Constructor specifying the destination web socket location and version to - * initiate - * - * @param webSocketURL - * URL for web socket communications. e.g - * "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. - * @param version - * Version of web socket specification to use to connect to the - * server - * @param subProtocol - * Sub protocol request sent to the server. - * @param allowExtensions - * Allow extensions to be used in the reserved bits of the web socket frame - */ - public WebSocketClientHandshaker10(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol, - boolean allowExtensions) { - super(webSocketURL, version, subProtocol); - this.allowExtensions = allowExtensions; - return; - } + /** + * Constructor specifying the destination web socket location and version to + * initiate + * + * @param webSocketURL + * URL for web socket communications. e.g + * "ws://myhost.com/mypath". Subsequent web socket frames will be + * sent to this URL. + * @param version + * Version of web socket specification to use to connect to the + * server + * @param subProtocol + * Sub protocol request sent to the server. + * @param allowExtensions + * Allow extensions to be used in the reserved bits of the web + * socket frame + */ + public WebSocketClientHandshaker10(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol, boolean allowExtensions) { + super(webSocketURL, version, subProtocol); + this.allowExtensions = allowExtensions; + return; + } - /** - * /** - *

- * Sends the opening request to the server: - *

- * - *
-	 * GET /chat HTTP/1.1
-	 * Host: server.example.com
-	 * Upgrade: websocket
-	 * Connection: Upgrade
-	 * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
-	 * Sec-WebSocket-Origin: http://example.com
-	 * Sec-WebSocket-Protocol: chat, superchat
-	 * Sec-WebSocket-Version: 8
-	 * 
- * - * @param ctx - * Channel context - * @param channel - * Channel into which we can write our request - */ - @Override - public void beginOpeningHandshake(ChannelHandlerContext ctx, Channel channel) { - // Get path - URI wsURL = this.getWebSocketURL(); - String path = wsURL.getPath(); - if (wsURL.getQuery() != null && wsURL.getQuery().length() > 0) { - path = wsURL.getPath() + "?" + wsURL.getQuery(); - } + /** + * /** + *

+ * Sends the opening request to the server: + *

+ * + *
+     * GET /chat HTTP/1.1
+     * Host: server.example.com
+     * Upgrade: websocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
+     * Sec-WebSocket-Origin: http://example.com
+     * Sec-WebSocket-Protocol: chat, superchat
+     * Sec-WebSocket-Version: 8
+     * 
+ * + * @param ctx + * Channel context + * @param channel + * Channel into which we can write our request + */ + @Override + public void beginOpeningHandshake(ChannelHandlerContext ctx, Channel channel) { + // Get path + URI wsURL = this.getWebSocketURL(); + String path = wsURL.getPath(); + if (wsURL.getQuery() != null && wsURL.getQuery().length() > 0) { + path = wsURL.getPath() + "?" + wsURL.getQuery(); + } - // Get 16 bit nonce and base 64 encode it - byte[] nonce = createRandomBytes(16); - String key = base64Encode(nonce); + // Get 16 bit nonce and base 64 encode it + byte[] nonce = createRandomBytes(16); + String key = base64Encode(nonce); - String acceptSeed = key + MAGIC_GUID; - byte[] sha1 = sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); - this.expectedChallengeResponseString = base64Encode(sha1); + String acceptSeed = key + MAGIC_GUID; + byte[] sha1 = sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); + this.expectedChallengeResponseString = base64Encode(sha1); - if (logger.isDebugEnabled()) { - logger.debug(String.format("HyBi10 Client Handshake key: %s. Expected response: %s.", key, - this.expectedChallengeResponseString)); - } + if (logger.isDebugEnabled()) { + logger.debug(String.format("HyBi10 Client Handshake key: %s. Expected response: %s.", key, this.expectedChallengeResponseString)); + } - // Format request - HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); - request.addHeader(Names.UPGRADE, Values.WEBSOCKET.toLowerCase()); - request.addHeader(Names.CONNECTION, Values.UPGRADE); - request.addHeader(Names.SEC_WEBSOCKET_KEY, key); - request.addHeader(Names.HOST, wsURL.getHost()); - request.addHeader(Names.ORIGIN, "http://" + wsURL.getHost()); - if (protocol != null && !protocol.equals("")) { - request.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, protocol); - } - request.addHeader(Names.SEC_WEBSOCKET_VERSION, "8"); + // Format request + HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); + request.addHeader(Names.UPGRADE, Values.WEBSOCKET.toLowerCase()); + request.addHeader(Names.CONNECTION, Values.UPGRADE); + request.addHeader(Names.SEC_WEBSOCKET_KEY, key); + request.addHeader(Names.HOST, wsURL.getHost()); + request.addHeader(Names.ORIGIN, "http://" + wsURL.getHost()); + if (protocol != null && !protocol.equals("")) { + request.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, protocol); + } + request.addHeader(Names.SEC_WEBSOCKET_VERSION, "8"); - channel.write(request); + channel.write(request); - ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket08FrameEncoder(true)); - return; - } + ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket08FrameEncoder(true)); + return; + } - /** - *

- * Process server response: - *

- * - *
-	 * HTTP/1.1 101 Switching Protocols
-	 * Upgrade: websocket
-	 * Connection: Upgrade
-	 * Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
-	 * Sec-WebSocket-Protocol: chat
-	 * 
- * - * @param ctx - * Channel context - * @param response - * HTTP response returned from the server for the request sent by - * beginOpeningHandshake00(). - * @throws WebSocketHandshakeException - */ - @Override - public void endOpeningHandshake(ChannelHandlerContext ctx, HttpResponse response) - throws WebSocketHandshakeException { - final HttpResponseStatus status = new HttpResponseStatus(101, "Switching Protocols"); + /** + *

+ * Process server response: + *

+ * + *
+     * HTTP/1.1 101 Switching Protocols
+     * Upgrade: websocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
+     * Sec-WebSocket-Protocol: chat
+     * 
+ * + * @param ctx + * Channel context + * @param response + * HTTP response returned from the server for the request sent by + * beginOpeningHandshake00(). + * @throws WebSocketHandshakeException + */ + @Override + public void endOpeningHandshake(ChannelHandlerContext ctx, HttpResponse response) throws WebSocketHandshakeException { + final HttpResponseStatus status = new HttpResponseStatus(101, "Switching Protocols"); - if (!response.getStatus().equals(status)) { - throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus()); - } + if (!response.getStatus().equals(status)) { + throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus()); + } - String upgrade = response.getHeader(Names.UPGRADE); - if (upgrade == null || !upgrade.equals(Values.WEBSOCKET.toLowerCase())) { - throw new WebSocketHandshakeException("Invalid handshake response upgrade: " - + response.getHeader(Names.UPGRADE)); - } + String upgrade = response.getHeader(Names.UPGRADE); + if (upgrade == null || !upgrade.equals(Values.WEBSOCKET.toLowerCase())) { + throw new WebSocketHandshakeException("Invalid handshake response upgrade: " + response.getHeader(Names.UPGRADE)); + } - String connection = response.getHeader(Names.CONNECTION); - if (connection == null || !connection.equals(Values.UPGRADE)) { - throw new WebSocketHandshakeException("Invalid handshake response connection: " - + response.getHeader(Names.CONNECTION)); - } + String connection = response.getHeader(Names.CONNECTION); + if (connection == null || !connection.equals(Values.UPGRADE)) { + throw new WebSocketHandshakeException("Invalid handshake response connection: " + response.getHeader(Names.CONNECTION)); + } - String accept = response.getHeader(Names.SEC_WEBSOCKET_ACCEPT); - if (accept == null || !accept.equals(this.expectedChallengeResponseString)) { - throw new WebSocketHandshakeException(String.format("Invalid challenge. Actual: %s. Expected: %s", accept, - this.expectedChallengeResponseString)); - } + String accept = response.getHeader(Names.SEC_WEBSOCKET_ACCEPT); + if (accept == null || !accept.equals(this.expectedChallengeResponseString)) { + throw new WebSocketHandshakeException(String.format("Invalid challenge. Actual: %s. Expected: %s", accept, this.expectedChallengeResponseString)); + } - ctx.getPipeline().replace("decoder", "ws-decoder", new WebSocket08FrameDecoder(false, this.allowExtensions)); + ctx.getPipeline().replace("decoder", "ws-decoder", new WebSocket08FrameDecoder(false, this.allowExtensions)); - this.setOpenningHandshakeCompleted(true); - return; - } + this.setOpenningHandshakeCompleted(true); + return; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java index 341a20e676..a8c13e4d5f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java @@ -24,33 +24,33 @@ import java.net.URI; */ public class WebSocketClientHandshakerFactory { - /** - * Instances a new handshaker - * - * @param webSocketURL - * URL for web socket communications. e.g - * "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. - * @param version - * Version of web socket specification to use to connect to the - * server - * @param subProtocol - * Sub protocol request sent to the server. Null if no - * sub-protocol support is required. - * @param allowExtensions - * Allow extensions to be used in the reserved bits of the web socket frame - * @throws WebSocketHandshakeException - */ - public WebSocketClientHandshaker newHandshaker(URI webSocketURL, WebSocketSpecificationVersion version, - String subProtocol, boolean allowExtensions) throws WebSocketHandshakeException { - if (version == WebSocketSpecificationVersion.V10) { - return new WebSocketClientHandshaker10(webSocketURL, version, subProtocol, allowExtensions); - } - if (version == WebSocketSpecificationVersion.V00) { - return new WebSocketClientHandshaker00(webSocketURL, version, subProtocol); - } + /** + * Instances a new handshaker + * + * @param webSocketURL + * URL for web socket communications. e.g + * "ws://myhost.com/mypath". Subsequent web socket frames will be + * sent to this URL. + * @param version + * Version of web socket specification to use to connect to the + * server + * @param subProtocol + * Sub protocol request sent to the server. Null if no + * sub-protocol support is required. + * @param allowExtensions + * Allow extensions to be used in the reserved bits of the web + * socket frame + * @throws WebSocketHandshakeException + */ + public WebSocketClientHandshaker newHandshaker(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol, boolean allowExtensions) throws WebSocketHandshakeException { + if (version == WebSocketSpecificationVersion.V10) { + return new WebSocketClientHandshaker10(webSocketURL, version, subProtocol, allowExtensions); + } + if (version == WebSocketSpecificationVersion.V00) { + return new WebSocketClientHandshaker00(webSocketURL, version, subProtocol); + } - throw new WebSocketHandshakeException("Protocol version " + version.toString() + " not supported."); + throw new WebSocketHandshakeException("Protocol version " + version.toString() + " not supported."); - } + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketFrame.java index 2421a60850..c9245fa68b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketFrame.java @@ -24,59 +24,57 @@ import org.jboss.netty.buffer.ChannelBuffer; */ public abstract class WebSocketFrame { - /** - * Flag to indicate if this frame is the final fragment in a message. The - * first fragment (frame) may also be the final fragment. - */ - private boolean finalFragment = true; + /** + * Flag to indicate if this frame is the final fragment in a message. The + * first fragment (frame) may also be the final fragment. + */ + private boolean finalFragment = true; - /** - * RSV1, RSV2, RSV3 used for extensions - */ - private int rsv = 0; - - /** - * Contents of this frame - */ - private ChannelBuffer binaryData; + /** + * RSV1, RSV2, RSV3 used for extensions + */ + private int rsv = 0; - /** - * Returns binary data - */ - public ChannelBuffer getBinaryData() { - return binaryData; - } + /** + * Contents of this frame + */ + private ChannelBuffer binaryData; - /** - * Sets the binary data for this frame - */ - public void setBinaryData(ChannelBuffer binaryData) { - this.binaryData = binaryData; - } + /** + * Returns binary data + */ + public ChannelBuffer getBinaryData() { + return binaryData; + } - /** - * Flag to indicate if this frame is the final fragment in a message. The - * first fragment (frame) may also be the final fragment. - */ - public boolean isFinalFragment() { - return finalFragment; - } + /** + * Sets the binary data for this frame + */ + public void setBinaryData(ChannelBuffer binaryData) { + this.binaryData = binaryData; + } - public void setFinalFragment(boolean finalFragment) { - this.finalFragment = finalFragment; - } + /** + * Flag to indicate if this frame is the final fragment in a message. The + * first fragment (frame) may also be the final fragment. + */ + public boolean isFinalFragment() { + return finalFragment; + } - /** - * Bits used for extensions to the standard. - */ - public int getRsv() { - return rsv; - } + public void setFinalFragment(boolean finalFragment) { + this.finalFragment = finalFragment; + } - public void setRsv(int rsv) { - this.rsv = rsv; - } - - + /** + * Bits used for extensions to the standard. + */ + public int getRsv() { + return rsv; + } + + public void setRsv(int rsv) { + this.rsv = rsv; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketFrameType.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketFrameType.java index 8e80602045..385a2fd5cb 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketFrameType.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketFrameType.java @@ -21,5 +21,5 @@ package org.jboss.netty.handler.codec.http.websocketx; * @author The Netty Project */ public enum WebSocketFrameType { - TEXT, BINARY, PING, PONG, CLOSE, CONTINUATION + TEXT, BINARY, PING, PONG, CLOSE, CONTINUATION } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketHandshakeException.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketHandshakeException.java index db9f768615..13b3f5b56e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketHandshakeException.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketHandshakeException.java @@ -22,13 +22,13 @@ package org.jboss.netty.handler.codec.http.websocketx; */ public class WebSocketHandshakeException extends Exception { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public WebSocketHandshakeException(String s) { - super(s); - } + public WebSocketHandshakeException(String s) { + super(s); + } - public WebSocketHandshakeException(String s, Throwable throwable) { - super(s, throwable); - } + public WebSocketHandshakeException(String s, Throwable throwable) { + super(s, throwable); + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java index 29656ae060..9d5ccab099 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java @@ -32,160 +32,160 @@ import org.jboss.netty.util.CharsetUtil; */ public abstract class WebSocketServerHandshaker { - private String webSocketURL; + private String webSocketURL; - private String subProtocols; + private String subProtocols; - private String[] subProtocolsArray = null; + private String[] subProtocolsArray = null; - private WebSocketSpecificationVersion version = WebSocketSpecificationVersion.UNKNOWN; + private WebSocketSpecificationVersion version = WebSocketSpecificationVersion.UNKNOWN; - /** - * 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. - * @param subProtocols - * CSV of supported protocols. Null if sub protocols not - * supported. - */ - public WebSocketServerHandshaker(String webSocketURL, String subProtocols) { - this.webSocketURL = webSocketURL; - this.subProtocols = subProtocols; + /** + * 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. + * @param subProtocols + * CSV of supported protocols. Null if sub protocols not + * supported. + */ + public WebSocketServerHandshaker(String webSocketURL, String subProtocols) { + this.webSocketURL = webSocketURL; + this.subProtocols = subProtocols; - if (this.subProtocols != null) { - this.subProtocolsArray = subProtocols.split(","); - for (int i = 0; i < this.subProtocolsArray.length; i++) { - this.subProtocolsArray[i] = this.subProtocolsArray[i].trim(); - } - } - return; - } + if (this.subProtocols != null) { + this.subProtocolsArray = subProtocols.split(","); + for (int i = 0; i < this.subProtocolsArray.length; i++) { + this.subProtocolsArray[i] = this.subProtocolsArray[i].trim(); + } + } + return; + } - /** - * Returns the URL of the web socket - */ - public String getWebSocketURL() { - return webSocketURL; - } + /** + * Returns the URL of the web socket + */ + public String getWebSocketURL() { + return webSocketURL; + } - public void setWebSocketURL(String webSocketURL) { - this.webSocketURL = webSocketURL; - } + public void setWebSocketURL(String webSocketURL) { + this.webSocketURL = webSocketURL; + } - /** - * Returns the CSV of supported sub protocols - */ - public String getSubProtocols() { - return subProtocols; - } + /** + * Returns the CSV of supported sub protocols + */ + public String getSubProtocols() { + return subProtocols; + } - public void setSubProtocols(String subProtocols) { - this.subProtocols = subProtocols; - } + public void setSubProtocols(String subProtocols) { + this.subProtocols = subProtocols; + } - /** - * Returns the version of the specification being supported - */ - public WebSocketSpecificationVersion getVersion() { - return version; - } + /** + * Returns the version of the specification being supported + */ + public WebSocketSpecificationVersion getVersion() { + return version; + } - public void setVersion(WebSocketSpecificationVersion version) { - this.version = version; - } + public void setVersion(WebSocketSpecificationVersion version) { + this.version = version; + } - /** - * Performs the opening handshake - * - * @param ctx - * Context - * @param req - * HTTP Request - * @throws NoSuchAlgorithmException - */ - public abstract void executeOpeningHandshake(ChannelHandlerContext ctx, HttpRequest req); + /** + * Performs the opening handshake + * + * @param ctx + * Context + * @param req + * HTTP Request + * @throws NoSuchAlgorithmException + */ + public abstract void executeOpeningHandshake(ChannelHandlerContext ctx, HttpRequest req); - /** - * Performs the closing handshake - * - * @param ctx - * Context - * @param frame - * Closing Frame that was received - */ - public abstract void executeClosingHandshake(ChannelHandlerContext ctx, CloseWebSocketFrame frame); + /** + * Performs the closing handshake + * + * @param ctx + * Context + * @param frame + * Closing Frame that was received + */ + public abstract void executeClosingHandshake(ChannelHandlerContext ctx, CloseWebSocketFrame frame); - /** - * Performs an MD5 hash - * - * @param bytes - * Data to hash - * @return Hashed data - */ - protected byte[] md5(byte[] bytes) { - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - return md.digest(bytes); - } catch (NoSuchAlgorithmException e) { - throw new InternalError("MD5 not supported on this platform"); - } - } + /** + * Performs an MD5 hash + * + * @param bytes + * Data to hash + * @return Hashed data + */ + protected byte[] md5(byte[] bytes) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + return md.digest(bytes); + } catch (NoSuchAlgorithmException e) { + throw new InternalError("MD5 not supported on this platform"); + } + } - /** - * SHA-1 hashing. Instance this we think it is not thread safe - * - * @param bytes - * byte to hash - * @return hashed - */ - protected byte[] sha1(byte[] bytes) { - try { - MessageDigest md = MessageDigest.getInstance("SHA1"); - return md.digest(bytes); - } catch (NoSuchAlgorithmException e) { - throw new InternalError("SHA-1 not supported on this platform"); - } - } + /** + * SHA-1 hashing. Instance this we think it is not thread safe + * + * @param bytes + * byte to hash + * @return hashed + */ + protected byte[] sha1(byte[] bytes) { + try { + MessageDigest md = MessageDigest.getInstance("SHA1"); + return md.digest(bytes); + } catch (NoSuchAlgorithmException e) { + throw new InternalError("SHA-1 not supported on this platform"); + } + } - /** - * Base 64 encoding - * - * @param bytes - * Bytes to encode - * @return encoded string - */ - protected String base64Encode(byte[] bytes) { - ChannelBuffer hashed = ChannelBuffers.wrappedBuffer(bytes); - return Base64.encode(hashed).toString(CharsetUtil.UTF_8); - } + /** + * Base 64 encoding + * + * @param bytes + * Bytes to encode + * @return encoded string + */ + protected String base64Encode(byte[] bytes) { + ChannelBuffer hashed = ChannelBuffers.wrappedBuffer(bytes); + return Base64.encode(hashed).toString(CharsetUtil.UTF_8); + } - /** - * Selects the first matching supported sub protocol - * - * @param requestedSubProtocol - * CSV of protocols to be supported. e.g. "chat, superchat" - * @return First matching supported sub protocol. Null if not found. - */ - protected String selectSubProtocol(String requestedSubProtocol) { - if (requestedSubProtocol == null || this.subProtocolsArray == null) { - return null; - } + /** + * Selects the first matching supported sub protocol + * + * @param requestedSubProtocol + * CSV of protocols to be supported. e.g. "chat, superchat" + * @return First matching supported sub protocol. Null if not found. + */ + protected String selectSubProtocol(String requestedSubProtocol) { + if (requestedSubProtocol == null || this.subProtocolsArray == null) { + return null; + } - String[] requesteSubProtocolsArray = requestedSubProtocol.split(","); - for (int i = 0; i < requesteSubProtocolsArray.length; i++) { - String requesteSubProtocol = requesteSubProtocolsArray[i].trim(); + String[] requesteSubProtocolsArray = requestedSubProtocol.split(","); + for (int i = 0; i < requesteSubProtocolsArray.length; i++) { + String requesteSubProtocol = requesteSubProtocolsArray[i].trim(); - for (String supportedSubProtocol : this.subProtocolsArray) { - if (requesteSubProtocol.equals(supportedSubProtocol)) { - return requesteSubProtocol; - } - } - } + for (String supportedSubProtocol : this.subProtocolsArray) { + if (requesteSubProtocol.equals(supportedSubProtocol)) { + return requesteSubProtocol; + } + } + } - // No match found - return null; - } + // No match found + return null; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java index cfbbcd3f0a..7426c97b37 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java @@ -59,147 +59,145 @@ import org.jboss.netty.logging.InternalLoggerFactory; */ public class WebSocketServerHandshaker00 extends WebSocketServerHandshaker { - private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandshaker00.class); + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandshaker00.class); - /** - * 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. - * @param subProtocols - * CSV of supported protocols - */ - public WebSocketServerHandshaker00(String webSocketURL, String subProtocols) { - super(webSocketURL, subProtocols); - return; - } + /** + * 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. + * @param subProtocols + * CSV of supported protocols + */ + public WebSocketServerHandshaker00(String webSocketURL, String subProtocols) { + super(webSocketURL, subProtocols); + return; + } - /** - *

- * Handle the web socket handshake for the web socket specification HyBi - * version 0 and lower. This standard is really a rehash of hixie-76 and hixie-75. - *

- * - *

- * Browser request to the server: - *

- * - *
-	 * GET /demo HTTP/1.1
-	 * Upgrade: WebSocket
-	 * Connection: Upgrade
-	 * Host: example.com
-	 * Origin: http://example.com
-	 * Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5
-	 * Sec-WebSocket-Key2: 12998 5 Y3 1  .P00
-	 * 
-	 * ^n:ds[4U
-	 * 
- * - *

- * Server response: - *

- * - *
-	 * HTTP/1.1 101 WebSocket Protocol Handshake
-	 * Upgrade: WebSocket
-	 * Connection: Upgrade
-	 * Sec-WebSocket-Origin: http://example.com
-	 * Sec-WebSocket-Location: ws://example.com/demo
-	 * Sec-WebSocket-Protocol: sample
-	 * 
-	 * 8jKS'y:G*Co,Wxa-
-	 * 
- * - * @param ctx - * Channel context - * @param req - * HTTP request - * @throws NoSuchAlgorithmException - */ - @Override - public void executeOpeningHandshake(ChannelHandlerContext ctx, HttpRequest req) { + /** + *

+ * Handle the web socket handshake for the web socket specification HyBi + * version 0 and lower. This standard is really a rehash of hixie-76 and hixie-75. + *

+ * + *

+ * Browser request to the server: + *

+ * + *
+     * GET /demo HTTP/1.1
+     * Upgrade: WebSocket
+     * Connection: Upgrade
+     * Host: example.com
+     * Origin: http://example.com
+     * Sec-WebSocket-Key1: 4 @1  46546xW%0l 1 5
+     * Sec-WebSocket-Key2: 12998 5 Y3 1  .P00
+     * 
+     * ^n:ds[4U
+     * 
+ * + *

+ * Server response: + *

+ * + *
+     * HTTP/1.1 101 WebSocket Protocol Handshake
+     * Upgrade: WebSocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Origin: http://example.com
+     * Sec-WebSocket-Location: ws://example.com/demo
+     * Sec-WebSocket-Protocol: sample
+     * 
+     * 8jKS'y:G*Co,Wxa-
+     * 
+ * + * @param ctx + * Channel context + * @param req + * HTTP request + * @throws NoSuchAlgorithmException + */ + @Override + public void executeOpeningHandshake(ChannelHandlerContext ctx, HttpRequest req) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("Channel %s web socket spec version 00 handshake", ctx.getChannel().getId())); - } - this.setVersion(WebSocketSpecificationVersion.V00); + if (logger.isDebugEnabled()) { + logger.debug(String.format("Channel %s web socket spec version 00 handshake", ctx.getChannel().getId())); + } + this.setVersion(WebSocketSpecificationVersion.V00); - // Serve the WebSocket handshake request. - if (!Values.UPGRADE.equalsIgnoreCase(req.getHeader(CONNECTION)) - || !WEBSOCKET.equalsIgnoreCase(req.getHeader(Names.UPGRADE))) { - return; - } + // Serve the WebSocket handshake request. + if (!Values.UPGRADE.equalsIgnoreCase(req.getHeader(CONNECTION)) || !WEBSOCKET.equalsIgnoreCase(req.getHeader(Names.UPGRADE))) { + return; + } - // Hixie 75 does not contain these headers while Hixie 76 does - boolean isHixie76 = req.containsHeader(SEC_WEBSOCKET_KEY1) && req.containsHeader(SEC_WEBSOCKET_KEY2); + // Hixie 75 does not contain these headers while Hixie 76 does + boolean isHixie76 = req.containsHeader(SEC_WEBSOCKET_KEY1) && req.containsHeader(SEC_WEBSOCKET_KEY2); - // Create the WebSocket handshake response. - HttpResponse res = new DefaultHttpResponse(HTTP_1_1, new HttpResponseStatus(101, - isHixie76 ? "WebSocket Protocol Handshake" : "Web Socket Protocol Handshake")); - res.addHeader(Names.UPGRADE, WEBSOCKET); - res.addHeader(CONNECTION, Values.UPGRADE); + // Create the WebSocket handshake response. + HttpResponse res = new DefaultHttpResponse(HTTP_1_1, new HttpResponseStatus(101, isHixie76 ? "WebSocket Protocol Handshake" : "Web Socket Protocol Handshake")); + res.addHeader(Names.UPGRADE, WEBSOCKET); + res.addHeader(CONNECTION, Values.UPGRADE); - // Fill in the headers and contents depending on handshake method. - if (isHixie76) { - // New handshake method with a challenge: - res.addHeader(SEC_WEBSOCKET_ORIGIN, req.getHeader(ORIGIN)); - res.addHeader(SEC_WEBSOCKET_LOCATION, this.getWebSocketURL()); - String protocol = req.getHeader(SEC_WEBSOCKET_PROTOCOL); - if (protocol != null) { - res.addHeader(SEC_WEBSOCKET_PROTOCOL, selectSubProtocol(protocol)); - } + // Fill in the headers and contents depending on handshake method. + if (isHixie76) { + // New handshake method with a challenge: + res.addHeader(SEC_WEBSOCKET_ORIGIN, req.getHeader(ORIGIN)); + res.addHeader(SEC_WEBSOCKET_LOCATION, this.getWebSocketURL()); + String protocol = req.getHeader(SEC_WEBSOCKET_PROTOCOL); + if (protocol != null) { + res.addHeader(SEC_WEBSOCKET_PROTOCOL, selectSubProtocol(protocol)); + } - // Calculate the answer of the challenge. - String key1 = req.getHeader(SEC_WEBSOCKET_KEY1); - String key2 = req.getHeader(SEC_WEBSOCKET_KEY2); - int a = (int) (Long.parseLong(key1.replaceAll("[^0-9]", "")) / key1.replaceAll("[^ ]", "").length()); - int b = (int) (Long.parseLong(key2.replaceAll("[^0-9]", "")) / key2.replaceAll("[^ ]", "").length()); - long c = req.getContent().readLong(); - ChannelBuffer input = ChannelBuffers.buffer(16); - input.writeInt(a); - input.writeInt(b); - input.writeLong(c); - ChannelBuffer output = ChannelBuffers.wrappedBuffer(this.md5(input.array())); - res.setContent(output); - } else { - // Old Hixie 75 handshake method with no challenge: - res.addHeader(WEBSOCKET_ORIGIN, req.getHeader(ORIGIN)); - res.addHeader(WEBSOCKET_LOCATION, this.getWebSocketURL()); - String protocol = req.getHeader(WEBSOCKET_PROTOCOL); - if (protocol != null) { - res.addHeader(WEBSOCKET_PROTOCOL, selectSubProtocol(protocol)); - } - } + // Calculate the answer of the challenge. + String key1 = req.getHeader(SEC_WEBSOCKET_KEY1); + String key2 = req.getHeader(SEC_WEBSOCKET_KEY2); + int a = (int) (Long.parseLong(key1.replaceAll("[^0-9]", "")) / key1.replaceAll("[^ ]", "").length()); + int b = (int) (Long.parseLong(key2.replaceAll("[^0-9]", "")) / key2.replaceAll("[^ ]", "").length()); + long c = req.getContent().readLong(); + ChannelBuffer input = ChannelBuffers.buffer(16); + input.writeInt(a); + input.writeInt(b); + input.writeLong(c); + ChannelBuffer output = ChannelBuffers.wrappedBuffer(this.md5(input.array())); + res.setContent(output); + } else { + // Old Hixie 75 handshake method with no challenge: + res.addHeader(WEBSOCKET_ORIGIN, req.getHeader(ORIGIN)); + res.addHeader(WEBSOCKET_LOCATION, this.getWebSocketURL()); + String protocol = req.getHeader(WEBSOCKET_PROTOCOL); + if (protocol != null) { + res.addHeader(WEBSOCKET_PROTOCOL, selectSubProtocol(protocol)); + } + } - // Upgrade the connection and send the handshake response. - ChannelPipeline p = ctx.getChannel().getPipeline(); - p.remove("aggregator"); - p.replace("decoder", "wsdecoder", new WebSocket00FrameDecoder()); + // Upgrade the connection and send the handshake response. + ChannelPipeline p = ctx.getChannel().getPipeline(); + p.remove("aggregator"); + p.replace("decoder", "wsdecoder", new WebSocket00FrameDecoder()); - ctx.getChannel().write(res); + ctx.getChannel().write(res); - p.replace("encoder", "wsencoder", new WebSocket00FrameEncoder()); - return; - } + p.replace("encoder", "wsencoder", new WebSocket00FrameEncoder()); + return; + } - /** - * Echo back the closing frame - * - * @param ctx - * Channel context - * @param frame - * Web Socket frame that was received - */ - @Override - public void executeClosingHandshake(ChannelHandlerContext ctx, CloseWebSocketFrame frame) { - ctx.getChannel().write(frame); - } + /** + * Echo back the closing frame + * + * @param ctx + * Channel context + * @param frame + * Web Socket frame that was received + */ + @Override + public void executeClosingHandshake(ChannelHandlerContext ctx, CloseWebSocketFrame frame) { + ctx.getChannel().write(frame); + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java index 84467ab9e5..541b4f8489 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java @@ -43,125 +43,125 @@ import org.jboss.netty.util.CharsetUtil; */ public class WebSocketServerHandshaker10 extends WebSocketServerHandshaker { - private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandshaker10.class); + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandshaker10.class); - public static final String WEBSOCKET_08_ACCEPT_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + public static final String WEBSOCKET_08_ACCEPT_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; - private boolean allowExtensions = false; + private boolean allowExtensions = false; - /** - * 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. - * @param subProtocols - * CSV of supported protocols - * @param allowExtensions - * Allow extensions to be used in the reserved bits of the web - * socket frame - */ - public WebSocketServerHandshaker10(String webSocketURL, String subProtocols, boolean allowExtensions) { - super(webSocketURL, subProtocols); - this.allowExtensions = allowExtensions; - return; - } + /** + * 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. + * @param subProtocols + * CSV of supported protocols + * @param allowExtensions + * Allow extensions to be used in the reserved bits of the web + * socket frame + */ + public WebSocketServerHandshaker10(String webSocketURL, String subProtocols, boolean allowExtensions) { + super(webSocketURL, subProtocols); + this.allowExtensions = allowExtensions; + return; + } - /** - *

- * Handle the web socket handshake for the web socket specification HyBi - * version 8 to 10. Version 8, 9 and 10 share the same wire protocol. - *

- * - *

- * Browser request to the server: - *

- * - *
-	 * GET /chat HTTP/1.1
-	 * Host: server.example.com
-	 * Upgrade: websocket
-	 * Connection: Upgrade
-	 * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
-	 * Sec-WebSocket-Origin: http://example.com
-	 * Sec-WebSocket-Protocol: chat, superchat
-	 * Sec-WebSocket-Version: 8
-	 * 
- * - *

- * Server response: - *

- * - *
-	 * HTTP/1.1 101 Switching Protocols
-	 * Upgrade: websocket
-	 * Connection: Upgrade
-	 * Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
-	 * Sec-WebSocket-Protocol: chat
-	 * 
- * - * @param ctx - * Channel context - * @param req - * HTTP request - * @throws NoSuchAlgorithmException - */ - @Override - public void executeOpeningHandshake(ChannelHandlerContext ctx, HttpRequest req) { + /** + *

+ * Handle the web socket handshake for the web socket specification HyBi + * version 8 to 10. Version 8, 9 and 10 share the same wire protocol. + *

+ * + *

+ * Browser request to the server: + *

+ * + *
+     * GET /chat HTTP/1.1
+     * Host: server.example.com
+     * Upgrade: websocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
+     * Sec-WebSocket-Origin: http://example.com
+     * Sec-WebSocket-Protocol: chat, superchat
+     * Sec-WebSocket-Version: 8
+     * 
+ * + *

+ * Server response: + *

+ * + *
+     * HTTP/1.1 101 Switching Protocols
+     * Upgrade: websocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
+     * Sec-WebSocket-Protocol: chat
+     * 
+ * + * @param ctx + * Channel context + * @param req + * HTTP request + * @throws NoSuchAlgorithmException + */ + @Override + public void executeOpeningHandshake(ChannelHandlerContext ctx, HttpRequest req) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("Channel %s web socket spec version 10 handshake", ctx.getChannel().getId())); - } + if (logger.isDebugEnabled()) { + logger.debug(String.format("Channel %s web socket spec version 10 handshake", ctx.getChannel().getId())); + } - HttpResponse res = new DefaultHttpResponse(HTTP_1_1, new HttpResponseStatus(101, "Switching Protocols")); - this.setVersion(WebSocketSpecificationVersion.V10); + HttpResponse res = new DefaultHttpResponse(HTTP_1_1, new HttpResponseStatus(101, "Switching Protocols")); + this.setVersion(WebSocketSpecificationVersion.V10); - String key = req.getHeader(Names.SEC_WEBSOCKET_KEY); - if (key == null) { - res.setStatus(HttpResponseStatus.BAD_REQUEST); - return; - } - String acceptSeed = key + WEBSOCKET_08_ACCEPT_GUID; - byte[] sha1 = sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); - String accept = base64Encode(sha1); + String key = req.getHeader(Names.SEC_WEBSOCKET_KEY); + if (key == null) { + res.setStatus(HttpResponseStatus.BAD_REQUEST); + return; + } + String acceptSeed = key + WEBSOCKET_08_ACCEPT_GUID; + byte[] sha1 = sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); + String accept = base64Encode(sha1); - if (logger.isDebugEnabled()) { - logger.debug(String.format("HyBi10 Server Handshake key: %s. Response: %s.", key, accept)); - } + if (logger.isDebugEnabled()) { + logger.debug(String.format("HyBi10 Server Handshake key: %s. Response: %s.", key, accept)); + } - res.setStatus(new HttpResponseStatus(101, "Switching Protocols")); - res.addHeader(Names.UPGRADE, WEBSOCKET.toLowerCase()); - res.addHeader(Names.CONNECTION, Names.UPGRADE); - res.addHeader(Names.SEC_WEBSOCKET_ACCEPT, accept); - String protocol = req.getHeader(Names.SEC_WEBSOCKET_PROTOCOL); - if (protocol != null) { - res.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, this.selectSubProtocol(protocol)); - } + res.setStatus(new HttpResponseStatus(101, "Switching Protocols")); + res.addHeader(Names.UPGRADE, WEBSOCKET.toLowerCase()); + res.addHeader(Names.CONNECTION, Names.UPGRADE); + res.addHeader(Names.SEC_WEBSOCKET_ACCEPT, accept); + String protocol = req.getHeader(Names.SEC_WEBSOCKET_PROTOCOL); + if (protocol != null) { + res.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, this.selectSubProtocol(protocol)); + } - ctx.getChannel().write(res); + ctx.getChannel().write(res); - // Upgrade the connection and send the handshake response. - ChannelPipeline p = ctx.getChannel().getPipeline(); - p.remove("aggregator"); - p.replace("decoder", "wsdecoder", new WebSocket08FrameDecoder(true, this.allowExtensions)); - p.replace("encoder", "wsencoder", new WebSocket08FrameEncoder(false)); + // Upgrade the connection and send the handshake response. + ChannelPipeline p = ctx.getChannel().getPipeline(); + p.remove("aggregator"); + p.replace("decoder", "wsdecoder", new WebSocket08FrameDecoder(true, this.allowExtensions)); + p.replace("encoder", "wsencoder", new WebSocket08FrameEncoder(false)); - return; - } + return; + } - /** - * Echo back the closing frame - * - * @param ctx - * Channel context - * @param frame - * Web Socket frame that was received - */ - @Override - public void executeClosingHandshake(ChannelHandlerContext ctx, CloseWebSocketFrame frame) { - ctx.getChannel().write(frame); - } + /** + * Echo back the closing frame + * + * @param ctx + * Channel context + * @param frame + * Web Socket frame that was received + */ + @Override + public void executeClosingHandshake(ChannelHandlerContext ctx, CloseWebSocketFrame frame) { + ctx.getChannel().write(frame); + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java index ed5ff2ae52..e05b1801db 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java @@ -30,79 +30,78 @@ import org.jboss.netty.handler.codec.http.HttpHeaders.Names; */ public class WebSocketServerHandshakerFactory { - private String webSocketURL; + private String webSocketURL; - private String subProtocols; + private String subProtocols; - private boolean allowExtensions = false; + private boolean allowExtensions = false; - /** - * 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. - * @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 - */ - public WebSocketServerHandshakerFactory(String webSocketURL, String subProtocols, boolean allowExtensions) { - this.webSocketURL = webSocketURL; - this.subProtocols = subProtocols; - this.allowExtensions = allowExtensions; - return; - } + /** + * 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. + * @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 + */ + public WebSocketServerHandshakerFactory(String webSocketURL, String subProtocols, boolean allowExtensions) { + this.webSocketURL = webSocketURL; + this.subProtocols = subProtocols; + this.allowExtensions = allowExtensions; + return; + } - /** - * Instances a new handshaker - * - * @param webSocketURL - * URL for web socket communications. e.g - * "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. - * @param version - * Version of web socket specification to use to connect to the - * server - * @param subProtocol - * Sub protocol request sent to the server. Null if no - * sub-protocol support is required. - * @return A new WebSocketServerHandshaker for the requested web socket - * version. Null if web socket version is not supported. - */ - public WebSocketServerHandshaker newHandshaker(ChannelHandlerContext ctx, HttpRequest req) { + /** + * Instances a new handshaker + * + * @param webSocketURL + * URL for web socket communications. e.g + * "ws://myhost.com/mypath". Subsequent web socket frames will be + * sent to this URL. + * @param version + * Version of web socket specification to use to connect to the + * server + * @param subProtocol + * Sub protocol request sent to the server. Null if no + * sub-protocol support is required. + * @return A new WebSocketServerHandshaker for the requested web socket + * version. Null if web socket version is not supported. + */ + public WebSocketServerHandshaker newHandshaker(ChannelHandlerContext ctx, HttpRequest req) { - String version = req.getHeader(Names.SEC_WEBSOCKET_VERSION); - if (version != null) { - if (version.equals("8")) { - // Version 8 of the wire protocol - assume version 10 of the - // specification. - return new WebSocketServerHandshaker10(webSocketURL, subProtocols, this.allowExtensions); - } else { - return null; - } - } else { - // Assume version 00 where version header was not specified - return new WebSocketServerHandshaker00(webSocketURL, subProtocols); - } - } + String version = req.getHeader(Names.SEC_WEBSOCKET_VERSION); + if (version != null) { + if (version.equals("8")) { + // Version 8 of the wire protocol - assume version 10 of the + // specification. + return new WebSocketServerHandshaker10(webSocketURL, subProtocols, this.allowExtensions); + } else { + return null; + } + } else { + // Assume version 00 where version header was not specified + return new WebSocketServerHandshaker00(webSocketURL, subProtocols); + } + } - /** - * Return that we need cannot not support the web socket version - * - * @param ctx - * Context - */ - public void sendUnsupportedWebSocketVersionResponse(ChannelHandlerContext ctx) { - HttpResponse res = new DefaultHttpResponse(HttpVersion.HTTP_1_1, new HttpResponseStatus(101, - "Switching Protocols")); - res.setStatus(HttpResponseStatus.UPGRADE_REQUIRED); - res.setHeader(Names.SEC_WEBSOCKET_VERSION, "8"); - ctx.getChannel().write(res); - return; - } + /** + * Return that we need cannot not support the web socket version + * + * @param ctx + * Context + */ + public void sendUnsupportedWebSocketVersionResponse(ChannelHandlerContext ctx) { + HttpResponse res = new DefaultHttpResponse(HttpVersion.HTTP_1_1, new HttpResponseStatus(101, "Switching Protocols")); + res.setStatus(HttpResponseStatus.UPGRADE_REQUIRED); + res.setHeader(Names.SEC_WEBSOCKET_VERSION, "8"); + ctx.getChannel().write(res); + return; + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketSpecificationVersion.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketSpecificationVersion.java index c83779a7bf..8103296b4d 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketSpecificationVersion.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketSpecificationVersion.java @@ -27,19 +27,19 @@ package org.jboss.netty.handler.codec.http.websocketx; * @author The Netty Project */ public enum WebSocketSpecificationVersion { - UNKNOWN, + UNKNOWN, - /** - * draft-ietf-hybi-thewebsocketprotocol- 00. - */ - V00, + /** + * draft-ietf-hybi-thewebsocketprotocol- 00. + */ + V00, - /** - * draft-ietf-hybi-thewebsocketprotocol- 10 - */ - V10 + /** + * draft-ietf-hybi-thewebsocketprotocol- 10 + */ + V10 } From cc758aa3b638459272dc64031389bd02d60a2001 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Sat, 5 Nov 2011 08:45:33 +0100 Subject: [PATCH 12/93] Fix event firing in OioAcceptedSocketChanel which I broke before --- .../netty/channel/socket/oio/OioAcceptedSocketChannel.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java index 93a52f8b43..4fd1da8729 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java @@ -70,9 +70,6 @@ class OioAcceptedSocketChannel extends OioSocketChannel { } catch (IOException e) { throw new ChannelException("Failed to obtain an OutputStream.", e); } - - fireChannelOpen(this); - fireChannelBound(this, getLocalAddress()); } @Override From 942b746d730566001301f8edc774d571bcbbf175 Mon Sep 17 00:00:00 2001 From: Sun Ning Date: Sat, 5 Nov 2011 22:09:27 +0800 Subject: [PATCH 13/93] add an option in LengthFieldBasedFrameDecoder for whether to count the length field into frame length. --- .../frame/LengthFieldBasedFrameDecoder.java | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java index 292f24a68e..2733109f29 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java @@ -195,6 +195,7 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { private final int lengthFieldEndOffset; private final int lengthAdjustment; private final int initialBytesToStrip; + private final boolean lengthFieldIncludedInFrameLength; private boolean discardingTooLongFrame; private long tooLongFrameLength; private long bytesToDiscard; @@ -215,7 +216,7 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { public LengthFieldBasedFrameDecoder( int maxFrameLength, int lengthFieldOffset, int lengthFieldLength) { - this(maxFrameLength, lengthFieldOffset, lengthFieldLength, 0, 0); + this(maxFrameLength, lengthFieldOffset, lengthFieldLength, 0, 0, false); } /** @@ -238,6 +239,32 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip) { + this(maxFrameLength, lengthFieldOffset, lengthFieldOffset, lengthAdjustment, + initialBytesToStrip, false); + } + + /** + * Creates a new instance. + * + * @param maxFrameLength + * the maximum length of the frame. If the length of the frame is + * greater than this value, {@link TooLongFrameException} will be + * thrown. + * @param lengthFieldOffset + * the offset of the length field + * @param lengthFieldLength + * the length of the length field + * @param lengthAdjustment + * the compensation value to add to the value of the length field + * @param initialBytesToStrip + * the number of first bytes to strip out from the decoded frame + * @param lengthFieldIncludedInFrameLength + * whether to count length field into frame length + */ + public LengthFieldBasedFrameDecoder( + int maxFrameLength, + int lengthFieldOffset, int lengthFieldLength, + int lengthAdjustment, int initialBytesToStrip, boolean lengthFieldIncludedInFrameLength) { if (maxFrameLength <= 0) { throw new IllegalArgumentException( "maxFrameLength must be a positive integer: " + @@ -278,6 +305,7 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { this.lengthAdjustment = lengthAdjustment; lengthFieldEndOffset = lengthFieldOffset + lengthFieldLength; this.initialBytesToStrip = initialBytesToStrip; + this.lengthFieldIncludedInFrameLength = lengthFieldIncludedInFrameLength; } @Override @@ -326,7 +354,9 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { "negative pre-adjustment length field: " + frameLength); } - frameLength += lengthAdjustment + lengthFieldEndOffset; + if (!lengthFieldIncludedInFrameLength) { + frameLength += lengthAdjustment + lengthFieldEndOffset; + } if (frameLength < lengthFieldEndOffset) { buffer.skipBytes(lengthFieldEndOffset); throw new CorruptedFrameException( From 8df2524bb0661d3f99a5552af297e5e47ce5d715 Mon Sep 17 00:00:00 2001 From: Cruz Bishop Date: Sun, 6 Nov 2011 08:08:18 +1000 Subject: [PATCH 14/93] Small fix for LocalAddress.compareTo when both this and o are ephermal --- src/main/java/org/jboss/netty/channel/local/LocalAddress.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/channel/local/LocalAddress.java b/src/main/java/org/jboss/netty/channel/local/LocalAddress.java index 27c78cebdd..06cf91b03c 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalAddress.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalAddress.java @@ -115,7 +115,7 @@ public final class LocalAddress extends SocketAddress implements Comparable b) { From c27af721b0c6d4416feed191526c5f14a966bc49 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sun, 6 Nov 2011 11:54:21 -0500 Subject: [PATCH 15/93] Remove unnecessary interface modifiers. --- .../buffer/ChannelBufferIndexFinder.java | 20 +++++------ .../java/org/jboss/netty/channel/Channel.java | 8 ++--- .../netty/channel/ChannelFutureListener.java | 4 +-- .../jboss/netty/channel/ChannelHandler.java | 2 +- .../HttpTunnelAcceptedChannelFactory.java | 6 ++-- .../HttpTunnelAcceptedChannelReceiver.java | 6 ++-- .../http/HttpTunnelClientWorkerOwner.java | 12 +++---- ...erverMessageSwitchDownstreamInterface.java | 6 ++-- .../ServerMessageSwitchUpstreamInterface.java | 14 ++++---- .../socket/http/TunnelIdGenerator.java | 2 +- .../websocketx/client/WebSocketCallback.java | 8 ++--- .../websocketx/client/WebSocketClient.java | 6 ++-- .../netty/handler/codec/http/FileUpload.java | 12 +++---- .../netty/handler/codec/http/HttpChunk.java | 2 +- .../netty/handler/codec/http/HttpData.java | 34 +++++++++---------- .../handler/codec/http/HttpDataFactory.java | 16 ++++----- .../handler/codec/http/InterfaceHttpData.java | 2 +- .../handler/ipfilter/IpFilterListener.java | 6 ++-- .../netty/handler/ipfilter/IpFilterRule.java | 4 +-- .../handler/ipfilter/IpFilteringHandler.java | 4 +-- .../jboss/netty/handler/ipfilter/IpSet.java | 2 +- 21 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBufferIndexFinder.java b/src/main/java/org/jboss/netty/buffer/ChannelBufferIndexFinder.java index 7f00e1eae9..35c478aeb8 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBufferIndexFinder.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBufferIndexFinder.java @@ -47,7 +47,7 @@ public interface ChannelBufferIndexFinder { /** * Index finder which locates a {@code NUL (0x00)} byte. */ - static ChannelBufferIndexFinder NUL = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder NUL = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { return buffer.getByte(guessedIndex) == 0; @@ -57,7 +57,7 @@ public interface ChannelBufferIndexFinder { /** * Index finder which locates a non-{@code NUL (0x00)} byte. */ - static ChannelBufferIndexFinder NOT_NUL = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder NOT_NUL = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { return buffer.getByte(guessedIndex) != 0; @@ -67,7 +67,7 @@ public interface ChannelBufferIndexFinder { /** * Index finder which locates a {@code CR ('\r')} byte. */ - static ChannelBufferIndexFinder CR = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder CR = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { return buffer.getByte(guessedIndex) == '\r'; @@ -77,7 +77,7 @@ public interface ChannelBufferIndexFinder { /** * Index finder which locates a non-{@code CR ('\r')} byte. */ - static ChannelBufferIndexFinder NOT_CR = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder NOT_CR = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { return buffer.getByte(guessedIndex) != '\r'; @@ -87,7 +87,7 @@ public interface ChannelBufferIndexFinder { /** * Index finder which locates a {@code LF ('\n')} byte. */ - static ChannelBufferIndexFinder LF = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder LF = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { return buffer.getByte(guessedIndex) == '\n'; @@ -97,7 +97,7 @@ public interface ChannelBufferIndexFinder { /** * Index finder which locates a non-{@code LF ('\n')} byte. */ - static ChannelBufferIndexFinder NOT_LF = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder NOT_LF = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { return buffer.getByte(guessedIndex) != '\n'; @@ -107,7 +107,7 @@ public interface ChannelBufferIndexFinder { /** * Index finder which locates a {@code CR ('\r')} or {@code LF ('\n')}. */ - static ChannelBufferIndexFinder CRLF = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder CRLF = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { byte b = buffer.getByte(guessedIndex); @@ -119,7 +119,7 @@ public interface ChannelBufferIndexFinder { * Index finder which locates a byte which is neither a {@code CR ('\r')} * nor a {@code LF ('\n')}. */ - static ChannelBufferIndexFinder NOT_CRLF = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder NOT_CRLF = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { byte b = buffer.getByte(guessedIndex); @@ -131,7 +131,7 @@ public interface ChannelBufferIndexFinder { * Index finder which locates a linear whitespace * ({@code ' '} and {@code '\t'}). */ - static ChannelBufferIndexFinder LINEAR_WHITESPACE = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder LINEAR_WHITESPACE = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { byte b = buffer.getByte(guessedIndex); @@ -143,7 +143,7 @@ public interface ChannelBufferIndexFinder { * Index finder which locates a byte which is not a linear whitespace * (neither {@code ' '} nor {@code '\t'}). */ - static ChannelBufferIndexFinder NOT_LINEAR_WHITESPACE = new ChannelBufferIndexFinder() { + ChannelBufferIndexFinder NOT_LINEAR_WHITESPACE = new ChannelBufferIndexFinder() { @Override public boolean find(ChannelBuffer buffer, int guessedIndex) { byte b = buffer.getByte(guessedIndex); diff --git a/src/main/java/org/jboss/netty/channel/Channel.java b/src/main/java/org/jboss/netty/channel/Channel.java index c3f6ddfc54..6925c18156 100644 --- a/src/main/java/org/jboss/netty/channel/Channel.java +++ b/src/main/java/org/jboss/netty/channel/Channel.java @@ -117,25 +117,25 @@ public interface Channel extends Comparable { * The {@link #getInterestOps() interestOps} value which tells that only * read operation has been suspended. */ - static int OP_NONE = 0; + int OP_NONE = 0; /** * The {@link #getInterestOps() interestOps} value which tells that neither * read nor write operation has been suspended. */ - static int OP_READ = 1; + int OP_READ = 1; /** * The {@link #getInterestOps() interestOps} value which tells that both * read and write operation has been suspended. */ - static int OP_WRITE = 4; + int OP_WRITE = 4; /** * The {@link #getInterestOps() interestOps} value which tells that only * write operation has been suspended. */ - static int OP_READ_WRITE = OP_READ | OP_WRITE; + int OP_READ_WRITE = OP_READ | OP_WRITE; /** * Returns the unique integer ID of this channel. diff --git a/src/main/java/org/jboss/netty/channel/ChannelFutureListener.java b/src/main/java/org/jboss/netty/channel/ChannelFutureListener.java index 904189db84..55d2379882 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelFutureListener.java +++ b/src/main/java/org/jboss/netty/channel/ChannelFutureListener.java @@ -41,7 +41,7 @@ public interface ChannelFutureListener extends EventListener { * A {@link ChannelFutureListener} that closes the {@link Channel} which is * associated with the specified {@link ChannelFuture}. */ - static ChannelFutureListener CLOSE = new ChannelFutureListener() { + ChannelFutureListener CLOSE = new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { future.getChannel().close(); @@ -52,7 +52,7 @@ public interface ChannelFutureListener extends EventListener { * A {@link ChannelFutureListener} that closes the {@link Channel} when the * operation ended up with a failure or cancellation rather than a success. */ - static ChannelFutureListener CLOSE_ON_FAILURE = new ChannelFutureListener() { + ChannelFutureListener CLOSE_ON_FAILURE = new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { if (!future.isSuccess()) { diff --git a/src/main/java/org/jboss/netty/channel/ChannelHandler.java b/src/main/java/org/jboss/netty/channel/ChannelHandler.java index f7f81a04e2..9c17a23ad7 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelHandler.java +++ b/src/main/java/org/jboss/netty/channel/ChannelHandler.java @@ -233,7 +233,7 @@ public interface ChannelHandler { @Documented @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) - public @interface Sharable { + @interface Sharable { // no value } } diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelFactory.java index 89198449ec..52633c5ca1 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelFactory.java @@ -27,8 +27,8 @@ import java.net.InetSocketAddress; * @author OneDrum Ltd. */ interface HttpTunnelAcceptedChannelFactory { - public HttpTunnelAcceptedChannelReceiver newChannel(String newTunnelId, - InetSocketAddress remoteAddress); + HttpTunnelAcceptedChannelReceiver newChannel(String newTunnelId, + InetSocketAddress remoteAddress); - public String generateTunnelId(); + String generateTunnelId(); } \ No newline at end of file diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelReceiver.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelReceiver.java index 061930abbf..e9c51aeea8 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelReceiver.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelReceiver.java @@ -27,10 +27,10 @@ import org.jboss.netty.buffer.ChannelBuffer; */ interface HttpTunnelAcceptedChannelReceiver { - public void updateInterestOps(SaturationStateChange transition); + void updateInterestOps(SaturationStateChange transition); - public void dataReceived(ChannelBuffer data); + void dataReceived(ChannelBuffer data); - public void clientClosed(); + void clientClosed(); } diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientWorkerOwner.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientWorkerOwner.java index 59f3d16154..41ae229f5c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientWorkerOwner.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientWorkerOwner.java @@ -35,8 +35,8 @@ interface HttpTunnelClientWorkerOwner { * The HTTP tunnel client sink invokes this when the application code requests the connection * of an HTTP tunnel to the specified remote address. */ - public void onConnectRequest(ChannelFuture connectFuture, - InetSocketAddress remoteAddress); + void onConnectRequest(ChannelFuture connectFuture, + InetSocketAddress remoteAddress); /** * The send channel handler calls this method when the server accepts the open tunnel request, @@ -44,25 +44,25 @@ interface HttpTunnelClientWorkerOwner { * * @param tunnelId the server allocated tunnel ID */ - public void onTunnelOpened(String tunnelId); + void onTunnelOpened(String tunnelId); /** * The poll channel handler calls this method when the poll channel is connected, indicating * that full duplex communications are now possible. */ - public void fullyEstablished(); + void fullyEstablished(); /** * The poll handler calls this method when some data is received and decoded from the server. * @param content the data received from the server */ - public void onMessageReceived(ChannelBuffer content); + void onMessageReceived(ChannelBuffer content); /** * @return the name of the server with whom we are communicating with - this is used within * the HOST HTTP header for all requests. This is particularly important for operation behind * a proxy, where the HOST string is used to route the request. */ - public String getServerHostName(); + String getServerHostName(); } \ No newline at end of file diff --git a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchDownstreamInterface.java b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchDownstreamInterface.java index cc29a3c286..477fae65a2 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchDownstreamInterface.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchDownstreamInterface.java @@ -28,9 +28,9 @@ import org.jboss.netty.channel.ChannelFuture; */ interface ServerMessageSwitchDownstreamInterface { - public void serverCloseTunnel(String tunnelId); + void serverCloseTunnel(String tunnelId); - public void routeOutboundData(String tunnelId, ChannelBuffer data, - ChannelFuture writeFuture); + void routeOutboundData(String tunnelId, ChannelBuffer data, + ChannelFuture writeFuture); } \ No newline at end of file diff --git a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchUpstreamInterface.java b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchUpstreamInterface.java index 436f68ecf0..91d3fa2eda 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchUpstreamInterface.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchUpstreamInterface.java @@ -32,11 +32,11 @@ import org.jboss.netty.channel.Channel; */ interface ServerMessageSwitchUpstreamInterface { - public String createTunnel(InetSocketAddress remoteAddress); + String createTunnel(InetSocketAddress remoteAddress); - public boolean isOpenTunnel(String tunnelId); + boolean isOpenTunnel(String tunnelId); - public void clientCloseTunnel(String tunnelId); + void clientCloseTunnel(String tunnelId); /** * Passes some received data from a client for forwarding to the server's view @@ -45,12 +45,12 @@ interface ServerMessageSwitchUpstreamInterface { * functional, CLOSED indicates it is closed and the client should be notified * of this (and will be forgotten after this notification). */ - public TunnelStatus routeInboundData(String tunnelId, - ChannelBuffer inboundData); + TunnelStatus routeInboundData(String tunnelId, + ChannelBuffer inboundData); - public void pollOutboundData(String tunnelId, Channel responseChannel); + void pollOutboundData(String tunnelId, Channel responseChannel); - public static enum TunnelStatus { + enum TunnelStatus { ALIVE, CLOSED } diff --git a/src/main/java/org/jboss/netty/channel/socket/http/TunnelIdGenerator.java b/src/main/java/org/jboss/netty/channel/socket/http/TunnelIdGenerator.java index 9eafdf5cce..ac82b195cd 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/TunnelIdGenerator.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/TunnelIdGenerator.java @@ -32,6 +32,6 @@ public interface TunnelIdGenerator { * an existing tunnel ID). This method must be thread safe, and * preferably lock free. */ - public String generateId(); + String generateId(); } diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketCallback.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketCallback.java index b076701bca..26c1d2edd2 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketCallback.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketCallback.java @@ -41,7 +41,7 @@ public interface WebSocketCallback { * @param client * Current client used to connect */ - public void onConnect(WebSocketClient client); + void onConnect(WebSocketClient client); /** * Called when the client got disconnected from the server. @@ -49,7 +49,7 @@ public interface WebSocketCallback { * @param client * Current client that was disconnected */ - public void onDisconnect(WebSocketClient client); + void onDisconnect(WebSocketClient client); /** * Called when a message arrives from the server. @@ -59,7 +59,7 @@ public interface WebSocketCallback { * @param frame * Data received from server */ - public void onMessage(WebSocketClient client, WebSocketFrame frame); + void onMessage(WebSocketClient client, WebSocketFrame frame); /** * Called when an unhandled errors occurs. @@ -67,5 +67,5 @@ public interface WebSocketCallback { * @param t * The causing error */ - public void onError(Throwable t); + void onError(Throwable t); } diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClient.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClient.java index 430b28b6fd..a992cdc646 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClient.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClient.java @@ -37,14 +37,14 @@ public interface WebSocketClient { * * @return Connect future. Fires when connected. */ - public ChannelFuture connect(); + ChannelFuture connect(); /** * Disconnect from the server * * @return Disconnect future. Fires when disconnected. */ - public ChannelFuture disconnect(); + ChannelFuture disconnect(); /** * Send data to server @@ -53,5 +53,5 @@ public interface WebSocketClient { * Data for sending * @return Write future. Will fire when the data is sent. */ - public ChannelFuture send(WebSocketFrame frame); + ChannelFuture send(WebSocketFrame frame); } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/FileUpload.java b/src/main/java/org/jboss/netty/handler/codec/http/FileUpload.java index d7d924498f..1a32ba433d 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/FileUpload.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/FileUpload.java @@ -32,35 +32,35 @@ public interface FileUpload extends HttpData { * as provided by the browser (or other client software). * @return the original filename */ - public String getFilename(); + String getFilename(); /** * Set the original filename * @param filename */ - public void setFilename(String filename); + void setFilename(String filename); /** * Set the Content Type passed by the browser if defined * @param contentType Content Type to set - must be not null */ - public void setContentType(String contentType); + void setContentType(String contentType); /** * Returns the content type passed by the browser or null if not defined. * @return the content type passed by the browser or null if not defined. */ - public String getContentType(); + String getContentType(); /** * Set the Content-Transfer-Encoding type from String as 7bit, 8bit or binary * @param contentTransferEncoding */ - public void setContentTransferEncoding(String contentTransferEncoding); + void setContentTransferEncoding(String contentTransferEncoding); /** * Returns the Content-Transfer-Encoding * @return the Content-Transfer-Encoding */ - public String getContentTransferEncoding(); + String getContentTransferEncoding(); } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpChunk.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpChunk.java index 4c21347e48..736099c067 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpChunk.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpChunk.java @@ -43,7 +43,7 @@ public interface HttpChunk { /** * The 'end of content' marker in chunked encoding. */ - static HttpChunkTrailer LAST_CHUNK = new HttpChunkTrailer() { + HttpChunkTrailer LAST_CHUNK = new HttpChunkTrailer() { @Override public ChannelBuffer getContent() { return ChannelBuffers.EMPTY_BUFFER; diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpData.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpData.java index 83b5b8c501..c0abd165f5 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpData.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpData.java @@ -36,7 +36,7 @@ public interface HttpData extends InterfaceHttpData { * @param buffer must be not null * @exception IOException */ - public void setContent(ChannelBuffer buffer) throws IOException; + void setContent(ChannelBuffer buffer) throws IOException; /** * Add the content from the ChannelBuffer @@ -44,7 +44,7 @@ public interface HttpData extends InterfaceHttpData { * @param last True of the buffer is the last one * @exception IOException */ - public void addContent(ChannelBuffer buffer, boolean last) + void addContent(ChannelBuffer buffer, boolean last) throws IOException; /** @@ -52,46 +52,46 @@ public interface HttpData extends InterfaceHttpData { * @param file must be not null * @exception IOException */ - public void setContent(File file) throws IOException; + void setContent(File file) throws IOException; /** * Set the content from the inputStream (erase any previous data) * @param inputStream must be not null * @exception IOException */ - public void setContent(InputStream inputStream) throws IOException; + void setContent(InputStream inputStream) throws IOException; /** * * @return True if the InterfaceHttpData is completed (all data are stored) */ - public boolean isCompleted(); + boolean isCompleted(); /** * Returns the size in byte of the InterfaceHttpData * @return the size of the InterfaceHttpData */ - public long length(); + long length(); /** * Deletes the underlying storage for a file item, * including deleting any associated temporary disk file. */ - public void delete(); + void delete(); /** * Returns the contents of the file item as an array of bytes. * @return the contents of the file item as an array of bytes. * @exception IOException */ - public byte[] get() throws IOException; + byte[] get() throws IOException; /** * Returns the content of the file item as a ChannelBuffer * @return the content of the file item as a ChannelBuffer * @throws IOException */ - public ChannelBuffer getChannelBuffer() throws IOException; + ChannelBuffer getChannelBuffer() throws IOException; /** * Returns a ChannelBuffer for the content from the current position with at most length read @@ -102,14 +102,14 @@ public interface HttpData extends InterfaceHttpData { * an EMPTY_BUFFER if there is no more data to return * @throws IOException */ - public ChannelBuffer getChunk(int length) throws IOException; + ChannelBuffer getChunk(int length) throws IOException; /** * Returns the contents of the file item as a String, using the default character encoding. * @return the contents of the file item as a String, using the default character encoding. * @exception IOException */ - public String getString() throws IOException; + String getString() throws IOException; /** * Returns the contents of the file item as a String, using the specified charset. @@ -117,19 +117,19 @@ public interface HttpData extends InterfaceHttpData { * @return the contents of the file item as a String, using the specified charset. * @exception IOException */ - public String getString(Charset encoding) throws IOException; + String getString(Charset encoding) throws IOException; /** * Set the Charset passed by the browser if defined * @param charset Charset to set - must be not null */ - public void setCharset(Charset charset); + void setCharset(Charset charset); /** * Returns the Charset passed by the browser or null if not defined. * @return the Charset passed by the browser or null if not defined. */ - public Charset getCharset(); + Charset getCharset(); /** * A convenience method to write an uploaded item to disk. @@ -140,19 +140,19 @@ public interface HttpData extends InterfaceHttpData { * @return True if the write is successful * @exception IOException */ - public boolean renameTo(File dest) throws IOException; + boolean renameTo(File dest) throws IOException; /** * Provides a hint as to whether or not the file contents will be read from memory. * @return True if the file contents is in memory. */ - public boolean isInMemory(); + boolean isInMemory(); /** * * @return the associated File if this data is represented in a file * @exception IOException if this data is not represented by a file */ - public File getFile() throws IOException; + File getFile() throws IOException; } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpDataFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpDataFactory.java index 399bcde0d7..019171fa0b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpDataFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpDataFactory.java @@ -35,7 +35,7 @@ public interface HttpDataFactory { * @throws NullPointerException * @throws IllegalArgumentException */ - public Attribute createAttribute(HttpRequest request, String name) + Attribute createAttribute(HttpRequest request, String name) throws NullPointerException, IllegalArgumentException; /** @@ -47,7 +47,7 @@ public interface HttpDataFactory { * @throws NullPointerException * @throws IllegalArgumentException */ - public Attribute createAttribute(HttpRequest request, String name, String value) + Attribute createAttribute(HttpRequest request, String name, String value) throws NullPointerException, IllegalArgumentException; /** @@ -60,9 +60,9 @@ public interface HttpDataFactory { * @param size the size of the Uploaded file * @return a new FileUpload */ - public FileUpload createFileUpload(HttpRequest request, String name, String filename, - String contentType, String contentTransferEncoding, Charset charset, - long size) throws NullPointerException, IllegalArgumentException; + FileUpload createFileUpload(HttpRequest request, String name, String filename, + String contentType, String contentTransferEncoding, Charset charset, + long size) throws NullPointerException, IllegalArgumentException; /** * Remove the given InterfaceHttpData from clean list (will not delete the file, except if the file @@ -70,17 +70,17 @@ public interface HttpDataFactory { * @param request associated request * @param data */ - public void removeHttpDataFromClean(HttpRequest request, InterfaceHttpData data); + void removeHttpDataFromClean(HttpRequest request, InterfaceHttpData data); /** * Remove all InterfaceHttpData from virtual File storage from clean list for the request * * @param request associated request */ - public void cleanRequestHttpDatas(HttpRequest request); + void cleanRequestHttpDatas(HttpRequest request); /** * Remove all InterfaceHttpData from virtual File storage from clean list for all requests */ - public void cleanAllHttpDatas(); + void cleanAllHttpDatas(); } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/InterfaceHttpData.java b/src/main/java/org/jboss/netty/handler/codec/http/InterfaceHttpData.java index 4e794f34d8..311759126a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/InterfaceHttpData.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/InterfaceHttpData.java @@ -24,7 +24,7 @@ package org.jboss.netty.handler.codec.http; * */ public interface InterfaceHttpData extends Comparable { - public static enum HttpDataType { + enum HttpDataType { Attribute, FileUpload, InternalAttribute; } diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterListener.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterListener.java index 605ce143a8..2bf2a79628 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterListener.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterListener.java @@ -43,7 +43,7 @@ public interface IpFilterListener * @param inetSocketAddress the remote {@link InetSocketAddress} from client * @return the associated ChannelFuture to be waited for before closing the channel. Null is allowed. */ - public ChannelFuture allowed(ChannelHandlerContext ctx, ChannelEvent e, InetSocketAddress inetSocketAddress); + ChannelFuture allowed(ChannelHandlerContext ctx, ChannelEvent e, InetSocketAddress inetSocketAddress); /** * Called when the channel has the CONNECTED status and the channel was refused by a previous call to accept(). @@ -56,7 +56,7 @@ public interface IpFilterListener * @param inetSocketAddress the remote {@link InetSocketAddress} from client * @return the associated ChannelFuture to be waited for before closing the channel. Null is allowed. */ - public ChannelFuture refused(ChannelHandlerContext ctx, ChannelEvent e, InetSocketAddress inetSocketAddress); + ChannelFuture refused(ChannelHandlerContext ctx, ChannelEvent e, InetSocketAddress inetSocketAddress); /** * Called in handleUpstream, if this channel was previously blocked, @@ -69,6 +69,6 @@ public interface IpFilterListener * @return True if the event should continue, False if the event should not continue * since this channel was blocked by this filter */ - public boolean continues(ChannelHandlerContext ctx, ChannelEvent e); + boolean continues(ChannelHandlerContext ctx, ChannelEvent e); } diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRule.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRule.java index cae6b16270..cf7328801c 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRule.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRule.java @@ -27,11 +27,11 @@ public interface IpFilterRule extends IpSet * * @return True if this Rule is an ALLOW rule */ - public boolean isAllowRule(); + boolean isAllowRule(); /** * * @return True if this Rule is a DENY rule */ - public boolean isDenyRule(); + boolean isDenyRule(); } diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandler.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandler.java index decf74ba58..befa2816fe 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandler.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandler.java @@ -32,10 +32,10 @@ public interface IpFilteringHandler * * @param listener the new ip filter listener */ - public void setIpFilterListener(IpFilterListener listener); + void setIpFilterListener(IpFilterListener listener); /** * Remove the filter listener. */ - public void removeIpFilterListener(); + void removeIpFilterListener(); } diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpSet.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpSet.java index a349b3f4f1..3e4898b62d 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpSet.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpSet.java @@ -32,5 +32,5 @@ public interface IpSet * @return returns true if the given IP address is contained in the current * IpSet. */ - public boolean contains(InetAddress inetAddress1); + boolean contains(InetAddress inetAddress1); } From 1f3d35bd348511ddf0d7014f883afa38312eae65 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Sun, 6 Nov 2011 20:35:23 +0100 Subject: [PATCH 16/93] release replaying decoder cumulation buffer after firing upstream --- .../jboss/netty/handler/codec/replay/ReplayingDecoder.java | 6 ++++++ .../netty/handler/codec/replay/ReplayingDecoderBuffer.java | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java index 5103ded6dc..9b85c8b985 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java @@ -504,6 +504,11 @@ public abstract class ReplayingDecoder> // A successful decode unfoldAndFireMessageReceived(context, result, remoteAddress); + + if (!cumulation.readable()) { + this.cumulation.set(null); + replayable = ReplayingDecoderBuffer.EMPTY_BUFFER; + } } } @@ -551,6 +556,7 @@ public abstract class ReplayingDecoder> } catch (ReplayError replay) { // Ignore } finally { + replayable = ReplayingDecoderBuffer.EMPTY_BUFFER; ctx.sendUpstream(e); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java index 2cae1b55b2..8f801f9b04 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java @@ -27,6 +27,7 @@ import java.nio.charset.Charset; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBufferFactory; import org.jboss.netty.buffer.ChannelBufferIndexFinder; +import org.jboss.netty.buffer.ChannelBuffers; /** * @author The Netty Project @@ -42,6 +43,12 @@ class ReplayingDecoderBuffer implements ChannelBuffer { private final ChannelBuffer buffer; private boolean terminated; + public static ReplayingDecoderBuffer EMPTY_BUFFER = new ReplayingDecoderBuffer(ChannelBuffers.EMPTY_BUFFER); + + static { + EMPTY_BUFFER.terminate(); + } + ReplayingDecoderBuffer(ChannelBuffer buffer) { this.buffer = buffer; } From 9aa81cd08385702fd684e7bb1cc447617ff51247 Mon Sep 17 00:00:00 2001 From: Sunng Date: Mon, 7 Nov 2011 13:35:37 +0800 Subject: [PATCH 17/93] fix typo --- .../netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java index 2733109f29..671a0f4baf 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java @@ -239,7 +239,7 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip) { - this(maxFrameLength, lengthFieldOffset, lengthFieldOffset, lengthAdjustment, + this(maxFrameLength, lengthFieldOffset, lengthFieldLength, lengthAdjustment, initialBytesToStrip, false); } From 507b9d0b701b6e3c4b6ff7a27c51e0f20a8670cf Mon Sep 17 00:00:00 2001 From: Cruz Bishop Date: Mon, 7 Nov 2011 21:07:54 +1000 Subject: [PATCH 18/93] Boolean operations in channel buffers Adds getBoolean(index), readBoolean(), writeBoolean(value), setBoolean(index, value) Fixes https://issues.jboss.org/browse/NETTY-344 --- .../netty/buffer/AbstractChannelBuffer.java | 22 +++++++- .../org/jboss/netty/buffer/ChannelBuffer.java | 53 ++++++++++++++++--- .../codec/replay/ReplayingDecoderBuffer.java | 22 ++++++++ 3 files changed, 90 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java index f0d70fe919..7e213513be 100644 --- a/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java @@ -137,6 +137,11 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer { throw new IndexOutOfBoundsException(); } } + + @Override + public boolean getBoolean(int index) { + return (getByte(index) == 1); + } @Override public short getUnsignedByte(int index) { @@ -195,6 +200,11 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer { getBytes(index, dst, dst.writerIndex(), length); dst.writerIndex(dst.writerIndex() + length); } + + @Override + public void setBoolean(int index, boolean value) { + setByte(index, value ? 1 : 0); + } @Override public void setChar(int index, int value) { @@ -262,7 +272,7 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer { } } } - + @Override public byte readByte() { if (readerIndex == writerIndex) { @@ -270,6 +280,11 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer { } return getByte(readerIndex ++); } + + @Override + public boolean readBoolean() { + return (readByte() == 1); + } @Override public short readUnsignedByte() { @@ -426,6 +441,11 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer { } readerIndex = newReaderIndex; } + + @Override + public void writeBoolean(boolean value) { + writeByte(value ? 1 : 0); + } @Override public void writeByte(int value) { diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java index 07c3e68936..9482bad8ff 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java @@ -448,6 +448,17 @@ public interface ChannelBuffer extends Comparable { * not a dynamic buffer */ void ensureWritableBytes(int writableBytes); + + /** + * Gets a boolean at the specified absolute (@code index) in this buffer. + * This method does not modify the {@code readerIndex} or {@code writerIndex} + * of this buffer. + * + * @throws IndexOutOfBoundsException + * if the specified {@code index} is less than {@code 0} or + * {@code index + 1} is greater than {@code this.capacity} + */ + boolean getBoolean(int index); /** * Gets a byte at the specified absolute {@code index} in this buffer. @@ -668,7 +679,7 @@ public interface ChannelBuffer extends Comparable { * if {@code dstIndex + length} is greater than * {@code dst.length} */ - void getBytes(int index, byte[] dst, int dstIndex, int length); + void getBytes(int index, byte[] dst, int dstIndex, int length); /** * Transfers this buffer's data to the specified destination starting at @@ -682,7 +693,7 @@ public interface ChannelBuffer extends Comparable { * if {@code index + dst.remaining()} is greater than * {@code this.capacity} */ - void getBytes(int index, ByteBuffer dst); + void getBytes(int index, ByteBuffer dst); /** * Transfers this buffer's data to the specified stream starting at the @@ -699,7 +710,7 @@ public interface ChannelBuffer extends Comparable { * @throws IOException * if the specified stream threw an exception during I/O */ - void getBytes(int index, OutputStream out, int length) throws IOException; + void getBytes(int index, OutputStream out, int length) throws IOException; /** * Transfers this buffer's data to the specified channel starting at the @@ -718,8 +729,20 @@ public interface ChannelBuffer extends Comparable { * @throws IOException * if the specified channel threw an exception during I/O */ - int getBytes(int index, GatheringByteChannel out, int length) throws IOException; + int getBytes(int index, GatheringByteChannel out, int length) throws IOException; + /** + * Sets the specified boolean at the specified absolute {@code index} in this + * buffer. + * This method does not modify {@code readerIndex} or {@code writerIndex} of + * this buffer. + * + * @throws IndexOutOfBoundsException + * if the specified {@code index} is less than {@code 0} or + * {@code index + 1} is greater than {@code this.capacity} + */ + void setBoolean(int index, boolean value); + /** * Sets the specified byte at the specified absolute {@code index} in this * buffer. The 24 high-order bits of the specified value are ignored. @@ -730,7 +753,7 @@ public interface ChannelBuffer extends Comparable { * if the specified {@code index} is less than {@code 0} or * {@code index + 1} is greater than {@code this.capacity} */ - void setByte(int index, int value); + void setByte(int index, int value); /** * Sets the specified 16-bit short integer at the specified absolute @@ -969,6 +992,15 @@ public interface ChannelBuffer extends Comparable { * if {@code index + length} is greater than {@code this.capacity} */ void setZero(int index, int length); + + /** + * Gets a boolean at the current {@code readerIndex} and increases + * the {@code readerIndex} by {@code 1} in this buffer. + * + * @throws IndexOutOfBoundsException + * if {@code this.readableBytes} is less than {@code 1} + */ + boolean readBoolean(); /** * Gets a byte at the current {@code readerIndex} and increases @@ -1229,6 +1261,15 @@ public interface ChannelBuffer extends Comparable { */ void skipBytes(int length); + /** + * Sets the specified boolean at the current {@code writerIndex} + * and increases the {@code writerIndex} by {@code 1} in this buffer. + * + * @throws IndexOutOfBoundsException + * if {@code this.writableBytes} is less than {@code 1} + */ + void writeBoolean(boolean value); + /** * Sets the specified byte at the current {@code writerIndex} * and increases the {@code writerIndex} by {@code 1} in this buffer. @@ -1237,7 +1278,7 @@ public interface ChannelBuffer extends Comparable { * @throws IndexOutOfBoundsException * if {@code this.writableBytes} is less than {@code 1} */ - void writeByte(int value); + void writeByte(int value); /** * Sets the specified 16-bit short integer at the current diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java index 8f801f9b04..dfe00bf5f2 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java @@ -126,6 +126,12 @@ class ReplayingDecoderBuffer implements ChannelBuffer { public ChannelBuffer duplicate() { throw new UnreplayableOperationException(); } + + @Override + public boolean getBoolean(int index) { + checkIndex(index); + return buffer.getBoolean(index); + } @Override public byte getByte(int index) { @@ -358,6 +364,12 @@ class ReplayingDecoderBuffer implements ChannelBuffer { return Integer.MAX_VALUE - buffer.readerIndex(); } } + + @Override + public boolean readBoolean() { + checkReadableBytes(1); + return buffer.readBoolean(); + } @Override public byte readByte() { @@ -506,6 +518,11 @@ class ReplayingDecoderBuffer implements ChannelBuffer { public void resetWriterIndex() { throw new UnreplayableOperationException(); } + + @Override + public void setBoolean(int index, boolean value) { + throw new UnreplayableOperationException(); + } @Override public void setByte(int index, int value) { @@ -669,6 +686,11 @@ class ReplayingDecoderBuffer implements ChannelBuffer { public int writableBytes() { return 0; } + + @Override + public void writeBoolean(boolean value) { + throw new UnreplayableOperationException(); + } @Override public void writeByte(int value) { From dab76e266c935635b8ac22e017edd87b55b8ed59 Mon Sep 17 00:00:00 2001 From: Cruz Bishop Date: Mon, 7 Nov 2011 21:13:45 +1000 Subject: [PATCH 19/93] Added tests --- .../jboss/netty/buffer/AbstractChannelBufferTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java index f9e39542da..55823907be 100644 --- a/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java @@ -144,6 +144,16 @@ public abstract class AbstractChannelBufferTest { buffer.readerIndex(0); buffer.writerIndex(CAPACITY); } + + @Test(expected=IndexOutOfBoundsException.class) + public void getBooleanBoundaryCheck1() { + buffer.getBoolean(-1); + } + + @Test(expected=IndexOutOfBoundsException.class) + public void getBooleanBoundaryCheck2() { + buffer.getBoolean(buffer.capacity()); + } @Test(expected=IndexOutOfBoundsException.class) public void getByteBoundaryCheck1() { From fae46dabf19c13fc784776dd4f1f95cee5d2c87b Mon Sep 17 00:00:00 2001 From: Jeff Pinner Date: Mon, 7 Nov 2011 12:03:34 -0800 Subject: [PATCH 20/93] ignore HttpOnly as a cookie name instead of throwing exception --- .../org/jboss/netty/handler/codec/http/CookieDecoder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java index 98b5b09fe1..e1e5e01bbd 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java @@ -95,6 +95,11 @@ public class CookieDecoder { Set cookies = new TreeSet(); for (; i < names.size(); i ++) { String name = names.get(i); + // Not all user agents understand the HttpOnly attribute -- be lenient + if (CookieHeaderNames.HTTPONLY.equalsIgnoreCase(name)) { + continue; + } + String value = values.get(i); if (value == null) { value = ""; From 152ea47d48a77beeb9bdc6a8595509af6707bf96 Mon Sep 17 00:00:00 2001 From: Jeff Pinner Date: Tue, 8 Nov 2011 12:03:23 -0800 Subject: [PATCH 21/93] make cookie decoder behavior configurable via a constructor argument --- .../handler/codec/http/CookieDecoder.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java index e1e5e01bbd..0a090313bd 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java @@ -50,11 +50,22 @@ public class CookieDecoder { private final static String COMMA = ","; + private boolean lenient; + /** - * Creates a new decoder. + * Creates a new decoder with strict parsing. */ public CookieDecoder() { - super(); + this(false); + } + + /** + * Creates a new decoder. + * + * @param lenient ignores cookies with the name 'HTTPOnly' instead of throwing an exception + */ + public CookieDecoder(boolean lenient) { + this.lenient = lenient; } /** @@ -95,8 +106,8 @@ public class CookieDecoder { Set cookies = new TreeSet(); for (; i < names.size(); i ++) { String name = names.get(i); - // Not all user agents understand the HttpOnly attribute -- be lenient - if (CookieHeaderNames.HTTPONLY.equalsIgnoreCase(name)) { + // Not all user agents understand the HttpOnly attribute + if (lenient && CookieHeaderNames.HTTPONLY.equalsIgnoreCase(name)) { continue; } From 5e925677c469507f1c94be32d659dc0d823b571e Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 9 Nov 2011 14:03:44 +0100 Subject: [PATCH 22/93] Declare field final --- .../java/org/jboss/netty/handler/codec/http/CookieDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java index 0a090313bd..3397b28e6a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java @@ -50,7 +50,7 @@ public class CookieDecoder { private final static String COMMA = ","; - private boolean lenient; + private final boolean lenient; /** * Creates a new decoder with strict parsing. From b38cb5c081d2c2c28c5ba23bc8c27d5507b1d39f Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sun, 6 Nov 2011 20:59:28 -0500 Subject: [PATCH 23/93] Fix problems in Javadoc references. --- .../websocketx/WebSocketServerHandshakerFactory.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java index e05b1801db..19c2e8d040 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java @@ -60,16 +60,6 @@ public class WebSocketServerHandshakerFactory { /** * Instances a new handshaker * - * @param webSocketURL - * URL for web socket communications. e.g - * "ws://myhost.com/mypath". Subsequent web socket frames will be - * sent to this URL. - * @param version - * Version of web socket specification to use to connect to the - * server - * @param subProtocol - * Sub protocol request sent to the server. Null if no - * sub-protocol support is required. * @return A new WebSocketServerHandshaker for the requested web socket * version. Null if web socket version is not supported. */ From 13eb416b0645211e1ad3727f599db56cd5208afc Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sun, 6 Nov 2011 21:13:55 -0500 Subject: [PATCH 24/93] Remove redundant 'final' modifier from private methods. --- .../channel/socket/nio/SocketReceiveBufferPool.java | 2 +- .../netty/channel/socket/nio/SocketSendBufferPool.java | 10 +++++----- .../org/jboss/netty/handler/codec/base64/Base64.java | 6 +++--- .../org/jboss/netty/util/internal/jzlib/Deflate.java | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java index 5bc7d98608..c6732f70aa 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java @@ -90,7 +90,7 @@ final class SocketReceiveBufferPool { } } - private static final int normalizeCapacity(int capacity) { + private static int normalizeCapacity(int capacity) { // Normalize to multiple of 1024 int q = capacity >>> 10; int r = capacity & 1023; diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java index 36606ce784..ac1d4e742c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java @@ -56,14 +56,14 @@ final class SocketSendBufferPool { "unsupported message type: " + message.getClass()); } - private final SendBuffer acquire(FileRegion src) { + private SendBuffer acquire(FileRegion src) { if (src.getCount() == 0) { return EMPTY_BUFFER; } return new FileSendBuffer(src); } - private final SendBuffer acquire(ChannelBuffer src) { + private SendBuffer acquire(ChannelBuffer src) { final int size = src.readableBytes(); if (size == 0) { return EMPTY_BUFFER; @@ -109,7 +109,7 @@ final class SocketSendBufferPool { return dst; } - private final Preallocation getPreallocation() { + private Preallocation getPreallocation() { Preallocation current = this.current; if (current.refCnt == 0) { current.buffer.clear(); @@ -119,7 +119,7 @@ final class SocketSendBufferPool { return getPreallocation0(); } - private final Preallocation getPreallocation0() { + private Preallocation getPreallocation0() { PreallocationRef ref = poolHead; if (ref != null) { do { @@ -138,7 +138,7 @@ final class SocketSendBufferPool { return new Preallocation(DEFAULT_PREALLOCATION_SIZE); } - private static final int align(int pos) { + private static int align(int pos) { int q = pos >>> ALIGN_SHIFT; int r = pos & ALIGN_MASK; if (r != 0) { diff --git a/src/main/java/org/jboss/netty/handler/codec/base64/Base64.java b/src/main/java/org/jboss/netty/handler/codec/base64/Base64.java index 89063cc518..05f6d691c6 100644 --- a/src/main/java/org/jboss/netty/handler/codec/base64/Base64.java +++ b/src/main/java/org/jboss/netty/handler/codec/base64/Base64.java @@ -53,21 +53,21 @@ public class Base64 { private static final byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding - private static final byte[] alphabet(Base64Dialect dialect) { + private static byte[] alphabet(Base64Dialect dialect) { if (dialect == null) { throw new NullPointerException("dialect"); } return dialect.alphabet; } - private static final byte[] decodabet(Base64Dialect dialect) { + private static byte[] decodabet(Base64Dialect dialect) { if (dialect == null) { throw new NullPointerException("dialect"); } return dialect.decodabet; } - private static final boolean breakLines(Base64Dialect dialect) { + private static boolean breakLines(Base64Dialect dialect) { if (dialect == null) { throw new NullPointerException("dialect"); } diff --git a/src/main/java/org/jboss/netty/util/internal/jzlib/Deflate.java b/src/main/java/org/jboss/netty/util/internal/jzlib/Deflate.java index ac7c3336f8..62eedc8a50 100644 --- a/src/main/java/org/jboss/netty/util/internal/jzlib/Deflate.java +++ b/src/main/java/org/jboss/netty/util/internal/jzlib/Deflate.java @@ -494,26 +494,26 @@ final class Deflate { // Output a byte on the stream. // IN assertion: there is enough room in pending_buf. - private final void put_byte(byte[] p, int start, int len) { + private void put_byte(byte[] p, int start, int len) { System.arraycopy(p, start, pending_buf, pending, len); pending += len; } - private final void put_byte(byte c) { + private void put_byte(byte c) { pending_buf[pending ++] = c; } - private final void put_short(int w) { + private void put_short(int w) { put_byte((byte) w/*&0xff*/); put_byte((byte) (w >>> 8)); } - private final void putShortMSB(int b) { + private void putShortMSB(int b) { put_byte((byte) (b >> 8)); put_byte((byte) b/*&0xff*/); } - private final void send_code(int c, short[] tree) { + private void send_code(int c, short[] tree) { int c2 = c * 2; send_bits((tree[c2] & 0xffff), (tree[c2 + 1] & 0xffff)); } From 8d6d2f038ec6d936b935357a7d65a6e2697d4095 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Mon, 7 Nov 2011 22:18:48 -0500 Subject: [PATCH 25/93] Remove redundant no-arg constructors. --- .../java/org/jboss/netty/channel/DefaultChannelConfig.java | 7 ------- .../org/jboss/netty/channel/DefaultChannelPipeline.java | 7 ------- .../jboss/netty/channel/DefaultServerChannelConfig.java | 7 ------- .../channel/local/DefaultLocalServerChannelFactory.java | 7 ------- .../netty/channel/socket/nio/SocketReceiveBufferPool.java | 4 ---- .../handler/codec/embedder/EmbeddedSocketAddress.java | 4 ---- .../netty/handler/codec/http/HttpPostRequestDecoder.java | 6 ------ .../netty/handler/codec/protobuf/ProtobufEncoder.java | 7 ------- .../org/jboss/netty/handler/codec/replay/ReplayError.java | 3 --- .../jboss/netty/handler/stream/ChunkedWriteHandler.java | 7 ------- .../handler/timeout/IdleStateAwareChannelHandler.java | 7 ------- .../timeout/IdleStateAwareChannelUpstreamHandler.java | 7 ------- .../jboss/netty/util/internal/AtomicFieldUpdaterUtil.java | 3 --- .../java/org/jboss/netty/util/internal/jzlib/InfCodes.java | 4 ---- 14 files changed, 80 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelConfig.java b/src/main/java/org/jboss/netty/channel/DefaultChannelConfig.java index 3ec8079908..266d052644 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelConfig.java @@ -37,13 +37,6 @@ public class DefaultChannelConfig implements ChannelConfig { private volatile ChannelBufferFactory bufferFactory = HeapChannelBufferFactory.getInstance(); private volatile int connectTimeoutMillis = 10000; // 10 seconds - /** - * Creates a new instance. - */ - public DefaultChannelConfig() { - super(); - } - @Override public void setOptions(Map options) { for (Entry e: options.entrySet()) { diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java index 5da1b888f4..bc6d391ea5 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java @@ -48,13 +48,6 @@ public class DefaultChannelPipeline implements ChannelPipeline { private final Map name2ctx = new HashMap(4); - /** - * Creates a new empty pipeline. - */ - public DefaultChannelPipeline() { - super(); - } - @Override public Channel getChannel() { return channel; diff --git a/src/main/java/org/jboss/netty/channel/DefaultServerChannelConfig.java b/src/main/java/org/jboss/netty/channel/DefaultServerChannelConfig.java index ed1fe78a40..21478afbe1 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultServerChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/DefaultServerChannelConfig.java @@ -35,13 +35,6 @@ public class DefaultServerChannelConfig implements ChannelConfig { private volatile ChannelPipelineFactory pipelineFactory; private volatile ChannelBufferFactory bufferFactory = HeapChannelBufferFactory.getInstance(); - /** - * Creates a new instance. - */ - public DefaultServerChannelConfig() { - super(); - } - @Override public void setOptions(Map options) { for (Entry e: options.entrySet()) { diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java index 496ba29f81..34f465c272 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java @@ -32,13 +32,6 @@ public class DefaultLocalServerChannelFactory implements LocalServerChannelFacto private final ChannelSink sink = new LocalServerChannelSink(); - /** - * Creates a new instance. - */ - public DefaultLocalServerChannelFactory() { - super(); - } - @Override public LocalServerChannel newChannel(ChannelPipeline pipeline) { return DefaultLocalServerChannel.create(this, pipeline, sink); diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java index c6732f70aa..321f4cc69f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java @@ -30,10 +30,6 @@ final class SocketReceiveBufferPool { @SuppressWarnings("unchecked") private final SoftReference[] pool = new SoftReference[POOL_SIZE]; - SocketReceiveBufferPool() { - super(); - } - final ByteBuffer acquire(int size) { final SoftReference[] pool = this.pool; for (int i = 0; i < POOL_SIZE; i ++) { diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedSocketAddress.java b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedSocketAddress.java index 808a9a0437..e8a949b508 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedSocketAddress.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedSocketAddress.java @@ -24,8 +24,4 @@ import java.net.SocketAddress; */ class EmbeddedSocketAddress extends SocketAddress { private static final long serialVersionUID = 1400788804624980619L; - - EmbeddedSocketAddress() { - super(); - } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java index 5c4f1f2a4a..3a59251941 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java @@ -1435,12 +1435,6 @@ public class HttpPostRequestDecoder { */ private static final long serialVersionUID = 1336267941020800769L; - /** - * - */ - public EndOfDataDecoderException() { - super(); - } } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java index 011d3cdcc4..8b7ec49287 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java @@ -68,13 +68,6 @@ import com.google.protobuf.MessageLite; @Sharable public class ProtobufEncoder extends OneToOneEncoder { - /** - * Creates a new instance. - */ - public ProtobufEncoder() { - super(); - } - @Override protected Object encode( ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayError.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayError.java index 1b9ca51560..f902d37073 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayError.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayError.java @@ -27,7 +27,4 @@ class ReplayError extends Error { private static final long serialVersionUID = 2666698631187527681L; - ReplayError() { - super(); - } } diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java index 7ba9e35663..cb9edd0a4a 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java @@ -86,13 +86,6 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns private ChannelHandlerContext ctx; private MessageEvent currentEvent; - /** - * Creates a new instance. - */ - public ChunkedWriteHandler() { - super(); - } - /** * Continues to fetch the chunks from the input. */ diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelHandler.java b/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelHandler.java index 98b01dc287..fe61cfd0ef 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelHandler.java @@ -32,13 +32,6 @@ import org.jboss.netty.channel.SimpleChannelHandler; */ public class IdleStateAwareChannelHandler extends SimpleChannelHandler { - /** - * Creates a new instance. - */ - public IdleStateAwareChannelHandler() { - super(); - } - @Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelUpstreamHandler.java b/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelUpstreamHandler.java index e732ef94ca..e66a3bf0f5 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelUpstreamHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelUpstreamHandler.java @@ -32,13 +32,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; */ public class IdleStateAwareChannelUpstreamHandler extends SimpleChannelUpstreamHandler { - /** - * Creates a new instance. - */ - public IdleStateAwareChannelUpstreamHandler() { - super(); - } - @Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { diff --git a/src/main/java/org/jboss/netty/util/internal/AtomicFieldUpdaterUtil.java b/src/main/java/org/jboss/netty/util/internal/AtomicFieldUpdaterUtil.java index 96e05b29e9..dc57f99cbb 100644 --- a/src/main/java/org/jboss/netty/util/internal/AtomicFieldUpdaterUtil.java +++ b/src/main/java/org/jboss/netty/util/internal/AtomicFieldUpdaterUtil.java @@ -29,9 +29,6 @@ class AtomicFieldUpdaterUtil { static final class Node { volatile Node next; - Node() { - super(); - } } static { diff --git a/src/main/java/org/jboss/netty/util/internal/jzlib/InfCodes.java b/src/main/java/org/jboss/netty/util/internal/jzlib/InfCodes.java index f382e627f6..ef19c5c166 100644 --- a/src/main/java/org/jboss/netty/util/internal/jzlib/InfCodes.java +++ b/src/main/java/org/jboss/netty/util/internal/jzlib/InfCodes.java @@ -85,10 +85,6 @@ final class InfCodes { private int[] dtree; // distance tree private int dtree_index; // distance tree - InfCodes() { - super(); - } - void init(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index) { mode = START; lbits = (byte) bl; From 1fdab7bb956dab560dcc07a1f6ac3ffa4f41c13c Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Wed, 9 Nov 2011 08:33:45 -0500 Subject: [PATCH 26/93] Make fields final where possible. --- .../jboss/netty/channel/iostream/IOStreamChannelSink.java | 2 +- .../org/jboss/netty/channel/rxtx/RXTXChannelConfig.java | 6 +++--- .../netty/channel/socket/http/SaturationManager.java | 4 ++-- .../org/jboss/netty/example/http/upload/HttpClient.java | 4 ++-- .../http/websocketx/client/WebSocketClientFactory.java | 2 +- .../http/websocketx/client/WebSocketClientHandler.java | 8 ++++---- .../jboss/netty/example/localtime/LocalTimeProtocol.java | 4 ++-- .../netty/handler/codec/http/DefaultHttpDataFactory.java | 2 +- .../http/websocketx/WebSocketClientHandshaker10.java | 2 +- .../http/websocketx/WebSocketServerHandshakerFactory.java | 4 ++-- .../netty/channel/socket/http/HttpTunnelSoakTester.java | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannelSink.java b/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannelSink.java index f14804d5bc..a7599f9455 100755 --- a/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/iostream/IOStreamChannelSink.java @@ -115,7 +115,7 @@ public class IOStreamChannelSink extends AbstractChannelSink { private PushbackInputStream inputStream; - private ChannelConfig config = new DefaultChannelConfig(); + private final ChannelConfig config = new DefaultChannelConfig(); @Override public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e) throws Exception { diff --git a/src/main/java/org/jboss/netty/channel/rxtx/RXTXChannelConfig.java b/src/main/java/org/jboss/netty/channel/rxtx/RXTXChannelConfig.java index d8bcadc200..6efe0c5e8f 100644 --- a/src/main/java/org/jboss/netty/channel/rxtx/RXTXChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/rxtx/RXTXChannelConfig.java @@ -34,7 +34,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig { STOPBITS_2(SerialPort.STOPBITS_2), STOPBITS_1_5(SerialPort.STOPBITS_1_5); - private int value; + private final int value; private Stopbits(int value) { this.value = value; @@ -61,7 +61,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig { DATABITS_7(SerialPort.DATABITS_7), DATABITS_8(SerialPort.DATABITS_8); - private int value; + private final int value; private Databits(int value) { this.value = value; @@ -89,7 +89,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig { MARK(SerialPort.PARITY_MARK), SPACE(SerialPort.PARITY_SPACE); - private int value; + private final int value; private Paritybit(int value) { this.value = value; diff --git a/src/main/java/org/jboss/netty/channel/socket/http/SaturationManager.java b/src/main/java/org/jboss/netty/channel/socket/http/SaturationManager.java index a9be1df55c..95b10e9cab 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/SaturationManager.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/SaturationManager.java @@ -32,9 +32,9 @@ import java.util.concurrent.atomic.AtomicLong; * @author OneDrum Ltd. */ class SaturationManager { - private AtomicLong desaturationPoint; + private final AtomicLong desaturationPoint; - private AtomicLong saturationPoint; + private final AtomicLong saturationPoint; private final AtomicLong queueSize; diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpClient.java b/src/main/java/org/jboss/netty/example/http/upload/HttpClient.java index d83d6fb26e..2a5b248cd9 100644 --- a/src/main/java/org/jboss/netty/example/http/upload/HttpClient.java +++ b/src/main/java/org/jboss/netty/example/http/upload/HttpClient.java @@ -404,7 +404,7 @@ public class HttpClient { // use to simulate a big TEXTAREA field in a form - private static String textArea = + private static final String textArea = "lkjlkjlKJLKJLKJLKJLJlkj lklkj\r\n\r\nLKJJJJJJJJKKKKKKKKKKKKKKK ����&\r\n\r\n"+ "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+ "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+ @@ -992,4 +992,4 @@ public class HttpClient { "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+ "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"; -} \ No newline at end of file +} diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientFactory.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientFactory.java index 4ef12bc07a..745c6eddcb 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientFactory.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientFactory.java @@ -44,7 +44,7 @@ import java.util.concurrent.Executors; */ public class WebSocketClientFactory { - private NioClientSocketChannelFactory socketChannelFactory = new NioClientSocketChannelFactory( + private final NioClientSocketChannelFactory socketChannelFactory = new NioClientSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool()); /** diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientHandler.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientHandler.java index 07b5615cd5..28aff75bb8 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientHandler.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientHandler.java @@ -51,12 +51,12 @@ import org.jboss.netty.util.CharsetUtil; */ public class WebSocketClientHandler extends SimpleChannelUpstreamHandler implements WebSocketClient { - private ClientBootstrap bootstrap; + private final ClientBootstrap bootstrap; private URI url; - private WebSocketCallback callback; + private final WebSocketCallback callback; private Channel channel; private WebSocketClientHandshaker handshaker = null; - private WebSocketSpecificationVersion version; + private final WebSocketSpecificationVersion version; public WebSocketClientHandler(ClientBootstrap bootstrap, URI url, WebSocketSpecificationVersion version, WebSocketCallback callback) { this.bootstrap = bootstrap; @@ -121,4 +121,4 @@ public class WebSocketClientHandler extends SimpleChannelUpstreamHandler impleme public void setUrl(URI url) { this.url = url; } -} \ No newline at end of file +} diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java index 6acc3f3f75..03af00127c 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java @@ -48,7 +48,7 @@ public final class LocalTimeProtocol { internalGetValueMap() { return internalValueMap; } - private static com.google.protobuf.Internal.EnumLiteMap + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { public Continent findValueByNumber(int number) { @@ -125,7 +125,7 @@ public final class LocalTimeProtocol { internalGetValueMap() { return internalValueMap; } - private static com.google.protobuf.Internal.EnumLiteMap + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { public DayOfWeek findValueByNumber(int number) { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpDataFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpDataFactory.java index 8c123c62ed..b98e235cd3 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpDataFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpDataFactory.java @@ -50,7 +50,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory { /** * Keep all HttpDatas until cleanAllHttpDatas() is called. */ - private ConcurrentHashMap> requestFileDeleteMap = + private final ConcurrentHashMap> requestFileDeleteMap = new ConcurrentHashMap>(); /** * HttpData will be in memory if less than default size (16KB). diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java index 0049ad4646..ba579491cb 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java @@ -49,7 +49,7 @@ public class WebSocketClientHandshaker10 extends WebSocketClientHandshaker { private String expectedChallengeResponseString = null; - private String protocol = null; + private final String protocol = null; private boolean allowExtensions = false; diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java index 19c2e8d040..74ec495f5e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java @@ -30,9 +30,9 @@ import org.jboss.netty.handler.codec.http.HttpHeaders.Names; */ public class WebSocketServerHandshakerFactory { - private String webSocketURL; + private final String webSocketURL; - private String subProtocols; + private final String subProtocols; private boolean allowExtensions = false; diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java index ed1d5bc641..70c56338da 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java @@ -85,7 +85,7 @@ public class HttpTunnelSoakTester { final DataVerifier s2cVerifier = new DataVerifier("S2C-Verifier"); - private static byte[] SEND_STREAM; + private static final byte[] SEND_STREAM; static { SEND_STREAM = new byte[MAX_WRITE_SIZE + 127]; From 3856f99c03fe75e3e574d70058e4f427d007f428 Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 10 Nov 2011 09:15:16 +0100 Subject: [PATCH 27/93] Make failImmediatelyOnTooLongFrame configurable via a constructor --- .../frame/DelimiterBasedFrameDecoder.java | 32 ++++++++++++------- .../frame/DelimiterBasedFrameDecoderTest.java | 3 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java index 6f4dd99963..3c81fb33fe 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java @@ -69,7 +69,7 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { private final boolean stripDelimiter; private boolean discardingTooLongFrame; private int tooLongFrameLength; - private boolean failImmediatelyOnTooLongFrame = false; + private final boolean failImmediatelyOnTooLongFrame; /** * Creates a new instance. @@ -103,6 +103,7 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { }; this.maxFrameLength = maxFrameLength; this.stripDelimiter = stripDelimiter; + this.failImmediatelyOnTooLongFrame = false; } /** @@ -117,6 +118,14 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { this(maxFrameLength, true, delimiters); } + /** + * Calls {@link #DelimiterBasedFrameDecoder(int, boolean, boolean, ChannelBuffer...)} with failImmediatelyOnTooLongFrame set to false + */ + public DelimiterBasedFrameDecoder( + int maxFrameLength, boolean stripDelimiter, ChannelBuffer... delimiters) { + this(maxFrameLength, stripDelimiter, false, delimiters); + } + /** * Creates a new instance. * @@ -125,10 +134,16 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { * the length of the frame exceeds this value. * @param stripDelimiter whether the decoded frame should strip out the * delimiter or not + * @param failImmediatelyOnTooLongFrame If false (the default) a {@link TooLongFrameException} + * is thrown if the length of the frame exceeds maxFrameLength, + * after the delimiter has been read. + * If true a {@link TooLongFrameException} is thrown immediately + * when the length of the frame exceeds maxFrameLength, + * regardless of whether a delimiter has been found yet. * @param delimiters the delimiters */ public DelimiterBasedFrameDecoder( - int maxFrameLength, boolean stripDelimiter, ChannelBuffer... delimiters) { + int maxFrameLength, boolean stripDelimiter, boolean failImmediatelyOnTooLongFrame, ChannelBuffer... delimiters) { validateMaxFrameLength(maxFrameLength); if (delimiters == null) { throw new NullPointerException("delimiters"); @@ -144,8 +159,9 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { } this.maxFrameLength = maxFrameLength; this.stripDelimiter = stripDelimiter; + this.failImmediatelyOnTooLongFrame = failImmediatelyOnTooLongFrame; } - + @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { @@ -216,17 +232,11 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { /** * Set the behavior when a frame longer than maxFrameLength is encountered. * - * @param failImmediatelyOnTooLongFrame If false (the default) a {@link TooLongFrameException} - * is thrown if the length of the frame exceeds maxFrameLength, - * after the delimiter has been read. - * If true a {@link TooLongFrameException} is thrown immediately - * when the length of the frame exceeds maxFrameLength, - * regardless of whether a delimiter has been found yet. + * */ public DelimiterBasedFrameDecoder setFailImmediatelyOnTooLongFrame( - boolean failImmediatelyOnTooLongFrame) + ) { - this.failImmediatelyOnTooLongFrame = failImmediatelyOnTooLongFrame; return this; } diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java index 6d67acb0e4..13c6506867 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java @@ -50,8 +50,7 @@ public class DelimiterBasedFrameDecoderTest { @Test public void testFailImmediatelyTooLongFrameRecovery() throws Exception { DecoderEmbedder embedder = new DecoderEmbedder( - new DelimiterBasedFrameDecoder(1, Delimiters.nulDelimiter()). - setFailImmediatelyOnTooLongFrame(true)); + new DelimiterBasedFrameDecoder(1, true, true, Delimiters.nulDelimiter())); for (int i = 0; i < 2; i ++) { try { From d760b4cffe7ec818cc94009ecf2788ab01b0e7c2 Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 10 Nov 2011 09:16:34 +0100 Subject: [PATCH 28/93] Remove empty method which I forgot to remove before --- .../codec/frame/DelimiterBasedFrameDecoder.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java index 3c81fb33fe..c7ea5d3a8c 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java @@ -229,17 +229,6 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { } } - /** - * Set the behavior when a frame longer than maxFrameLength is encountered. - * - * - */ - public DelimiterBasedFrameDecoder setFailImmediatelyOnTooLongFrame( - ) - { - return this; - } - private void fail(ChannelHandlerContext ctx, long frameLength) { if (frameLength > 0) { Channels.fireExceptionCaught( From 1a6f8369ea63beb44ed27f56dece954ddba1e4b5 Mon Sep 17 00:00:00 2001 From: norman Date: Fri, 11 Nov 2011 08:51:00 +0100 Subject: [PATCH 29/93] Revert changes of pull request #45 --- .../frame/LengthFieldBasedFrameDecoder.java | 36 +++---------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java index fcdfda92ae..99cb528837 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java @@ -195,7 +195,6 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { private final int lengthFieldEndOffset; private final int lengthAdjustment; private final int initialBytesToStrip; - private final boolean lengthFieldIncludedInFrameLength; private boolean discardingTooLongFrame; private long tooLongFrameLength; private long bytesToDiscard; @@ -217,9 +216,10 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { public LengthFieldBasedFrameDecoder( int maxFrameLength, int lengthFieldOffset, int lengthFieldLength) { - this(maxFrameLength, lengthFieldOffset, lengthFieldLength, 0, 0, false); + this(maxFrameLength, lengthFieldOffset, lengthFieldLength, 0, 0); } + /** * Creates a new instance. * @@ -240,32 +240,6 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip) { - this(maxFrameLength, lengthFieldOffset, lengthFieldLength, lengthAdjustment, - initialBytesToStrip, false); - } - - /** - * Creates a new instance. - * - * @param maxFrameLength - * the maximum length of the frame. If the length of the frame is - * greater than this value, {@link TooLongFrameException} will be - * thrown. - * @param lengthFieldOffset - * the offset of the length field - * @param lengthFieldLength - * the length of the length field - * @param lengthAdjustment - * the compensation value to add to the value of the length field - * @param initialBytesToStrip - * the number of first bytes to strip out from the decoded frame - * @param lengthFieldIncludedInFrameLength - * whether to count length field into frame length - */ - public LengthFieldBasedFrameDecoder( - int maxFrameLength, - int lengthFieldOffset, int lengthFieldLength, - int lengthAdjustment, int initialBytesToStrip, boolean lengthFieldIncludedInFrameLength) { if (maxFrameLength <= 0) { throw new IllegalArgumentException( "maxFrameLength must be a positive integer: " + @@ -306,7 +280,6 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { this.lengthAdjustment = lengthAdjustment; lengthFieldEndOffset = lengthFieldOffset + lengthFieldLength; this.initialBytesToStrip = initialBytesToStrip; - this.lengthFieldIncludedInFrameLength = lengthFieldIncludedInFrameLength; } @Override @@ -355,9 +328,8 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { "negative pre-adjustment length field: " + frameLength); } - if (!lengthFieldIncludedInFrameLength) { - frameLength += lengthAdjustment + lengthFieldEndOffset; - } + frameLength += lengthAdjustment + lengthFieldEndOffset; + if (frameLength < lengthFieldEndOffset) { buffer.skipBytes(lengthFieldEndOffset); throw new CorruptedFrameException( From f84a9e1c52d72df240975ab0a9832c14d69eb458 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Wed, 9 Nov 2011 20:41:11 -0500 Subject: [PATCH 30/93] Add missing @Override annotations. --- .../client/WebSocketClientFactory.java | 1 + .../client/WebSocketClientHandler.java | 3 + .../netty/example/iostream/IOStream.java | 1 + .../example/localtime/LocalTimeProtocol.java | 77 +++++++++++++++++++ .../codec/http/websocketx/UTF8Output.java | 1 + 5 files changed, 83 insertions(+) diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientFactory.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientFactory.java index 745c6eddcb..253d7dbe2f 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientFactory.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientFactory.java @@ -72,6 +72,7 @@ public class WebSocketClientFactory { bootstrap.setPipelineFactory(new ChannelPipelineFactory() { + @Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("decoder", new WebSocketHttpResponseDecoder()); diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientHandler.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientHandler.java index 28aff75bb8..58725d3ece 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientHandler.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/WebSocketClientHandler.java @@ -102,14 +102,17 @@ public class WebSocketClientHandler extends SimpleChannelUpstreamHandler impleme e.getChannel().close(); } + @Override public ChannelFuture connect() { return bootstrap.connect(new InetSocketAddress(url.getHost(), url.getPort())); } + @Override public ChannelFuture disconnect() { return channel.close(); } + @Override public ChannelFuture send(WebSocketFrame frame) { return channel.write(frame); } diff --git a/src/main/java/org/jboss/netty/example/iostream/IOStream.java b/src/main/java/org/jboss/netty/example/iostream/IOStream.java index 1abc192d2c..66690c0e6b 100755 --- a/src/main/java/org/jboss/netty/example/iostream/IOStream.java +++ b/src/main/java/org/jboss/netty/example/iostream/IOStream.java @@ -44,6 +44,7 @@ public class IOStream { // Configure the event pipeline factory. bootstrap.setPipelineFactory(new ChannelPipelineFactory() { + @Override public ChannelPipeline getPipeline() throws Exception { DefaultChannelPipeline pipeline = new DefaultChannelPipeline(); pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter())); diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java index 03af00127c..4668234d20 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java @@ -25,6 +25,7 @@ public final class LocalTimeProtocol { ; + @Override public final int getNumber() { return value; } public static Continent valueOf(int value) { @@ -51,15 +52,18 @@ public final class LocalTimeProtocol { private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { + @Override public Continent findValueByNumber(int number) { return Continent.valueOf(number) ; } }; + @Override public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); } + @Override public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); @@ -106,6 +110,7 @@ public final class LocalTimeProtocol { ; + @Override public final int getNumber() { return value; } public static DayOfWeek valueOf(int value) { @@ -128,15 +133,18 @@ public final class LocalTimeProtocol { private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { + @Override public DayOfWeek findValueByNumber(int number) { return DayOfWeek.valueOf(number) ; } }; + @Override public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); } + @Override public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); @@ -184,6 +192,7 @@ public final class LocalTimeProtocol { return defaultInstance; } + @Override public Location getDefaultInstanceForType() { return defaultInstance; } @@ -193,6 +202,7 @@ public final class LocalTimeProtocol { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Location_descriptor; } + @Override protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Location_fieldAccessorTable; @@ -215,6 +225,7 @@ public final class LocalTimeProtocol { private void initFields() { continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; } + @Override public final boolean isInitialized() { if (!hasContinent) { return false; @@ -225,6 +236,7 @@ public final class LocalTimeProtocol { return true; } + @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -238,6 +250,7 @@ public final class LocalTimeProtocol { } private int memoizedSerializedSize = -1; + @Override public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) { @@ -326,10 +339,12 @@ public final class LocalTimeProtocol { } public static Builder newBuilder() { return Builder.create(); } + @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.jboss.netty.example.localtime.LocalTimeProtocol.Location prototype) { return newBuilder().mergeFrom(prototype); } + @Override public Builder toBuilder() { return newBuilder(this); } public static final class Builder extends @@ -345,10 +360,12 @@ public final class LocalTimeProtocol { return builder; } + @Override protected org.jboss.netty.example.localtime.LocalTimeProtocol.Location internalGetResult() { return result; } + @Override public Builder clear() { if (result == null) { throw new IllegalStateException( @@ -358,22 +375,27 @@ public final class LocalTimeProtocol { return this; } + @Override public Builder clone() { return create().mergeFrom(result); } + @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.Location.getDescriptor(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.Location getDefaultInstanceForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.Location.getDefaultInstance(); } + @Override public boolean isInitialized() { return result.isInitialized(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.Location build() { if (result != null && !isInitialized()) { throw newUninitializedMessageException(result); @@ -390,6 +412,7 @@ public final class LocalTimeProtocol { return buildPartial(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.Location buildPartial() { if (result == null) { throw new IllegalStateException( @@ -400,6 +423,7 @@ public final class LocalTimeProtocol { return returnMe; } + @Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jboss.netty.example.localtime.LocalTimeProtocol.Location) { return mergeFrom((org.jboss.netty.example.localtime.LocalTimeProtocol.Location)other); @@ -423,6 +447,7 @@ public final class LocalTimeProtocol { return this; } + @Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -530,6 +555,7 @@ public final class LocalTimeProtocol { return defaultInstance; } + @Override public Locations getDefaultInstanceForType() { return defaultInstance; } @@ -539,6 +565,7 @@ public final class LocalTimeProtocol { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Locations_descriptor; } + @Override protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Locations_fieldAccessorTable; @@ -558,6 +585,7 @@ public final class LocalTimeProtocol { private void initFields() { } + @Override public final boolean isInitialized() { for (org.jboss.netty.example.localtime.LocalTimeProtocol.Location element : getLocationList()) { if (!element.isInitialized()) { @@ -567,6 +595,7 @@ public final class LocalTimeProtocol { return true; } + @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -577,6 +606,7 @@ public final class LocalTimeProtocol { } private int memoizedSerializedSize = -1; + @Override public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) { @@ -661,10 +691,12 @@ public final class LocalTimeProtocol { } public static Builder newBuilder() { return Builder.create(); } + @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.jboss.netty.example.localtime.LocalTimeProtocol.Locations prototype) { return newBuilder().mergeFrom(prototype); } + @Override public Builder toBuilder() { return newBuilder(this); } public static final class Builder extends @@ -680,10 +712,12 @@ public final class LocalTimeProtocol { return builder; } + @Override protected org.jboss.netty.example.localtime.LocalTimeProtocol.Locations internalGetResult() { return result; } + @Override public Builder clear() { if (result == null) { throw new IllegalStateException( @@ -693,22 +727,27 @@ public final class LocalTimeProtocol { return this; } + @Override public Builder clone() { return create().mergeFrom(result); } + @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.Locations.getDescriptor(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.Locations getDefaultInstanceForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.Locations.getDefaultInstance(); } + @Override public boolean isInitialized() { return result.isInitialized(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.Locations build() { if (result != null && !isInitialized()) { throw newUninitializedMessageException(result); @@ -725,6 +764,7 @@ public final class LocalTimeProtocol { return buildPartial(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.Locations buildPartial() { if (result == null) { throw new IllegalStateException( @@ -739,6 +779,7 @@ public final class LocalTimeProtocol { return returnMe; } + @Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jboss.netty.example.localtime.LocalTimeProtocol.Locations) { return mergeFrom((org.jboss.netty.example.localtime.LocalTimeProtocol.Locations)other); @@ -762,6 +803,7 @@ public final class LocalTimeProtocol { return this; } + @Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -870,6 +912,7 @@ public final class LocalTimeProtocol { return defaultInstance; } + @Override public LocalTime getDefaultInstanceForType() { return defaultInstance; } @@ -879,6 +922,7 @@ public final class LocalTimeProtocol { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTime_descriptor; } + @Override protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTime_fieldAccessorTable; @@ -936,6 +980,7 @@ public final class LocalTimeProtocol { private void initFields() { dayOfWeek_ = org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek.SUNDAY; } + @Override public final boolean isInitialized() { if (!hasYear) { return false; @@ -961,6 +1006,7 @@ public final class LocalTimeProtocol { return true; } + @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -989,6 +1035,7 @@ public final class LocalTimeProtocol { } private int memoizedSerializedSize = -1; + @Override public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) { @@ -1097,10 +1144,12 @@ public final class LocalTimeProtocol { } public static Builder newBuilder() { return Builder.create(); } + @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime prototype) { return newBuilder().mergeFrom(prototype); } + @Override public Builder toBuilder() { return newBuilder(this); } public static final class Builder extends @@ -1116,10 +1165,12 @@ public final class LocalTimeProtocol { return builder; } + @Override protected org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime internalGetResult() { return result; } + @Override public Builder clear() { if (result == null) { throw new IllegalStateException( @@ -1129,22 +1180,27 @@ public final class LocalTimeProtocol { return this; } + @Override public Builder clone() { return create().mergeFrom(result); } + @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.getDescriptor(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime getDefaultInstanceForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.getDefaultInstance(); } + @Override public boolean isInitialized() { return result.isInitialized(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime build() { if (result != null && !isInitialized()) { throw newUninitializedMessageException(result); @@ -1161,6 +1217,7 @@ public final class LocalTimeProtocol { return buildPartial(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime buildPartial() { if (result == null) { throw new IllegalStateException( @@ -1171,6 +1228,7 @@ public final class LocalTimeProtocol { return returnMe; } + @Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime) { return mergeFrom((org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime)other); @@ -1209,6 +1267,7 @@ public final class LocalTimeProtocol { return this; } + @Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -1423,6 +1482,7 @@ public final class LocalTimeProtocol { return defaultInstance; } + @Override public LocalTimes getDefaultInstanceForType() { return defaultInstance; } @@ -1432,6 +1492,7 @@ public final class LocalTimeProtocol { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTimes_descriptor; } + @Override protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTimes_fieldAccessorTable; @@ -1451,6 +1512,7 @@ public final class LocalTimeProtocol { private void initFields() { } + @Override public final boolean isInitialized() { for (org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime element : getLocalTimeList()) { if (!element.isInitialized()) { @@ -1460,6 +1522,7 @@ public final class LocalTimeProtocol { return true; } + @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); @@ -1470,6 +1533,7 @@ public final class LocalTimeProtocol { } private int memoizedSerializedSize = -1; + @Override public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) { @@ -1554,10 +1618,12 @@ public final class LocalTimeProtocol { } public static Builder newBuilder() { return Builder.create(); } + @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes prototype) { return newBuilder().mergeFrom(prototype); } + @Override public Builder toBuilder() { return newBuilder(this); } public static final class Builder extends @@ -1573,10 +1639,12 @@ public final class LocalTimeProtocol { return builder; } + @Override protected org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes internalGetResult() { return result; } + @Override public Builder clear() { if (result == null) { throw new IllegalStateException( @@ -1586,22 +1654,27 @@ public final class LocalTimeProtocol { return this; } + @Override public Builder clone() { return create().mergeFrom(result); } + @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes.getDescriptor(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes getDefaultInstanceForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes.getDefaultInstance(); } + @Override public boolean isInitialized() { return result.isInitialized(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes build() { if (result != null && !isInitialized()) { throw newUninitializedMessageException(result); @@ -1618,6 +1691,7 @@ public final class LocalTimeProtocol { return buildPartial(); } + @Override public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes buildPartial() { if (result == null) { throw new IllegalStateException( @@ -1632,6 +1706,7 @@ public final class LocalTimeProtocol { return returnMe; } + @Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes) { return mergeFrom((org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes)other); @@ -1655,6 +1730,7 @@ public final class LocalTimeProtocol { return this; } + @Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -1801,6 +1877,7 @@ public final class LocalTimeProtocol { }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + @Override public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Output.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Output.java index 2efe690871..70e2bec308 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Output.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/UTF8Output.java @@ -67,6 +67,7 @@ public class UTF8Output { } } + @Override public String toString() { if (state != UTF8_ACCEPT) { throw new UTF8Exception("bytes are not UTF-8"); From 6f857d271c4afd8388da9c3231b718be849e639e Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Wed, 9 Nov 2011 21:42:17 -0500 Subject: [PATCH 31/93] Make fields static where possible. --- .../codec/http/websocketx/WebSocketClientHandshaker10.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java index ba579491cb..87e2100f3d 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java @@ -49,7 +49,7 @@ public class WebSocketClientHandshaker10 extends WebSocketClientHandshaker { private String expectedChallengeResponseString = null; - private final String protocol = null; + private static final String protocol = null; private boolean allowExtensions = false; From 1c698494bba63a9365751e5f1c1be99fa74ade20 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Wed, 9 Nov 2011 21:45:42 -0500 Subject: [PATCH 32/93] Make inner classes static where possible. --- .../netty/channel/socket/http/HttpTunnelClientChannel.java | 2 +- .../channel/socket/http/HttpTunnelServerChannelSink.java | 2 +- .../netty/channel/socket/http/ServerMessageSwitch.java | 2 +- .../netty/channel/socket/nio/SocketSendBufferPool.java | 6 +++--- .../netty/handler/codec/http/HttpHeaderDateFormat.java | 4 ++-- .../netty/handler/codec/http/HttpPostRequestDecoder.java | 2 +- .../jboss/netty/channel/socket/AbstractSocketEchoTest.java | 2 +- .../codec/frame/AbstractSocketFixedLengthEchoTest.java | 2 +- .../AbstractSocketCompatibleObjectStreamEchoTest.java | 2 +- .../serialization/AbstractSocketObjectStreamEchoTest.java | 2 +- .../handler/codec/string/AbstractSocketStringEchoTest.java | 2 +- .../jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannel.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannel.java index 7e17e4798c..c2573e03df 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannel.java @@ -288,7 +288,7 @@ public class HttpTunnelClientChannel extends AbstractChannel implements Channels.fireChannelInterestChanged(this); } - private class ConsolidatingFutureListener implements ChannelFutureListener { + private static class ConsolidatingFutureListener implements ChannelFutureListener { private final ChannelFuture completionFuture; diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSink.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSink.java index 95d5853f13..aad8dcfc56 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSink.java @@ -61,7 +61,7 @@ class HttpTunnelServerChannelSink extends AbstractChannelSink { } } - private final class ChannelFutureProxy implements ChannelFutureListener { + private static final class ChannelFutureProxy implements ChannelFutureListener { private final ChannelFuture upstreamFuture; ChannelFutureProxy(ChannelFuture upstreamFuture) { diff --git a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java index ee2938b3a6..64cf9cbe08 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java @@ -238,7 +238,7 @@ class ServerMessageSwitch implements ServerMessageSwitchUpstreamInterface, /** * Used to pass the result received from one ChannelFutureListener to another verbatim. */ - private final class RelayedChannelFutureListener implements + private static final class RelayedChannelFutureListener implements ChannelFutureListener { private final ChannelFuture originalFuture; diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java index ac1d4e742c..ee45e856dd 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java @@ -147,7 +147,7 @@ final class SocketSendBufferPool { return q << ALIGN_SHIFT; } - private final class Preallocation { + private static final class Preallocation { final ByteBuffer buffer; int refCnt; @@ -176,7 +176,7 @@ final class SocketSendBufferPool { void release(); } - class UnpooledSendBuffer implements SendBuffer { + static class UnpooledSendBuffer implements SendBuffer { final ByteBuffer buffer; final int initialPos; @@ -266,7 +266,7 @@ final class SocketSendBufferPool { } } - final class FileSendBuffer implements SendBuffer { + static final class FileSendBuffer implements SendBuffer { private final FileRegion file; private long writtenBytes; diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaderDateFormat.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaderDateFormat.java index 421a33c07e..3a90733f31 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaderDateFormat.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaderDateFormat.java @@ -67,7 +67,7 @@ final class HttpHeaderDateFormat extends SimpleDateFormat { * First obsolete format

* Sunday, 06-Nov-94 08:49:37 GMT -> E, d-MMM-y HH:mm:ss z */ - private final class HttpHeaderDateFormatObsolete1 extends SimpleDateFormat { + private static final class HttpHeaderDateFormatObsolete1 extends SimpleDateFormat { private static final long serialVersionUID = -3178072504225114298L; HttpHeaderDateFormatObsolete1() { @@ -81,7 +81,7 @@ final class HttpHeaderDateFormat extends SimpleDateFormat { *

* Sun Nov 6 08:49:37 1994 -> EEE, MMM d HH:mm:ss yyyy */ - private final class HttpHeaderDateFormatObsolete2 extends SimpleDateFormat { + private static final class HttpHeaderDateFormatObsolete2 extends SimpleDateFormat { private static final long serialVersionUID = 3010674519968303714L; HttpHeaderDateFormatObsolete2() { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java index 3a59251941..521ce9d662 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java @@ -1485,7 +1485,7 @@ public class HttpPostRequestDecoder { * @author frederic bregier * */ - public class IncompatibleDataDecoderException extends Exception { + public static class IncompatibleDataDecoderException extends Exception { /** * */ diff --git a/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java b/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java index d3630750ee..da0040889f 100644 --- a/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java @@ -147,7 +147,7 @@ public abstract class AbstractSocketEchoTest { } } - private class EchoHandler extends SimpleChannelUpstreamHandler { + private static class EchoHandler extends SimpleChannelUpstreamHandler { volatile Channel channel; final AtomicReference exception = new AtomicReference(); volatile int counter; diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java index cdec5abda3..cca5dfd8f5 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java @@ -149,7 +149,7 @@ public abstract class AbstractSocketFixedLengthEchoTest { } } - private class EchoHandler extends SimpleChannelUpstreamHandler { + private static class EchoHandler extends SimpleChannelUpstreamHandler { volatile Channel channel; final AtomicReference exception = new AtomicReference(); volatile int counter; diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java index 313c6d8a42..0aa8717dbf 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java @@ -157,7 +157,7 @@ public abstract class AbstractSocketCompatibleObjectStreamEchoTest { } } - private class EchoHandler extends SimpleChannelUpstreamHandler { + private static class EchoHandler extends SimpleChannelUpstreamHandler { volatile Channel channel; final AtomicReference exception = new AtomicReference(); volatile int counter; diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java index a77b999cf7..32c511d1b2 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java @@ -156,7 +156,7 @@ public abstract class AbstractSocketObjectStreamEchoTest { } } - private class EchoHandler extends SimpleChannelUpstreamHandler { + private static class EchoHandler extends SimpleChannelUpstreamHandler { volatile Channel channel; final AtomicReference exception = new AtomicReference(); volatile int counter; diff --git a/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java index 720c4ef71b..786200804a 100644 --- a/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java @@ -162,7 +162,7 @@ public abstract class AbstractSocketStringEchoTest { } } - private class EchoHandler extends SimpleChannelUpstreamHandler { + private static class EchoHandler extends SimpleChannelUpstreamHandler { volatile Channel channel; final AtomicReference exception = new AtomicReference(); volatile int counter; diff --git a/src/test/java/org/jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java b/src/test/java/org/jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java index fedf9b29c7..34aa06644c 100644 --- a/src/test/java/org/jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java @@ -194,7 +194,7 @@ public abstract class AbstractSocketSslEchoTest { } } - private class EchoHandler extends SimpleChannelUpstreamHandler { + private static class EchoHandler extends SimpleChannelUpstreamHandler { volatile Channel channel; final AtomicReference exception = new AtomicReference(); volatile int counter; From 1213dc5acea07ac2de3b3994a13476cda95a237e Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Wed, 9 Nov 2011 21:49:44 -0500 Subject: [PATCH 33/93] Remove unnecessary enum modifier. --- .../jboss/netty/channel/rxtx/RXTXChannelConfig.java | 12 ++++++------ .../netty/example/localtime/LocalTimeProtocol.java | 4 ++-- .../netty/handler/codec/base64/Base64Dialect.java | 2 +- .../netty/handler/codec/http/HttpMessageDecoder.java | 2 +- .../netty/handler/codec/http/HttpPostBodyUtil.java | 6 +++--- .../handler/codec/http/HttpPostRequestDecoder.java | 2 +- .../http/websocketx/WebSocket08FrameDecoder.java | 4 ++-- .../org/jboss/netty/util/internal/jzlib/JZlib.java | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/rxtx/RXTXChannelConfig.java b/src/main/java/org/jboss/netty/channel/rxtx/RXTXChannelConfig.java index 6efe0c5e8f..a787b543e3 100644 --- a/src/main/java/org/jboss/netty/channel/rxtx/RXTXChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/rxtx/RXTXChannelConfig.java @@ -28,7 +28,7 @@ import org.jboss.netty.util.internal.ConversionUtil; */ public class RXTXChannelConfig extends DefaultChannelConfig { - public static enum Stopbits { + public enum Stopbits { STOPBITS_1(SerialPort.STOPBITS_1), STOPBITS_2(SerialPort.STOPBITS_2), @@ -36,7 +36,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig { private final int value; - private Stopbits(int value) { + Stopbits(int value) { this.value = value; } @@ -54,7 +54,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig { } } - public static enum Databits { + public enum Databits { DATABITS_5(SerialPort.DATABITS_5), DATABITS_6(SerialPort.DATABITS_6), @@ -63,7 +63,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig { private final int value; - private Databits(int value) { + Databits(int value) { this.value = value; } @@ -81,7 +81,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig { } } - public static enum Paritybit { + public enum Paritybit { NONE(SerialPort.PARITY_NONE), ODD(SerialPort.PARITY_ODD), @@ -91,7 +91,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig { private final int value; - private Paritybit(int value) { + Paritybit(int value) { this.value = value; } diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java index 4668234d20..20b65517e5 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java @@ -86,7 +86,7 @@ public final class LocalTimeProtocol { } private final int index; private final int value; - private Continent(int index, int value) { + Continent(int index, int value) { this.index = index; this.value = value; } @@ -167,7 +167,7 @@ public final class LocalTimeProtocol { } private final int index; private final int value; - private DayOfWeek(int index, int value) { + DayOfWeek(int index, int value) { this.index = index; this.value = value; } diff --git a/src/main/java/org/jboss/netty/handler/codec/base64/Base64Dialect.java b/src/main/java/org/jboss/netty/handler/codec/base64/Base64Dialect.java index d7e097442c..c49cea6593 100644 --- a/src/main/java/org/jboss/netty/handler/codec/base64/Base64Dialect.java +++ b/src/main/java/org/jboss/netty/handler/codec/base64/Base64Dialect.java @@ -203,7 +203,7 @@ public enum Base64Dialect { final byte[] decodabet; final boolean breakLinesByDefault; - private Base64Dialect(byte[] alphabet, byte[] decodabet, boolean breakLinesByDefault) { + Base64Dialect(byte[] alphabet, byte[] decodabet, boolean breakLinesByDefault) { this.alphabet = alphabet; this.decodabet = decodabet; this.breakLinesByDefault = breakLinesByDefault; diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java index e2658ebafa..8ed7643337 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java @@ -124,7 +124,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder Date: Wed, 9 Nov 2011 21:51:50 -0500 Subject: [PATCH 34/93] Remove redundant 'final' method in 'final' class. --- .../channel/local/DefaultLocalChannel.java | 4 ++-- .../socket/nio/SocketReceiveBufferPool.java | 6 ++--- .../socket/nio/SocketSendBufferPool.java | 12 +++++----- .../example/localtime/LocalTimeProtocol.java | 16 +++++++------- .../util/internal/ConcurrentHashMap.java | 12 +++++----- .../internal/ConcurrentIdentityHashMap.java | 12 +++++----- .../ConcurrentIdentityWeakKeyHashMap.java | 20 ++++++++--------- .../internal/ConcurrentWeakKeyHashMap.java | 20 ++++++++--------- .../util/internal/LinkedTransferQueue.java | 22 +++++++++---------- .../netty/util/internal/NonReentrantLock.java | 6 ++--- 10 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java index 455d43a578..2e941fba8d 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java @@ -104,7 +104,7 @@ final class DefaultLocalChannel extends AbstractChannel implements LocalChannel return state.get() == ST_CONNECTED; } - final void setBound() throws ClosedChannelException { + void setBound() throws ClosedChannelException { if (!state.compareAndSet(ST_OPEN, ST_BOUND)) { switch (state.get()) { case ST_CLOSED: @@ -115,7 +115,7 @@ final class DefaultLocalChannel extends AbstractChannel implements LocalChannel } } - final void setConnected() { + void setConnected() { if (state.get() != ST_CLOSED) { state.set(ST_CONNECTED); } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java index 321f4cc69f..c0922ef314 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java @@ -30,7 +30,7 @@ final class SocketReceiveBufferPool { @SuppressWarnings("unchecked") private final SoftReference[] pool = new SoftReference[POOL_SIZE]; - final ByteBuffer acquire(int size) { + ByteBuffer acquire(int size) { final SoftReference[] pool = this.pool; for (int i = 0; i < POOL_SIZE; i ++) { SoftReference ref = pool[i]; @@ -59,7 +59,7 @@ final class SocketReceiveBufferPool { return buf; } - final void release(ByteBuffer buffer) { + void release(ByteBuffer buffer) { final SoftReference[] pool = this.pool; for (int i = 0; i < POOL_SIZE; i ++) { SoftReference ref = pool[i]; @@ -95,4 +95,4 @@ final class SocketReceiveBufferPool { } return q << 10; } -} \ No newline at end of file +} diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java index ee45e856dd..237d52451c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java @@ -45,7 +45,7 @@ final class SocketSendBufferPool { super(); } - final SendBuffer acquire(Object message) { + SendBuffer acquire(Object message) { if (message instanceof ChannelBuffer) { return acquire((ChannelBuffer) message); } else if (message instanceof FileRegion) { @@ -320,27 +320,27 @@ final class SocketSendBufferPool { } @Override - public final boolean finished() { + public boolean finished() { return true; } @Override - public final long writtenBytes() { + public long writtenBytes() { return 0; } @Override - public final long totalBytes() { + public long totalBytes() { return 0; } @Override - public final long transferTo(WritableByteChannel ch) throws IOException { + public long transferTo(WritableByteChannel ch) throws IOException { return 0; } @Override - public final long transferTo(DatagramChannel ch, SocketAddress raddr) throws IOException { + public long transferTo(DatagramChannel ch, SocketAddress raddr) throws IOException { return 0; } diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java index 20b65517e5..93117e8d1d 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java @@ -197,7 +197,7 @@ public final class LocalTimeProtocol { return defaultInstance; } - public static final com.google.protobuf.Descriptors.Descriptor + public static com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Location_descriptor; } @@ -226,7 +226,7 @@ public final class LocalTimeProtocol { continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; } @Override - public final boolean isInitialized() { + public boolean isInitialized() { if (!hasContinent) { return false; } @@ -560,7 +560,7 @@ public final class LocalTimeProtocol { return defaultInstance; } - public static final com.google.protobuf.Descriptors.Descriptor + public static com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Locations_descriptor; } @@ -586,7 +586,7 @@ public final class LocalTimeProtocol { private void initFields() { } @Override - public final boolean isInitialized() { + public boolean isInitialized() { for (org.jboss.netty.example.localtime.LocalTimeProtocol.Location element : getLocationList()) { if (!element.isInitialized()) { return false; @@ -917,7 +917,7 @@ public final class LocalTimeProtocol { return defaultInstance; } - public static final com.google.protobuf.Descriptors.Descriptor + public static com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTime_descriptor; } @@ -981,7 +981,7 @@ public final class LocalTimeProtocol { dayOfWeek_ = org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek.SUNDAY; } @Override - public final boolean isInitialized() { + public boolean isInitialized() { if (!hasYear) { return false; } @@ -1487,7 +1487,7 @@ public final class LocalTimeProtocol { return defaultInstance; } - public static final com.google.protobuf.Descriptors.Descriptor + public static com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTimes_descriptor; } @@ -1513,7 +1513,7 @@ public final class LocalTimeProtocol { private void initFields() { } @Override - public final boolean isInitialized() { + public boolean isInitialized() { for (org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime element : getLocalTimeList()) { if (!element.isInitialized()) { return false; diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java index e22e75614d..c8cc4854f6 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java @@ -138,7 +138,7 @@ public final class ConcurrentHashMap extends AbstractMap * @param hash the hash code for the key * @return the segment */ - final Segment segmentFor(int hash) { + Segment segmentFor(int hash) { return segments[hash >>> segmentShift & segmentMask]; } @@ -173,21 +173,21 @@ public final class ConcurrentHashMap extends AbstractMap } @SuppressWarnings("unchecked") - final K key() { + K key() { return (K) key; } @SuppressWarnings("unchecked") - final V value() { + V value() { return (V) value; } - final void setValue(V value) { + void setValue(V value) { this.value = value; } @SuppressWarnings("unchecked") - static final HashEntry[] newArray(int i) { + static HashEntry[] newArray(int i) { return new HashEntry[i]; } } @@ -273,7 +273,7 @@ public final class ConcurrentHashMap extends AbstractMap } @SuppressWarnings("unchecked") - static final Segment[] newArray(int i) { + static Segment[] newArray(int i) { return new Segment[i]; } diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java index 9e06a05fee..7f82088dca 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java @@ -138,7 +138,7 @@ public final class ConcurrentIdentityHashMap extends AbstractMap * @param hash the hash code for the key * @return the segment */ - final Segment segmentFor(int hash) { + Segment segmentFor(int hash) { return segments[hash >>> segmentShift & segmentMask]; } @@ -173,21 +173,21 @@ public final class ConcurrentIdentityHashMap extends AbstractMap } @SuppressWarnings("unchecked") - final K key() { + K key() { return (K) key; } @SuppressWarnings("unchecked") - final V value() { + V value() { return (V) value; } - final void setValue(V value) { + void setValue(V value) { this.value = value; } @SuppressWarnings("unchecked") - static final HashEntry[] newArray(int i) { + static HashEntry[] newArray(int i) { return new HashEntry[i]; } } @@ -273,7 +273,7 @@ public final class ConcurrentIdentityHashMap extends AbstractMap } @SuppressWarnings("unchecked") - static final Segment[] newArray(int i) { + static Segment[] newArray(int i) { return new Segment[i]; } diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java index 1c7f546cbb..4df097d353 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java @@ -145,7 +145,7 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap segmentFor(int hash) { + Segment segmentFor(int hash) { return segments[hash >>> segmentShift & segmentMask]; } @@ -167,11 +167,11 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap extends AbstractMap) keyRef).get(); } - final V value() { + V value() { return dereferenceValue(valueRef); } @SuppressWarnings("unchecked") - final V dereferenceValue(Object value) { + V dereferenceValue(Object value) { if (value instanceof WeakKeyReference) { return ((Reference) value).get(); } @@ -221,12 +221,12 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap HashEntry[] newArray(int i) { + static HashEntry[] newArray(int i) { return new HashEntry[i]; } } @@ -318,7 +318,7 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap Segment[] newArray(int i) { + static Segment[] newArray(int i) { return new Segment[i]; } @@ -618,7 +618,7 @@ public final class ConcurrentIdentityWeakKeyHashMap extends AbstractMap extends AbstractMap impl * @param hash the hash code for the key * @return the segment */ - final Segment segmentFor(int hash) { + Segment segmentFor(int hash) { return segments[hash >>> segmentShift & segmentMask]; } @@ -167,11 +167,11 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl this.hash = hash; } - public final int keyHash() { + public int keyHash() { return hash; } - public final Object keyRef() { + public Object keyRef() { return this; } } @@ -204,16 +204,16 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl } @SuppressWarnings("unchecked") - final K key() { + K key() { return ((WeakReference) keyRef).get(); } - final V value() { + V value() { return dereferenceValue(valueRef); } @SuppressWarnings("unchecked") - final V dereferenceValue(Object value) { + V dereferenceValue(Object value) { if (value instanceof WeakKeyReference) { return ((Reference) value).get(); } @@ -221,12 +221,12 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl return (V) value; } - final void setValue(V value) { + void setValue(V value) { this.valueRef = value; } @SuppressWarnings("unchecked") - static final HashEntry[] newArray(int i) { + static HashEntry[] newArray(int i) { return new HashEntry[i]; } } @@ -318,7 +318,7 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl } @SuppressWarnings("unchecked") - static final Segment[] newArray(int i) { + static Segment[] newArray(int i) { return new Segment[i]; } @@ -618,7 +618,7 @@ public final class ConcurrentWeakKeyHashMap extends AbstractMap impl } @SuppressWarnings("rawtypes") - final void removeStale() { + void removeStale() { WeakKeyReference ref; while ((ref = (WeakKeyReference) refQueue.poll()) != null) { remove(ref.keyRef(), ref.keyHash(), null, true); diff --git a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java index 7ca6974c1a..41d645e420 100644 --- a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java +++ b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java @@ -437,7 +437,7 @@ public class LinkedTransferQueue extends AbstractQueue volatile Thread waiter; // null until waiting // CAS methods for fields - final boolean casNext(Node cmp, Node val) { + boolean casNext(Node cmp, Node val) { if (AtomicFieldUpdaterUtil.isAvailable()) { return nextUpdater.compareAndSet(this, cmp, val); } else { @@ -452,7 +452,7 @@ public class LinkedTransferQueue extends AbstractQueue } } - final boolean casItem(Object cmp, Object val) { + boolean casItem(Object cmp, Object val) { // assert cmp == null || cmp.getClass() != Node.class; if (AtomicFieldUpdaterUtil.isAvailable()) { return itemUpdater.compareAndSet(this, cmp, val); @@ -481,7 +481,7 @@ public class LinkedTransferQueue extends AbstractQueue * Links node to itself to avoid garbage retention. Called * only after CASing head field, so uses relaxed write. */ - final void forgetNext() { + void forgetNext() { this.next = this; } @@ -494,7 +494,7 @@ public class LinkedTransferQueue extends AbstractQueue * follows either CAS or return from park (if ever parked; * else we don't care). */ - final void forgetContents() { + void forgetContents() { this.item = this; this.waiter = null; } @@ -503,7 +503,7 @@ public class LinkedTransferQueue extends AbstractQueue * Returns true if this node has been matched, including the * case of artificial matches due to cancellation. */ - final boolean isMatched() { + boolean isMatched() { Object x = item; return x == this || x == null == isData; } @@ -511,7 +511,7 @@ public class LinkedTransferQueue extends AbstractQueue /** * Returns true if this is an unmatched request node. */ - final boolean isUnmatchedRequest() { + boolean isUnmatchedRequest() { return !isData && item == null; } @@ -520,7 +520,7 @@ public class LinkedTransferQueue extends AbstractQueue * appended to this node because this node is unmatched and * has opposite data mode. */ - final boolean cannotPrecede(boolean haveData) { + boolean cannotPrecede(boolean haveData) { boolean d = isData; Object x; return d != haveData && (x = item) != this && x != null == d; @@ -529,7 +529,7 @@ public class LinkedTransferQueue extends AbstractQueue /** * Tries to artificially match a data node -- used by remove. */ - final boolean tryMatchData() { + boolean tryMatchData() { // assert isData; Object x = item; if (x != null && x != this && casItem(x, null)) { @@ -895,12 +895,12 @@ public class LinkedTransferQueue extends AbstractQueue } @Override - public final boolean hasNext() { + public boolean hasNext() { return nextNode != null; } @Override - public final E next() { + public E next() { Node p = nextNode; if (p == null) { throw new NoSuchElementException(); @@ -911,7 +911,7 @@ public class LinkedTransferQueue extends AbstractQueue } @Override - public final void remove() { + public void remove() { Node p = lastRet; if (p == null) { throw new IllegalStateException(); diff --git a/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java b/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java index b6aeb02625..bc05add136 100644 --- a/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java +++ b/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java @@ -68,7 +68,7 @@ public final class NonReentrantLock extends AbstractQueuedSynchronizer } @Override - protected final boolean tryAcquire(int acquires) { + protected boolean tryAcquire(int acquires) { if (compareAndSetState(0, 1)) { owner = Thread.currentThread(); return true; @@ -77,7 +77,7 @@ public final class NonReentrantLock extends AbstractQueuedSynchronizer } @Override - protected final boolean tryRelease(int releases) { + protected boolean tryRelease(int releases) { if (Thread.currentThread() != owner) { throw new IllegalMonitorStateException(); } @@ -87,7 +87,7 @@ public final class NonReentrantLock extends AbstractQueuedSynchronizer } @Override - protected final boolean isHeldExclusively() { + protected boolean isHeldExclusively() { return getState() != 0 && owner == Thread.currentThread(); } } From f641e25735a2c6c939d2b4be94ede83b6ea993fd Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Wed, 9 Nov 2011 22:09:25 -0500 Subject: [PATCH 35/93] Remove redundant 'final' from static methods. --- .../org/jboss/netty/example/localtime/LocalTimeProtocol.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java index 93117e8d1d..7946fef1a8 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java @@ -68,7 +68,7 @@ public final class LocalTimeProtocol { getDescriptorForType() { return getDescriptor(); } - public static final com.google.protobuf.Descriptors.EnumDescriptor + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.getDescriptor().getEnumTypes().get(0); } @@ -149,7 +149,7 @@ public final class LocalTimeProtocol { getDescriptorForType() { return getDescriptor(); } - public static final com.google.protobuf.Descriptors.EnumDescriptor + public static com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.getDescriptor().getEnumTypes().get(1); } From 41d488419472d7bdc96150c7c75a503272148f62 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sat, 12 Nov 2011 13:08:00 -0500 Subject: [PATCH 36/93] Remove redundant array creations. --- .../handler/codec/replay/ReplayingDecoderBuffer.java | 2 +- .../java/org/jboss/netty/buffer/ChannelBuffersTest.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java index dfe00bf5f2..7d61665e3f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java @@ -363,7 +363,7 @@ class ReplayingDecoderBuffer implements ChannelBuffer { } else { return Integer.MAX_VALUE - buffer.readerIndex(); } - } + } @Override public boolean readBoolean() { diff --git a/src/test/java/org/jboss/netty/buffer/ChannelBuffersTest.java b/src/test/java/org/jboss/netty/buffer/ChannelBuffersTest.java index 81a649e93b..c03d13df0b 100644 --- a/src/test/java/org/jboss/netty/buffer/ChannelBuffersTest.java +++ b/src/test/java/org/jboss/netty/buffer/ChannelBuffersTest.java @@ -177,10 +177,10 @@ public class ChannelBuffersTest { assertSame(EMPTY_BUFFER, wrappedBuffer(new byte[][] { new byte[0] })); assertSame(EMPTY_BUFFER, wrappedBuffer(new ByteBuffer[0])); assertSame(EMPTY_BUFFER, wrappedBuffer(new ByteBuffer[] { ByteBuffer.allocate(0) })); - assertSame(EMPTY_BUFFER, wrappedBuffer(new ByteBuffer[] { ByteBuffer.allocate(0), ByteBuffer.allocate(0) })); + assertSame(EMPTY_BUFFER, wrappedBuffer(ByteBuffer.allocate(0), ByteBuffer.allocate(0))); assertSame(EMPTY_BUFFER, wrappedBuffer(new ChannelBuffer[0])); assertSame(EMPTY_BUFFER, wrappedBuffer(new ChannelBuffer[] { buffer(0) })); - assertSame(EMPTY_BUFFER, wrappedBuffer(new ChannelBuffer[] { buffer(0), buffer(0) })); + assertSame(EMPTY_BUFFER, wrappedBuffer(buffer(0), buffer(0))); assertSame(EMPTY_BUFFER, copiedBuffer(new byte[0])); assertSame(EMPTY_BUFFER, copiedBuffer(LITTLE_ENDIAN, new byte[0])); @@ -194,10 +194,10 @@ public class ChannelBuffersTest { assertSame(EMPTY_BUFFER, copiedBuffer(new byte[][] { new byte[0] })); assertSame(EMPTY_BUFFER, copiedBuffer(new ByteBuffer[0])); assertSame(EMPTY_BUFFER, copiedBuffer(new ByteBuffer[] { ByteBuffer.allocate(0) })); - assertSame(EMPTY_BUFFER, copiedBuffer(new ByteBuffer[] { ByteBuffer.allocate(0), ByteBuffer.allocate(0) })); + assertSame(EMPTY_BUFFER, copiedBuffer(ByteBuffer.allocate(0), ByteBuffer.allocate(0))); assertSame(EMPTY_BUFFER, copiedBuffer(new ChannelBuffer[0])); assertSame(EMPTY_BUFFER, copiedBuffer(new ChannelBuffer[] { buffer(0) })); - assertSame(EMPTY_BUFFER, copiedBuffer(new ChannelBuffer[] { buffer(0), buffer(0) })); + assertSame(EMPTY_BUFFER, copiedBuffer(buffer(0), buffer(0))); } @Test From f9a19517d5333a07faa05d21d3385bbd3e830738 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sat, 12 Nov 2011 13:09:12 -0500 Subject: [PATCH 37/93] Remove redundant type arguments. --- .../jboss/netty/util/internal/LinkedTransferQueue.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java index 41d645e420..8bbf3ae97d 100644 --- a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java +++ b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java @@ -653,7 +653,7 @@ public class LinkedTransferQueue extends AbstractQueue } } LockSupport.unpark(p.waiter); - return LinkedTransferQueue.cast(item); + return LinkedTransferQueue.cast(item); } } Node n = p.next; @@ -737,7 +737,7 @@ public class LinkedTransferQueue extends AbstractQueue if (item != e) { // matched // assert item != s; s.forgetContents(); // avoid garbage - return LinkedTransferQueue.cast(item); + return LinkedTransferQueue.cast(item); } if ((w.isInterrupted() || timed && nanos <= 0) && s.casItem(e, s)) { // cancel @@ -825,7 +825,7 @@ public class LinkedTransferQueue extends AbstractQueue Object item = p.item; if (p.isData) { if (item != null && item != p) { - return LinkedTransferQueue.cast(item); + return LinkedTransferQueue.cast(item); } } else if (item == null) { @@ -878,7 +878,7 @@ public class LinkedTransferQueue extends AbstractQueue Object item = p.item; if (p.isData) { if (item != null && item != p) { - nextItem = LinkedTransferQueue.cast(item); + nextItem = LinkedTransferQueue.cast(item); nextNode = p; return; } From e84571a5f2f3f3f410a8ff510490b52a29c8c40a Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sat, 12 Nov 2011 13:14:16 -0500 Subject: [PATCH 38/93] Remove unnecessary semicolons. --- src/main/java/org/jboss/netty/channel/ChannelState.java | 2 +- .../org/jboss/netty/handler/codec/compression/ZlibWrapper.java | 2 +- .../org/jboss/netty/handler/codec/http/HttpMessageDecoder.java | 2 +- .../jboss/netty/handler/codec/http/HttpPostRequestDecoder.java | 2 +- .../org/jboss/netty/handler/codec/http/InterfaceHttpData.java | 2 +- src/main/java/org/jboss/netty/handler/timeout/IdleState.java | 2 +- src/main/java/org/jboss/netty/logging/InternalLogLevel.java | 2 +- src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/ChannelState.java b/src/main/java/org/jboss/netty/channel/ChannelState.java index 28af7ebcb2..44f01939c5 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelState.java +++ b/src/main/java/org/jboss/netty/channel/ChannelState.java @@ -100,5 +100,5 @@ public enum ChannelState { * Represents a {@link Channel}'s {@link Channel#getInterestOps() interestOps} * property */ - INTEREST_OPS; + INTEREST_OPS } diff --git a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibWrapper.java b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibWrapper.java index ac598ed7dd..3c38383fd9 100644 --- a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibWrapper.java +++ b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibWrapper.java @@ -40,5 +40,5 @@ public enum ZlibWrapper { * Try {@link #ZLIB} first and then {@link #NONE} if the first attempt fails. * Please note that you can specify this wrapper type only when decompressing. */ - ZLIB_OR_NONE; + ZLIB_OR_NONE } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java index 8ed7643337..87cff2b2c0 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java @@ -136,7 +136,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder { enum HttpDataType { - Attribute, FileUpload, InternalAttribute; + Attribute, FileUpload, InternalAttribute } /** diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleState.java b/src/main/java/org/jboss/netty/handler/timeout/IdleState.java index f33f11b9fe..da828033db 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleState.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleState.java @@ -37,5 +37,5 @@ public enum IdleState { /** * No data was either received or sent for a while. */ - ALL_IDLE; + ALL_IDLE } diff --git a/src/main/java/org/jboss/netty/logging/InternalLogLevel.java b/src/main/java/org/jboss/netty/logging/InternalLogLevel.java index 8f054037c3..ff08b8461f 100644 --- a/src/main/java/org/jboss/netty/logging/InternalLogLevel.java +++ b/src/main/java/org/jboss/netty/logging/InternalLogLevel.java @@ -38,5 +38,5 @@ public enum InternalLogLevel { /** * 'ERROR' log level. */ - ERROR; + ERROR } diff --git a/src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java b/src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java index 7e7704064e..228b9ff425 100644 --- a/src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java +++ b/src/main/java/org/jboss/netty/util/internal/jzlib/JZlib.java @@ -104,6 +104,6 @@ public final class JZlib { static final int MAX_BL_BITS = 7; enum WrapperType { - NONE, ZLIB, GZIP, ZLIB_OR_NONE; + NONE, ZLIB, GZIP, ZLIB_OR_NONE } } From d073e1d14dd9f89b61d502ce372c565c23487e8d Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sat, 12 Nov 2011 13:14:39 -0500 Subject: [PATCH 39/93] Replace constant array creation expression with array initializer. --- .../jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java | 2 +- .../org/jboss/netty/example/securechat/SecureChatKeyStore.java | 2 +- .../java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java | 2 +- .../java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java | 2 +- .../jboss/netty/handler/codec/http/QueryStringDecoderTest.java | 2 +- .../codec/protobuf/ProtobufVarint32FrameDecoderTest.java | 2 +- .../protobuf/ProtobufVarint32LengthFieldPrependerTest.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java index cf247ea68b..43bebf29a4 100644 --- a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java +++ b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java @@ -32,7 +32,7 @@ public class QuoteOfTheMomentServerHandler extends SimpleChannelUpstreamHandler private static final Random random = new Random(); // Quotes from Mohandas K. Gandhi: - private static final String[] quotes = new String[] { + private static final String[] quotes = { "Where there is love there is life.", "First they ignore you, then they laugh at you, then they fight you, then you win.", "Be the change you want to see in the world.", diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatKeyStore.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatKeyStore.java index 707852e63b..48efac7311 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatKeyStore.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatKeyStore.java @@ -36,7 +36,7 @@ import java.io.InputStream; * @version $Rev$, $Date$ */ public class SecureChatKeyStore { - private static final short[] DATA = new short[] { + private static final short[] DATA = { 0xfe, 0xed, 0xfe, 0xed, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java index b9d47014ff..98dd124854 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java @@ -50,7 +50,7 @@ class HttpCodecUtil { /** * carriage return line feed */ - static final byte[] CRLF = new byte[] { CR, LF }; + static final byte[] CRLF = { CR, LF }; /** * Colon ':' diff --git a/src/test/java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java index 7c89e8d09f..59718fa0e2 100644 --- a/src/test/java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java @@ -93,7 +93,7 @@ public class ReadOnlyChannelBufferTest { expect(buf.getLong(21)).andReturn(22L); ByteBuffer bb = ByteBuffer.allocate(100); - ByteBuffer[] bbs = new ByteBuffer[] { ByteBuffer.allocate(101), ByteBuffer.allocate(102) }; + ByteBuffer[] bbs = { ByteBuffer.allocate(101), ByteBuffer.allocate(102) }; expect(buf.toByteBuffer(23, 24)).andReturn(bb); expect(buf.toByteBuffers(25, 26)).andReturn(bbs); diff --git a/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java index de9a6f2c64..07a2bd3f1d 100644 --- a/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java @@ -106,7 +106,7 @@ public class QueryStringDecoderTest { // not rely on the platform's default encoding (not portable). new byte[] {'C', 'a', 'f', 'f', (byte) 0xC3, (byte) 0xA9}, "UTF-8"); - final String[] tests = new String[] { + final String[] tests = { // Encoded -> Decoded or error message substring "", "", "foo", "foo", diff --git a/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoderTest.java index 7b09815288..51f4f3cf46 100644 --- a/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoderTest.java @@ -42,7 +42,7 @@ public class ProtobufVarint32FrameDecoderTest { @Test public void testTinyDecode() { - byte[] b = new byte[] { 4, 1, 1, 1, 1 }; + byte[] b = { 4, 1, 1, 1, 1 }; embedder.offer(wrappedBuffer(b, 0, 1)); assertThat(embedder.poll(), is(nullValue())); embedder.offer(wrappedBuffer(b, 1, 2)); diff --git a/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java b/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java index 9ff660d3b8..a1c8f488eb 100644 --- a/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java @@ -41,7 +41,7 @@ public class ProtobufVarint32LengthFieldPrependerTest { @Test public void testTinyEncode() { - byte[] b = new byte[] { 4, 1, 1, 1, 1 }; + byte[] b = { 4, 1, 1, 1, 1 }; embedder.offer(wrappedBuffer(b, 1, b.length - 1)); assertThat(embedder.poll(), is(wrappedBuffer(b))); } From 9b9ee79f27f1019d7e3f1a29cc311e312c933cc1 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sat, 12 Nov 2011 13:15:33 -0500 Subject: [PATCH 40/93] Remove unnecessary 'return' statements. --- .../jboss/netty/example/http/upload/HttpRequestHandler.java | 1 - .../http/websocketx/autobahn/WebSocketServerHandler.java | 1 - .../org/jboss/netty/example/http/websocketx/client/App.java | 1 - .../example/http/websocketx/server/WebSocketServerHandler.java | 1 - .../codec/http/websocketx/WebSocketClientHandshaker00.java | 2 -- .../codec/http/websocketx/WebSocketClientHandshaker10.java | 3 --- .../codec/http/websocketx/WebSocketServerHandshaker.java | 1 - .../codec/http/websocketx/WebSocketServerHandshaker00.java | 2 -- .../codec/http/websocketx/WebSocketServerHandshaker10.java | 2 -- .../http/websocketx/WebSocketServerHandshakerFactory.java | 2 -- .../jboss/netty/channel/socket/http/HttpTunnelSoakTester.java | 1 - 11 files changed, 17 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpRequestHandler.java b/src/main/java/org/jboss/netty/example/http/upload/HttpRequestHandler.java index 53200454cd..dfe3d4425f 100644 --- a/src/main/java/org/jboss/netty/example/http/upload/HttpRequestHandler.java +++ b/src/main/java/org/jboss/netty/example/http/upload/HttpRequestHandler.java @@ -267,7 +267,6 @@ public class HttpRequestHandler extends SimpleChannelUpstreamHandler { // end responseContent .append("\r\n\r\nEND OF CONTENT CHUNK BY CHUNK\r\n\r\n"); - return; } } diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerHandler.java b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerHandler.java index f3a084282f..2714ab01a7 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerHandler.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerHandler.java @@ -84,7 +84,6 @@ public class WebSocketServerHandler extends SimpleChannelUpstreamHandler { } else { this.handshaker.executeOpeningHandshake(ctx, req); } - return; } private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) { diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java index 1112c45cf7..3d1c3ab8bf 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java @@ -98,7 +98,6 @@ public class App { public ArrayList messagesReceived = new ArrayList(); public MyCallbackHandler() { - return; } @Override diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerHandler.java b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerHandler.java index d2b2d6ac85..2fd373bdc7 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerHandler.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerHandler.java @@ -104,7 +104,6 @@ public class WebSocketServerHandler extends SimpleChannelUpstreamHandler { } else { this.handshaker.executeOpeningHandshake(ctx, req); } - return; } private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java index 17515192fc..51f27c4978 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java @@ -65,7 +65,6 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker { */ public WebSocketClientHandshaker00(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol) { super(webSocketURL, version, subProtocol); - return; } /** @@ -206,7 +205,6 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker { ctx.getPipeline().replace("decoder", "ws-decoder", new WebSocket00FrameDecoder()); this.setOpenningHandshakeCompleted(true); - return; } private String insertRandomCharacters(String key) { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java index 87e2100f3d..b68c97fc7f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker10.java @@ -73,7 +73,6 @@ public class WebSocketClientHandshaker10 extends WebSocketClientHandshaker { public WebSocketClientHandshaker10(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol, boolean allowExtensions) { super(webSocketURL, version, subProtocol); this.allowExtensions = allowExtensions; - return; } /** @@ -134,7 +133,6 @@ public class WebSocketClientHandshaker10 extends WebSocketClientHandshaker { channel.write(request); ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket08FrameEncoder(true)); - return; } /** @@ -183,7 +181,6 @@ public class WebSocketClientHandshaker10 extends WebSocketClientHandshaker { ctx.getPipeline().replace("decoder", "ws-decoder", new WebSocket08FrameDecoder(false, this.allowExtensions)); this.setOpenningHandshakeCompleted(true); - return; } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java index 9d5ccab099..9d8c7a7a5f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java @@ -61,7 +61,6 @@ public abstract class WebSocketServerHandshaker { this.subProtocolsArray[i] = this.subProtocolsArray[i].trim(); } } - return; } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java index 7426c97b37..ea63380d04 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java @@ -73,7 +73,6 @@ public class WebSocketServerHandshaker00 extends WebSocketServerHandshaker { */ public WebSocketServerHandshaker00(String webSocketURL, String subProtocols) { super(webSocketURL, subProtocols); - return; } /** @@ -185,7 +184,6 @@ public class WebSocketServerHandshaker00 extends WebSocketServerHandshaker { ctx.getChannel().write(res); p.replace("encoder", "wsencoder", new WebSocket00FrameEncoder()); - return; } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java index 541b4f8489..dbed38ff03 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker10.java @@ -65,7 +65,6 @@ public class WebSocketServerHandshaker10 extends WebSocketServerHandshaker { public WebSocketServerHandshaker10(String webSocketURL, String subProtocols, boolean allowExtensions) { super(webSocketURL, subProtocols); this.allowExtensions = allowExtensions; - return; } /** @@ -148,7 +147,6 @@ public class WebSocketServerHandshaker10 extends WebSocketServerHandshaker { p.replace("decoder", "wsdecoder", new WebSocket08FrameDecoder(true, this.allowExtensions)); p.replace("encoder", "wsencoder", new WebSocket08FrameEncoder(false)); - return; } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java index 74ec495f5e..5c33b5989c 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java @@ -54,7 +54,6 @@ public class WebSocketServerHandshakerFactory { this.webSocketURL = webSocketURL; this.subProtocols = subProtocols; this.allowExtensions = allowExtensions; - return; } /** @@ -91,7 +90,6 @@ public class WebSocketServerHandshakerFactory { res.setStatus(HttpResponseStatus.UPGRADE_REQUIRED); res.setHeader(Names.SEC_WEBSOCKET_VERSION, "8"); ctx.getChannel().write(res); - return; } } diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java index 70c56338da..14d45f2494 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java @@ -345,7 +345,6 @@ public class HttpTunnelSoakTester { if (verifiedBytes >= BYTES_TO_SEND) { completionLatch.countDown(); - return; } } From f0520dad20e82ddd0d8a80e24e34d7d2a35f0151 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sat, 12 Nov 2011 13:19:37 -0500 Subject: [PATCH 41/93] Remove unnecessary calls to 'super()'. --- .../org/jboss/netty/bootstrap/Bootstrap.java | 1 - .../netty/bootstrap/ClientBootstrap.java | 1 - .../bootstrap/ConnectionlessBootstrap.java | 1 - .../netty/bootstrap/ServerBootstrap.java | 1 - .../buffer/HeapChannelBufferFactory.java | 1 - .../netty/channel/AbstractChannelSink.java | 1 - .../jboss/netty/channel/ChannelException.java | 1 - .../ChannelHandlerLifeCycleException.java | 1 - .../channel/ChannelPipelineException.java | 1 - .../netty/channel/DefaultChannelPipeline.java | 1 - .../SimpleChannelDownstreamHandler.java | 1 - .../netty/channel/SimpleChannelHandler.java | 1 - .../channel/SimpleChannelUpstreamHandler.java | 1 - .../channel/local/LocalClientChannelSink.java | 1 - .../channel/local/LocalServerChannelSink.java | 1 - .../socket/http/HttpTunnelServerChannel.java | 1 - .../socket/http/ServerMessageSwitch.java | 1 - .../nio/NioClientSocketPipelineSink.java | 1 - .../socket/nio/NioDatagramChannel.java | 2 -- .../socket/nio/NioProviderMetadata.java | 1 - .../channel/socket/nio/NioSocketChannel.java | 2 -- .../socket/nio/SocketSendBufferPool.java | 2 -- .../compression/CompressionException.java | 1 - .../handler/codec/compression/ZlibUtil.java | 1 - .../codec/embedder/AbstractCodecEmbedder.java | 2 -- .../embedder/CodecEmbedderException.java | 1 - .../embedder/EmbeddedChannelFactory.java | 1 - .../codec/frame/CorruptedFrameException.java | 1 - .../codec/frame/TooLongFrameException.java | 1 - .../codec/http/CaseIgnoringComparator.java | 1 - .../handler/codec/http/HttpClientCodec.java | 1 - .../handler/codec/http/HttpCodecUtil.java | 1 - .../codec/http/HttpContentDecoder.java | 1 - .../codec/http/HttpContentEncoder.java | 1 - .../netty/handler/codec/http/HttpHeaders.java | 2 -- .../codec/http/HttpMessageEncoder.java | 1 - .../handler/codec/http/HttpPostBodyUtil.java | 1 - .../codec/http/HttpPostRequestDecoder.java | 3 --- .../codec/http/HttpPostRequestEncoder.java | 1 - .../codec/http/HttpRequestDecoder.java | 1 - .../codec/http/HttpRequestEncoder.java | 1 - .../codec/http/HttpResponseDecoder.java | 1 - .../codec/http/HttpResponseEncoder.java | 1 - .../handler/codec/oneone/OneToOneDecoder.java | 1 - .../handler/codec/oneone/OneToOneEncoder.java | 1 - .../ProtobufVarint32FrameDecoder.java | 1 - .../ProtobufVarint32LengthFieldPrepender.java | 1 - .../UnreplayableOperationException.java | 1 - .../netty/handler/codec/rtsp/RtspHeaders.java | 3 --- .../codec/rtsp/RtspMessageEncoder.java | 1 - .../netty/handler/codec/rtsp/RtspMethods.java | 1 - .../codec/rtsp/RtspRequestDecoder.java | 1 - .../codec/rtsp/RtspResponseDecoder.java | 1 - .../codec/rtsp/RtspResponseStatuses.java | 1 - .../handler/codec/rtsp/RtspVersions.java | 1 - .../MemoryAwareThreadPoolExecutor.java | 4 +--- .../OrderedMemoryAwareThreadPoolExecutor.java | 1 - .../handler/ipfilter/IpFilterRuleHandler.java | 1 - .../handler/ipfilter/IpFilterRuleList.java | 3 +-- .../handler/ipfilter/IpSubnetFilterRule.java | 3 +-- .../ipfilter/IpV4SubnetFilterRule.java | 3 +-- .../queue/BlockingReadTimeoutException.java | 1 - .../handler/timeout/IdleStateHandler.java | 1 - .../handler/timeout/ReadTimeoutException.java | 1 - .../handler/timeout/ReadTimeoutHandler.java | 1 - .../handler/timeout/TimeoutException.java | 1 - .../timeout/WriteTimeoutException.java | 1 - .../AbstractTrafficShapingHandler.java | 24 +++++++------------ .../netty/logging/AbstractInternalLogger.java | 1 - .../netty/util/ExternalResourceUtil.java | 1 - .../jboss/netty/util/HashedWheelTimer.java | 1 - .../util/internal/DeadLockProofWorker.java | 1 - .../netty/util/internal/ExecutorUtil.java | 1 - .../util/internal/LinkedTransferQueue.java | 1 - .../util/internal/ThreadLocalRandom.java | 1 - .../AbstractSocketServerBootstrapTest.java | 1 - .../channel/CompleteChannelFutureTest.java | 1 - .../socket/AbstractSocketEchoTest.java | 1 - .../NioServerSocketShutdownTimeTest.java | 1 - .../http/HttpTunnelServerChannelSinkTest.java | 1 - .../AbstractSocketFixedLengthEchoTest.java | 1 - .../codec/replay/ReplayingDecoderTest.java | 1 - ...tSocketCompatibleObjectStreamEchoTest.java | 1 - .../AbstractSocketObjectStreamEchoTest.java | 1 - .../string/AbstractSocketStringEchoTest.java | 1 - 85 files changed, 12 insertions(+), 114 deletions(-) diff --git a/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java b/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java index afb53a4e55..33d8380e87 100644 --- a/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java @@ -60,7 +60,6 @@ public class Bootstrap implements ExternalResourceReleasable { * I/O operation is requested. */ protected Bootstrap() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java index 788aca216c..7656230f78 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java @@ -118,7 +118,6 @@ public class ClientBootstrap extends Bootstrap { * operation is requested. */ public ClientBootstrap() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/bootstrap/ConnectionlessBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ConnectionlessBootstrap.java index 4f5d5b46e3..094fc68142 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ConnectionlessBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ConnectionlessBootstrap.java @@ -127,7 +127,6 @@ public class ConnectionlessBootstrap extends Bootstrap { * operation is requested. */ public ConnectionlessBootstrap() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java index c915a3b9a0..e4a4feb1d1 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java @@ -170,7 +170,6 @@ public class ServerBootstrap extends Bootstrap { * operation is requested. */ public ServerBootstrap() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/buffer/HeapChannelBufferFactory.java b/src/main/java/org/jboss/netty/buffer/HeapChannelBufferFactory.java index 92904a38e3..7296f8b943 100644 --- a/src/main/java/org/jboss/netty/buffer/HeapChannelBufferFactory.java +++ b/src/main/java/org/jboss/netty/buffer/HeapChannelBufferFactory.java @@ -57,7 +57,6 @@ public class HeapChannelBufferFactory extends AbstractChannelBufferFactory { * {@link ByteOrder#BIG_ENDIAN}. */ public HeapChannelBufferFactory() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/channel/AbstractChannelSink.java b/src/main/java/org/jboss/netty/channel/AbstractChannelSink.java index 79c421efbb..2ff487379a 100644 --- a/src/main/java/org/jboss/netty/channel/AbstractChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/AbstractChannelSink.java @@ -31,7 +31,6 @@ public abstract class AbstractChannelSink implements ChannelSink { * Creates a new instance. */ protected AbstractChannelSink() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/channel/ChannelException.java b/src/main/java/org/jboss/netty/channel/ChannelException.java index 295aa19d7a..1ad66dc68f 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelException.java +++ b/src/main/java/org/jboss/netty/channel/ChannelException.java @@ -33,7 +33,6 @@ public class ChannelException extends RuntimeException { * Creates a new exception. */ public ChannelException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/channel/ChannelHandlerLifeCycleException.java b/src/main/java/org/jboss/netty/channel/ChannelHandlerLifeCycleException.java index 458787aa57..a94017b2dc 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelHandlerLifeCycleException.java +++ b/src/main/java/org/jboss/netty/channel/ChannelHandlerLifeCycleException.java @@ -35,7 +35,6 @@ public class ChannelHandlerLifeCycleException extends RuntimeException { * Creates a new exception. */ public ChannelHandlerLifeCycleException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/channel/ChannelPipelineException.java b/src/main/java/org/jboss/netty/channel/ChannelPipelineException.java index 9bb88c74f9..4750298132 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelPipelineException.java +++ b/src/main/java/org/jboss/netty/channel/ChannelPipelineException.java @@ -35,7 +35,6 @@ public class ChannelPipelineException extends ChannelException { * Creates a new instance. */ public ChannelPipelineException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java index bc6d391ea5..57adf425b6 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java @@ -817,7 +817,6 @@ public class DefaultChannelPipeline implements ChannelPipeline { private static final class DiscardingChannelSink implements ChannelSink { DiscardingChannelSink() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java index 42b5fadae3..56ec90cda2 100644 --- a/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java +++ b/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java @@ -61,7 +61,6 @@ public class SimpleChannelDownstreamHandler implements ChannelDownstreamHandler * Creates a new instance. */ public SimpleChannelDownstreamHandler() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java index b81610cce6..a269780604 100644 --- a/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java +++ b/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java @@ -85,7 +85,6 @@ public class SimpleChannelHandler implements ChannelUpstreamHandler, ChannelDown * Creates a new instance. */ public SimpleChannelHandler() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java index c942b8e7d7..fe061e3fa8 100644 --- a/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java +++ b/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java @@ -65,7 +65,6 @@ public class SimpleChannelUpstreamHandler implements ChannelUpstreamHandler { * Creates a new instance. */ public SimpleChannelUpstreamHandler() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java b/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java index 421d7238d2..2fecaeafc2 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java @@ -43,7 +43,6 @@ final class LocalClientChannelSink extends AbstractChannelSink { private static final InternalLogger logger = InternalLoggerFactory.getInstance(LocalClientChannelSink.class); LocalClientChannelSink() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/channel/local/LocalServerChannelSink.java b/src/main/java/org/jboss/netty/channel/local/LocalServerChannelSink.java index 6d3ed7730d..00e6eb1a7c 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalServerChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalServerChannelSink.java @@ -36,7 +36,6 @@ import org.jboss.netty.channel.MessageEvent; final class LocalServerChannelSink extends AbstractChannelSink { LocalServerChannelSink() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannel.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannel.java index 388d61b750..34d08efdee 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannel.java @@ -103,7 +103,6 @@ public class HttpTunnelServerChannel extends AbstractServerChannel implements HttpTunnelAcceptedChannelFactory { TunnelCreator() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java index 64cf9cbe08..c0225d0c1c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java @@ -258,7 +258,6 @@ class ServerMessageSwitch implements ServerMessageSwitchUpstreamInterface, private static final class TunnelInfo { TunnelInfo() { - super(); } public String tunnelId; diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java index 96bb3e751a..276dd2c929 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java @@ -173,7 +173,6 @@ class NioClientSocketPipelineSink extends AbstractChannelSink { private final Queue registerTaskQueue = new LinkedTransferQueue(); Boss() { - super(); } void register(NioClientSocketChannel channel) { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java index 724a1f44b9..b8b7cecf64 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java @@ -260,7 +260,6 @@ class NioDatagramChannel extends AbstractChannel private final ThreadLocalBoolean notifying = new ThreadLocalBoolean(); WriteRequestQueue() { - super(); } /** @@ -330,7 +329,6 @@ class NioDatagramChannel extends AbstractChannel */ private final class WriteTask implements Runnable { WriteTask() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java index 8d794db33e..e1c966ee77 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java @@ -220,7 +220,6 @@ class NioProviderMetadata { private static final class ConstraintLevelAutodetector { ConstraintLevelAutodetector() { - super(); } int autodetect() { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java index 4e35bc17c8..f4142815ba 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java @@ -206,7 +206,6 @@ class NioSocketChannel extends AbstractChannel private final ThreadLocalBoolean notifying = new ThreadLocalBoolean(); WriteRequestQueue() { - super(); } @Override @@ -265,7 +264,6 @@ class NioSocketChannel extends AbstractChannel private final class WriteTask implements Runnable { WriteTask() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java index 237d52451c..54e10cc0ff 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java @@ -42,7 +42,6 @@ final class SocketSendBufferPool { Preallocation current = new Preallocation(DEFAULT_PREALLOCATION_SIZE); SocketSendBufferPool() { - super(); } SendBuffer acquire(Object message) { @@ -316,7 +315,6 @@ final class SocketSendBufferPool { static final class EmptySendBuffer implements SendBuffer { EmptySendBuffer() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/compression/CompressionException.java b/src/main/java/org/jboss/netty/handler/codec/compression/CompressionException.java index bacce371ca..a939cccd5a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/compression/CompressionException.java +++ b/src/main/java/org/jboss/netty/handler/codec/compression/CompressionException.java @@ -33,7 +33,6 @@ public class CompressionException extends RuntimeException { * Creates a new instance. */ public CompressionException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibUtil.java b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibUtil.java index d456c678d3..2f7c17a92e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibUtil.java +++ b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibUtil.java @@ -58,6 +58,5 @@ final class ZlibUtil { } private ZlibUtil() { - super(); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/AbstractCodecEmbedder.java b/src/main/java/org/jboss/netty/handler/codec/embedder/AbstractCodecEmbedder.java index b9e4d6c916..fd5b6d83aa 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/AbstractCodecEmbedder.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/AbstractCodecEmbedder.java @@ -194,7 +194,6 @@ abstract class AbstractCodecEmbedder implements CodecEmbedder { private final class EmbeddedChannelSink implements ChannelSink, ChannelUpstreamHandler { EmbeddedChannelSink() { - super(); } @Override @@ -234,7 +233,6 @@ abstract class AbstractCodecEmbedder implements CodecEmbedder { private static final class EmbeddedChannelPipeline extends DefaultChannelPipeline { EmbeddedChannelPipeline() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedderException.java b/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedderException.java index b49f90a550..7c82ad99ac 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedderException.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedderException.java @@ -33,7 +33,6 @@ public class CodecEmbedderException extends RuntimeException { * Creates a new instance. */ public CodecEmbedderException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannelFactory.java b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannelFactory.java index 0bab97f296..ab0c2c3a9d 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannelFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannelFactory.java @@ -29,7 +29,6 @@ class EmbeddedChannelFactory implements ChannelFactory { static final ChannelFactory INSTANCE = new EmbeddedChannelFactory(); private EmbeddedChannelFactory() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/CorruptedFrameException.java b/src/main/java/org/jboss/netty/handler/codec/frame/CorruptedFrameException.java index 7cf404b174..6be6cf415e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/CorruptedFrameException.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/CorruptedFrameException.java @@ -34,7 +34,6 @@ public class CorruptedFrameException extends Exception { * Creates a new instance. */ public CorruptedFrameException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/TooLongFrameException.java b/src/main/java/org/jboss/netty/handler/codec/frame/TooLongFrameException.java index c1aa8439b8..2714685dfb 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/TooLongFrameException.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/TooLongFrameException.java @@ -34,7 +34,6 @@ public class TooLongFrameException extends Exception { * Creates a new instance. */ public TooLongFrameException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CaseIgnoringComparator.java b/src/main/java/org/jboss/netty/handler/codec/http/CaseIgnoringComparator.java index 9cc829b469..378dba00d5 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CaseIgnoringComparator.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CaseIgnoringComparator.java @@ -31,7 +31,6 @@ final class CaseIgnoringComparator implements Comparator, Serializable { static final CaseIgnoringComparator INSTANCE = new CaseIgnoringComparator(); private CaseIgnoringComparator() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java index bd892656c2..15803c2e7e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java @@ -87,7 +87,6 @@ public class HttpClientCodec implements ChannelUpstreamHandler, private final class Encoder extends HttpRequestEncoder { Encoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java index 98dd124854..ae178e6cc8 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java @@ -72,7 +72,6 @@ class HttpCodecUtil { static final Charset DEFAULT_CHARSET = CharsetUtil.UTF_8; private HttpCodecUtil() { - super(); } static void validateHeaderName(String name) { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecoder.java index a322a71658..569cc2ecbe 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecoder.java @@ -54,7 +54,6 @@ public abstract class HttpContentDecoder extends SimpleChannelUpstreamHandler { * Creates a new instance. */ protected HttpContentDecoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentEncoder.java index c07855c9b9..a3ff8c662f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentEncoder.java @@ -61,7 +61,6 @@ public abstract class HttpContentEncoder extends SimpleChannelHandler { * Creates a new instance. */ protected HttpContentEncoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java index 7e2f2c4b41..3181c89131 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java @@ -310,7 +310,6 @@ public class HttpHeaders { public static final String WWW_AUTHENTICATE = "WWW-Authenticate"; private Names() { - super(); } } @@ -455,7 +454,6 @@ public class HttpHeaders { public static final String WEBSOCKET = "WebSocket"; private Values() { - super(); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageEncoder.java index 9ead3f1fea..4c88f1bf84 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageEncoder.java @@ -59,7 +59,6 @@ public abstract class HttpMessageEncoder extends OneToOneEncoder { * Creates a new instance. */ protected HttpMessageEncoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostBodyUtil.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostBodyUtil.java index 67d582021a..f7390795d6 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostBodyUtil.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostBodyUtil.java @@ -119,7 +119,6 @@ public class HttpPostBodyUtil { } private HttpPostBodyUtil() { - super(); } //Some commons methods between HttpPostRequestDecoder and HttpMessageDecoder diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java index 4bd451ea1e..bc411e87ed 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestDecoder.java @@ -1397,7 +1397,6 @@ public class HttpPostRequestDecoder { * */ public NotEnoughDataDecoderException() { - super(); } /** @@ -1453,7 +1452,6 @@ public class HttpPostRequestDecoder { * */ public ErrorDataDecoderException() { - super(); } /** @@ -1495,7 +1493,6 @@ public class HttpPostRequestDecoder { * */ public IncompatibleDataDecoderException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestEncoder.java index 22a9c64abf..68890d59eb 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpPostRequestEncoder.java @@ -965,7 +965,6 @@ public class HttpPostRequestEncoder implements ChunkedInput { * */ public ErrorDataEncoderException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestDecoder.java index d61be33fd4..94ba63bdd1 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestDecoder.java @@ -65,7 +65,6 @@ public class HttpRequestDecoder extends HttpMessageDecoder { * {@code maxChunkSize (8192)}. */ public HttpRequestDecoder() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestEncoder.java index 0faa35b342..31f6bab2f3 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestEncoder.java @@ -34,7 +34,6 @@ public class HttpRequestEncoder extends HttpMessageEncoder { * Creates a new instance. */ public HttpRequestEncoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseDecoder.java index e793b31c55..ff6acc8b9b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseDecoder.java @@ -94,7 +94,6 @@ public class HttpResponseDecoder extends HttpMessageDecoder { * {@code maxChunkSize (8192)}. */ public HttpResponseDecoder() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseEncoder.java index e1b4daa44e..ce5ec9a0fc 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseEncoder.java @@ -34,7 +34,6 @@ public class HttpResponseEncoder extends HttpMessageEncoder { * Creates a new instance. */ public HttpResponseEncoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneDecoder.java b/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneDecoder.java index 7f44b53fc4..e75a2e40bc 100644 --- a/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneDecoder.java @@ -57,7 +57,6 @@ public abstract class OneToOneDecoder implements ChannelUpstreamHandler { * Creates a new instance with the current system character set. */ protected OneToOneDecoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneEncoder.java b/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneEncoder.java index b14af9779c..f99d47ba45 100644 --- a/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneEncoder.java @@ -51,7 +51,6 @@ import org.jboss.netty.handler.codec.frame.Delimiters; public abstract class OneToOneEncoder implements ChannelDownstreamHandler { protected OneToOneEncoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java index bd67a91336..4befc0d812 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java @@ -53,7 +53,6 @@ public class ProtobufVarint32FrameDecoder extends FrameDecoder { * Creates a new instance. */ public ProtobufVarint32FrameDecoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java index eb4600f489..b5d3129fe2 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java @@ -52,7 +52,6 @@ public class ProtobufVarint32LengthFieldPrepender extends OneToOneEncoder { * Creates a new instance. */ public ProtobufVarint32LengthFieldPrepender() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/UnreplayableOperationException.java b/src/main/java/org/jboss/netty/handler/codec/replay/UnreplayableOperationException.java index 3cbeb4c665..ba547feb6b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/UnreplayableOperationException.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/UnreplayableOperationException.java @@ -35,7 +35,6 @@ public class UnreplayableOperationException extends * Creates a new instance. */ public UnreplayableOperationException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspHeaders.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspHeaders.java index cb4e3c0c5f..206bd36821 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspHeaders.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspHeaders.java @@ -218,7 +218,6 @@ public final class RtspHeaders { public static final String WWW_AUTHENTICATE = HttpHeaders.Names.WWW_AUTHENTICATE; private Names() { - super(); } } @@ -400,11 +399,9 @@ public final class RtspHeaders { public static final String URL = "url"; protected Values() { - super(); } } private RtspHeaders() { - super(); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java index 2ebee6f3d9..f9f0020a45 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java @@ -40,7 +40,6 @@ public abstract class RtspMessageEncoder extends HttpMessageEncoder { * Creates a new instance. */ protected RtspMessageEncoder() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMethods.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMethods.java index 8437167dc7..3395c87076 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMethods.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMethods.java @@ -141,6 +141,5 @@ public final class RtspMethods { } private RtspMethods() { - super(); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestDecoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestDecoder.java index 2313e44c17..1fae71db12 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestDecoder.java @@ -61,7 +61,6 @@ public class RtspRequestDecoder extends RtspMessageDecoder { * {@code maxContentLength (8192)}. */ public RtspRequestDecoder() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseDecoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseDecoder.java index 7f7dd15016..423dd687bb 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseDecoder.java @@ -62,7 +62,6 @@ public class RtspResponseDecoder extends RtspMessageDecoder { * {@code maxContentLength (8192)}. */ public RtspResponseDecoder() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseStatuses.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseStatuses.java index c8d39871fd..208b0c6c57 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseStatuses.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseStatuses.java @@ -295,6 +295,5 @@ public final class RtspResponseStatuses { } private RtspResponseStatuses() { - super(); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspVersions.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspVersions.java index 48e1467cee..2e0180d4e0 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspVersions.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspVersions.java @@ -54,6 +54,5 @@ public final class RtspVersions { } private RtspVersions() { - super(); } } diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index d7714806c0..ca849d532a 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -500,7 +500,6 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { private static final class NewThreadRunsPolicy implements RejectedExecutionHandler { NewThreadRunsPolicy() { - super(); } @Override @@ -537,8 +536,7 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { private int waiters; Limiter(long limit) { - super(); - this.limit = limit; + this.limit = limit; } synchronized void increase(long amount) { diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java index 52306b76bb..6d03fb029c 100644 --- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java @@ -287,7 +287,6 @@ public class OrderedMemoryAwareThreadPoolExecutor extends private final LinkedList tasks = new LinkedList(); ChildExecutor() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRuleHandler.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRuleHandler.java index a9c35c5ebb..094af3d256 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRuleHandler.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRuleHandler.java @@ -82,7 +82,6 @@ public class IpFilterRuleHandler extends IpFilteringHandlerImpl */ public IpFilterRuleHandler() { - super(); } // Below are methods directly inspired from CopyOnWriteArrayList methods diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRuleList.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRuleList.java index 6d2a249633..a75cf92db0 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRuleList.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilterRuleList.java @@ -59,8 +59,7 @@ public class IpFilterRuleList extends ArrayList */ public IpFilterRuleList(String rules) { - super(); - parseRules(rules); + parseRules(rules); } private void parseRules(String rules) diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpSubnetFilterRule.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpSubnetFilterRule.java index e197ae1fff..70a82edcdb 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpSubnetFilterRule.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpSubnetFilterRule.java @@ -39,8 +39,7 @@ public class IpSubnetFilterRule extends IpSubnet implements IpFilterRule */ public IpSubnetFilterRule(boolean allow) { - super(); - isAllowRule = allow; + isAllowRule = allow; } /** diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpV4SubnetFilterRule.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpV4SubnetFilterRule.java index 5705d97dcb..7d6f1c3aa6 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpV4SubnetFilterRule.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpV4SubnetFilterRule.java @@ -36,8 +36,7 @@ public class IpV4SubnetFilterRule extends IpV4Subnet implements IpFilterRule */ public IpV4SubnetFilterRule(boolean allow) { - super(); - isAllowRule = allow; + isAllowRule = allow; } /** diff --git a/src/main/java/org/jboss/netty/handler/queue/BlockingReadTimeoutException.java b/src/main/java/org/jboss/netty/handler/queue/BlockingReadTimeoutException.java index 04d4b7ba84..d265e41a45 100644 --- a/src/main/java/org/jboss/netty/handler/queue/BlockingReadTimeoutException.java +++ b/src/main/java/org/jboss/netty/handler/queue/BlockingReadTimeoutException.java @@ -34,7 +34,6 @@ public class BlockingReadTimeoutException extends InterruptedIOException { * Creates a new instance. */ public BlockingReadTimeoutException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleStateHandler.java b/src/main/java/org/jboss/netty/handler/timeout/IdleStateHandler.java index 705a0bf1d0..6392949450 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleStateHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleStateHandler.java @@ -443,7 +443,6 @@ public class IdleStateHandler extends SimpleChannelUpstreamHandler private static final class State { State() { - super(); } volatile Timeout readerIdleTimeout; diff --git a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutException.java b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutException.java index fc8d0d4f95..6cf2f5152f 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutException.java +++ b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutException.java @@ -31,7 +31,6 @@ public class ReadTimeoutException extends TimeoutException { * Creates a new instance. */ public ReadTimeoutException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java index 7b1d962c0c..486b0f22c2 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java @@ -259,7 +259,6 @@ public class ReadTimeoutHandler extends SimpleChannelUpstreamHandler volatile long lastReadTime = System.currentTimeMillis(); State() { - super(); } } } diff --git a/src/main/java/org/jboss/netty/handler/timeout/TimeoutException.java b/src/main/java/org/jboss/netty/handler/timeout/TimeoutException.java index 69410b8c79..82dfb2f884 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/TimeoutException.java +++ b/src/main/java/org/jboss/netty/handler/timeout/TimeoutException.java @@ -33,7 +33,6 @@ public class TimeoutException extends ChannelException { * Creates a new instance. */ public TimeoutException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutException.java b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutException.java index de81778cee..9bdf89f20c 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutException.java +++ b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutException.java @@ -32,7 +32,6 @@ public class WriteTimeoutException extends TimeoutException { * Creates a new instance. */ public WriteTimeoutException() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java b/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java index 6f4f4aaf52..f980dcf512 100644 --- a/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java +++ b/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java @@ -154,8 +154,7 @@ public abstract class AbstractTrafficShapingHandler extends */ public AbstractTrafficShapingHandler(Executor executor, long writeLimit, long readLimit, long checkInterval) { - super(); - init(new DefaultObjectSizeEstimator(), executor, writeLimit, readLimit, + init(new DefaultObjectSizeEstimator(), executor, writeLimit, readLimit, checkInterval); } @@ -178,8 +177,7 @@ public abstract class AbstractTrafficShapingHandler extends public AbstractTrafficShapingHandler( ObjectSizeEstimator objectSizeEstimator, Executor executor, long writeLimit, long readLimit, long checkInterval) { - super(); - init(objectSizeEstimator, executor, writeLimit, readLimit, + init(objectSizeEstimator, executor, writeLimit, readLimit, checkInterval); } @@ -195,8 +193,7 @@ public abstract class AbstractTrafficShapingHandler extends */ public AbstractTrafficShapingHandler(Executor executor, long writeLimit, long readLimit) { - super(); - init(new DefaultObjectSizeEstimator(), executor, writeLimit, readLimit, + init(new DefaultObjectSizeEstimator(), executor, writeLimit, readLimit, DEFAULT_CHECK_INTERVAL); } @@ -216,8 +213,7 @@ public abstract class AbstractTrafficShapingHandler extends public AbstractTrafficShapingHandler( ObjectSizeEstimator objectSizeEstimator, Executor executor, long writeLimit, long readLimit) { - super(); - init(objectSizeEstimator, executor, writeLimit, readLimit, + init(objectSizeEstimator, executor, writeLimit, readLimit, DEFAULT_CHECK_INTERVAL); } @@ -228,8 +224,7 @@ public abstract class AbstractTrafficShapingHandler extends * created for instance like Executors.newCachedThreadPool */ public AbstractTrafficShapingHandler(Executor executor) { - super(); - init(new DefaultObjectSizeEstimator(), executor, 0, 0, + init(new DefaultObjectSizeEstimator(), executor, 0, 0, DEFAULT_CHECK_INTERVAL); } @@ -244,8 +239,7 @@ public abstract class AbstractTrafficShapingHandler extends */ public AbstractTrafficShapingHandler( ObjectSizeEstimator objectSizeEstimator, Executor executor) { - super(); - init(objectSizeEstimator, executor, 0, 0, DEFAULT_CHECK_INTERVAL); + init(objectSizeEstimator, executor, 0, 0, DEFAULT_CHECK_INTERVAL); } /** @@ -258,8 +252,7 @@ public abstract class AbstractTrafficShapingHandler extends * channels or 0 if no stats are to be computed */ public AbstractTrafficShapingHandler(Executor executor, long checkInterval) { - super(); - init(new DefaultObjectSizeEstimator(), executor, 0, 0, checkInterval); + init(new DefaultObjectSizeEstimator(), executor, 0, 0, checkInterval); } /** @@ -277,8 +270,7 @@ public abstract class AbstractTrafficShapingHandler extends public AbstractTrafficShapingHandler( ObjectSizeEstimator objectSizeEstimator, Executor executor, long checkInterval) { - super(); - init(objectSizeEstimator, executor, 0, 0, checkInterval); + init(objectSizeEstimator, executor, 0, 0, checkInterval); } /** diff --git a/src/main/java/org/jboss/netty/logging/AbstractInternalLogger.java b/src/main/java/org/jboss/netty/logging/AbstractInternalLogger.java index 02437e1c15..84d6bb27d7 100644 --- a/src/main/java/org/jboss/netty/logging/AbstractInternalLogger.java +++ b/src/main/java/org/jboss/netty/logging/AbstractInternalLogger.java @@ -30,7 +30,6 @@ public abstract class AbstractInternalLogger implements InternalLogger { * Creates a new instance. */ protected AbstractInternalLogger() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/util/ExternalResourceUtil.java b/src/main/java/org/jboss/netty/util/ExternalResourceUtil.java index 1bbf823f19..cf154b7fad 100644 --- a/src/main/java/org/jboss/netty/util/ExternalResourceUtil.java +++ b/src/main/java/org/jboss/netty/util/ExternalResourceUtil.java @@ -45,6 +45,5 @@ public class ExternalResourceUtil { } private ExternalResourceUtil() { - super(); } } diff --git a/src/main/java/org/jboss/netty/util/HashedWheelTimer.java b/src/main/java/org/jboss/netty/util/HashedWheelTimer.java index 7c5f8114e8..53d056c65f 100644 --- a/src/main/java/org/jboss/netty/util/HashedWheelTimer.java +++ b/src/main/java/org/jboss/netty/util/HashedWheelTimer.java @@ -362,7 +362,6 @@ public class HashedWheelTimer implements Timer { private long tick; Worker() { - super(); } @Override diff --git a/src/main/java/org/jboss/netty/util/internal/DeadLockProofWorker.java b/src/main/java/org/jboss/netty/util/internal/DeadLockProofWorker.java index 1fc3f6ac3f..48593af238 100644 --- a/src/main/java/org/jboss/netty/util/internal/DeadLockProofWorker.java +++ b/src/main/java/org/jboss/netty/util/internal/DeadLockProofWorker.java @@ -51,6 +51,5 @@ public final class DeadLockProofWorker { } private DeadLockProofWorker() { - super(); } } diff --git a/src/main/java/org/jboss/netty/util/internal/ExecutorUtil.java b/src/main/java/org/jboss/netty/util/internal/ExecutorUtil.java index 08409b7f22..b6355fcfba 100644 --- a/src/main/java/org/jboss/netty/util/internal/ExecutorUtil.java +++ b/src/main/java/org/jboss/netty/util/internal/ExecutorUtil.java @@ -119,6 +119,5 @@ public class ExecutorUtil { } private ExecutorUtil() { - super(); } } diff --git a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java index 8bbf3ae97d..57149985ca 100644 --- a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java +++ b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java @@ -1031,7 +1031,6 @@ public class LinkedTransferQueue extends AbstractQueue * Creates an initially empty {@code LinkedTransferQueue}. */ public LinkedTransferQueue() { - super(); } /** diff --git a/src/main/java/org/jboss/netty/util/internal/ThreadLocalRandom.java b/src/main/java/org/jboss/netty/util/internal/ThreadLocalRandom.java index 10832d306b..67529f3d20 100644 --- a/src/main/java/org/jboss/netty/util/internal/ThreadLocalRandom.java +++ b/src/main/java/org/jboss/netty/util/internal/ThreadLocalRandom.java @@ -90,7 +90,6 @@ final class ThreadLocalRandom extends Random { * invokes setSeed exactly once to initialize. */ ThreadLocalRandom() { - super(); } /** diff --git a/src/test/java/org/jboss/netty/bootstrap/AbstractSocketServerBootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/AbstractSocketServerBootstrapTest.java index 3740903678..3d7a5845b5 100644 --- a/src/test/java/org/jboss/netty/bootstrap/AbstractSocketServerBootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/AbstractSocketServerBootstrapTest.java @@ -207,7 +207,6 @@ public abstract class AbstractSocketServerBootstrapTest { final StringBuffer result = new StringBuffer(); ParentChannelHandler() { - super(); } @Override diff --git a/src/test/java/org/jboss/netty/channel/CompleteChannelFutureTest.java b/src/test/java/org/jboss/netty/channel/CompleteChannelFutureTest.java index 7ac070df28..b94082f075 100644 --- a/src/test/java/org/jboss/netty/channel/CompleteChannelFutureTest.java +++ b/src/test/java/org/jboss/netty/channel/CompleteChannelFutureTest.java @@ -113,7 +113,6 @@ public class CompleteChannelFutureTest { private static final long serialVersionUID = 7059276744882005047L; ExpectedError() { - super(); } } } diff --git a/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java b/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java index da0040889f..0a5427a0ae 100644 --- a/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java @@ -153,7 +153,6 @@ public abstract class AbstractSocketEchoTest { volatile int counter; EchoHandler() { - super(); } @Override diff --git a/src/test/java/org/jboss/netty/channel/socket/NioServerSocketShutdownTimeTest.java b/src/test/java/org/jboss/netty/channel/socket/NioServerSocketShutdownTimeTest.java index ddfb487d38..0b0338f762 100644 --- a/src/test/java/org/jboss/netty/channel/socket/NioServerSocketShutdownTimeTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/NioServerSocketShutdownTimeTest.java @@ -97,7 +97,6 @@ public class NioServerSocketShutdownTimeTest { volatile boolean closed; DummyHandler() { - super(); } @Override diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java index 57b0030703..3fb7dd9e9a 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java @@ -147,7 +147,6 @@ public class HttpTunnelServerChannelSinkTest { private final class ExceptionCatcher extends SimpleChannelUpstreamHandler { ExceptionCatcher() { - super(); } @Override diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java index cca5dfd8f5..24cd4b148a 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java @@ -155,7 +155,6 @@ public abstract class AbstractSocketFixedLengthEchoTest { volatile int counter; EchoHandler() { - super(); } @Override diff --git a/src/test/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderTest.java index e18ed74c40..17ca8dba51 100644 --- a/src/test/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderTest.java @@ -57,7 +57,6 @@ public class ReplayingDecoderTest { private static final class LineDecoder extends ReplayingDecoder { LineDecoder() { - super(); } @Override diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java index 0aa8717dbf..cf987f4873 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java @@ -163,7 +163,6 @@ public abstract class AbstractSocketCompatibleObjectStreamEchoTest { volatile int counter; EchoHandler() { - super(); } @Override diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java index 32c511d1b2..9260c861b9 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java @@ -162,7 +162,6 @@ public abstract class AbstractSocketObjectStreamEchoTest { volatile int counter; EchoHandler() { - super(); } @Override diff --git a/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java index 786200804a..a8c2c319e0 100644 --- a/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java @@ -168,7 +168,6 @@ public abstract class AbstractSocketStringEchoTest { volatile int counter; EchoHandler() { - super(); } @Override From ab6109057252055aa7800ca9cfe15274f55aea5f Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sat, 12 Nov 2011 13:23:40 -0500 Subject: [PATCH 42/93] Simplify redundant 'if' statements. --- .../netty/example/localtime/LocalTimeProtocol.java | 14 +++----------- .../netty/handler/codec/http/DefaultCookie.java | 6 +----- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java index 7946fef1a8..8628f34d64 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java @@ -225,15 +225,10 @@ public final class LocalTimeProtocol { private void initFields() { continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; } + @Override public boolean isInitialized() { - if (!hasContinent) { - return false; - } - if (!hasCity) { - return false; - } - return true; + return hasContinent && hasCity; } @Override @@ -1000,10 +995,7 @@ public final class LocalTimeProtocol { if (!hasMinute) { return false; } - if (!hasSecond) { - return false; - } - return true; + return hasSecond; } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java index 90fdf70dfa..d938b21069 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java @@ -288,11 +288,7 @@ public class DefaultCookie implements Cookie { } else if (that.getDomain() == null) { return false; } - if (!getDomain().equalsIgnoreCase(that.getDomain())) { - return false; - } - - return true; + return getDomain().equalsIgnoreCase(that.getDomain()); } @Override From b6dc30b37ba27490be767da972a666274ec7e1c9 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Sat, 12 Nov 2011 13:25:27 -0500 Subject: [PATCH 43/93] Inline redundant local variables. --- .../java/org/jboss/netty/buffer/ChannelBuffers.java | 3 +-- .../jboss/netty/channel/group/CombinedIterator.java | 3 +-- .../channel/socket/http/HttpTunnelMessageUtils.java | 4 +--- .../netty/handler/codec/http/MixedAttribute.java | 12 +++--------- .../netty/handler/codec/http/MixedFileUpload.java | 9 +++------ .../http/websocketx/WebSocketClientHandshaker.java | 3 +-- .../codec/serialization/CompatibleObjectEncoder.java | 3 +-- .../handler/ipfilter/IpFilteringHandlerImpl.java | 6 ++---- .../traffic/AbstractTrafficShapingHandler.java | 3 +-- .../org/jboss/netty/util/internal/jzlib/Deflate.java | 12 +++++------- .../socket/http/HttpTunnelServerChannelSinkTest.java | 6 ++---- 11 files changed, 21 insertions(+), 43 deletions(-) diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java b/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java index 02f27d2af3..673e1b3fbd 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java @@ -804,8 +804,7 @@ public class ChannelBuffers { } private static ChannelBuffer copiedBuffer(ByteOrder endianness, CharBuffer buffer, Charset charset) { - CharBuffer src = buffer; - ByteBuffer dst = ChannelBuffers.encodeString(src, charset); + ByteBuffer dst = ChannelBuffers.encodeString(buffer, charset); ChannelBuffer result = wrappedBuffer(endianness, dst.array()); result.writerIndex(dst.remaining()); return result; diff --git a/src/main/java/org/jboss/netty/channel/group/CombinedIterator.java b/src/main/java/org/jboss/netty/channel/group/CombinedIterator.java index 82f589925d..0feb943ecf 100644 --- a/src/main/java/org/jboss/netty/channel/group/CombinedIterator.java +++ b/src/main/java/org/jboss/netty/channel/group/CombinedIterator.java @@ -59,8 +59,7 @@ final class CombinedIterator implements Iterator { @Override public E next() { try { - E e = currentIterator.next(); - return e; + return currentIterator.next(); } catch (NoSuchElementException e) { if (currentIterator == i1) { currentIterator = i2; diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelMessageUtils.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelMessageUtils.java index 54ed0812f9..736fe28df3 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelMessageUtils.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelMessageUtils.java @@ -252,9 +252,7 @@ public class HttpTunnelMessageUtils { } public static HttpResponse createTunnelCloseResponse() { - HttpResponse response = - createResponseTemplate(HttpResponseStatus.RESET_CONTENT, null); - return response; + return createResponseTemplate(HttpResponseStatus.RESET_CONTENT, null); } public static boolean isTunnelCloseResponse(HttpResponse response) { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/MixedAttribute.java b/src/main/java/org/jboss/netty/handler/codec/http/MixedAttribute.java index 4bad8f9c03..8a70125c68 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/MixedAttribute.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/MixedAttribute.java @@ -143,9 +143,7 @@ public class MixedAttribute implements Attribute { if (buffer.readableBytes() > limitSize) { if (attribute instanceof MemoryAttribute) { // change to Disk - DiskAttribute diskAttribute = new DiskAttribute(attribute - .getName()); - attribute = diskAttribute; + attribute = new DiskAttribute(attribute.getName()); } } attribute.setContent(buffer); @@ -156,9 +154,7 @@ public class MixedAttribute implements Attribute { if (file.length() > limitSize) { if (attribute instanceof MemoryAttribute) { // change to Disk - DiskAttribute diskAttribute = new DiskAttribute(attribute - .getName()); - attribute = diskAttribute; + attribute = new DiskAttribute(attribute.getName()); } } attribute.setContent(file); @@ -168,9 +164,7 @@ public class MixedAttribute implements Attribute { public void setContent(InputStream inputStream) throws IOException { if (attribute instanceof MemoryAttribute) { // change to Disk even if we don't know the size - DiskAttribute diskAttribute = new DiskAttribute(attribute - .getName()); - attribute = diskAttribute; + attribute = new DiskAttribute(attribute.getName()); } attribute.setContent(inputStream); } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/MixedFileUpload.java b/src/main/java/org/jboss/netty/handler/codec/http/MixedFileUpload.java index 51994ff267..8c7df5e4ed 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/MixedFileUpload.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/MixedFileUpload.java @@ -147,12 +147,11 @@ public class MixedFileUpload implements FileUpload { if (buffer.readableBytes() > limitSize) { if (fileUpload instanceof MemoryFileUpload) { // change to Disk - DiskFileUpload diskFileUpload = new DiskFileUpload(fileUpload + fileUpload = new DiskFileUpload(fileUpload .getName(), fileUpload.getFilename(), fileUpload .getContentType(), fileUpload .getContentTransferEncoding(), fileUpload.getCharset(), definedSize); - fileUpload = diskFileUpload; } } fileUpload.setContent(buffer); @@ -163,12 +162,11 @@ public class MixedFileUpload implements FileUpload { if (file.length() > limitSize) { if (fileUpload instanceof MemoryFileUpload) { // change to Disk - DiskFileUpload diskFileUpload = new DiskFileUpload(fileUpload + fileUpload = new DiskFileUpload(fileUpload .getName(), fileUpload.getFilename(), fileUpload .getContentType(), fileUpload .getContentTransferEncoding(), fileUpload.getCharset(), definedSize); - fileUpload = diskFileUpload; } } fileUpload.setContent(file); @@ -178,12 +176,11 @@ public class MixedFileUpload implements FileUpload { public void setContent(InputStream inputStream) throws IOException { if (fileUpload instanceof MemoryFileUpload) { // change to Disk - DiskFileUpload diskFileUpload = new DiskFileUpload(fileUpload + fileUpload = new DiskFileUpload(fileUpload .getName(), fileUpload.getFilename(), fileUpload .getContentType(), fileUpload .getContentTransferEncoding(), fileUpload.getCharset(), definedSize); - fileUpload = diskFileUpload; } fileUpload.setContent(inputStream); } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java index d40ea276ff..c362dba8d5 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java @@ -204,7 +204,6 @@ public abstract class WebSocketClientHandshaker { * @return Random number */ protected int createRandomNumber(int min, int max) { - int rand = (int) (Math.random() * max + min); - return rand; + return (int) (Math.random() * max + min); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectEncoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectEncoder.java index 6395898b9c..f2399281b1 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectEncoder.java @@ -98,8 +98,7 @@ public class CompatibleObjectEncoder extends OneToOneEncoder { oout.writeObject(msg); oout.flush(); - ChannelBuffer encoded = buffer.readBytes(buffer.readableBytes()); - return encoded; + return buffer.readBytes(buffer.readableBytes()); } private ChannelBuffer buffer(ChannelHandlerContext ctx) throws Exception { diff --git a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandlerImpl.java b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandlerImpl.java index 1768321f1a..b2c8d12fe1 100644 --- a/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandlerImpl.java +++ b/src/main/java/org/jboss/netty/handler/ipfilter/IpFilteringHandlerImpl.java @@ -66,8 +66,7 @@ public abstract class IpFilteringHandlerImpl implements ChannelUpstreamHandler, { if (listener == null) return null; - ChannelFuture result = listener.refused(ctx, e, inetSocketAddress); - return result; + return listener.refused(ctx, e, inetSocketAddress); } protected ChannelFuture handleAllowedChannel(ChannelHandlerContext ctx, ChannelEvent e, @@ -75,8 +74,7 @@ public abstract class IpFilteringHandlerImpl implements ChannelUpstreamHandler, { if (listener == null) return null; - ChannelFuture result = listener.allowed(ctx, e, inetSocketAddress); - return result; + return listener.allowed(ctx, e, inetSocketAddress); } /** diff --git a/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java b/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java index f980dcf512..f22439f2ca 100644 --- a/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java +++ b/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java @@ -385,8 +385,7 @@ public abstract class AbstractTrafficShapingHandler extends // Time is too short, so just lets continue return 0; } - long wait = bytes * 1000 / limit - interval; - return wait; + return bytes * 1000 / limit - interval; } @Override diff --git a/src/main/java/org/jboss/netty/util/internal/jzlib/Deflate.java b/src/main/java/org/jboss/netty/util/internal/jzlib/Deflate.java index 62eedc8a50..d463eb54e8 100644 --- a/src/main/java/org/jboss/netty/util/internal/jzlib/Deflate.java +++ b/src/main/java/org/jboss/netty/util/internal/jzlib/Deflate.java @@ -519,18 +519,16 @@ final class Deflate { } private void send_bits(int value, int length) { - int len = length; - if (bi_valid > Buf_size - len) { - int val = value; + if (bi_valid > Buf_size - length) { // bi_buf |= (val << bi_valid); - bi_buf |= val << bi_valid & 0xffff; + bi_buf |= value << bi_valid & 0xffff; put_short(bi_buf); - bi_buf = (short) (val >>> Buf_size - bi_valid); - bi_valid += len - Buf_size; + bi_buf = (short) (value >>> Buf_size - bi_valid); + bi_valid += length - Buf_size; } else { // bi_buf |= (value) << bi_valid; bi_buf |= value << bi_valid & 0xffff; - bi_valid += len; + bi_valid += length; } } diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java index 3fb7dd9e9a..7c949cf6a8 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java @@ -83,9 +83,8 @@ public class HttpTunnelServerChannelSinkTest { } }); - ChannelFuture virtualFuture1 = Channels.close(channel); + ChannelFuture virtualFuture = Channels.close(channel); mockContext.assertIsSatisfied(); - ChannelFuture virtualFuture = virtualFuture1; realFuture.setSuccess(); assertTrue(virtualFuture.isSuccess()); } @@ -140,8 +139,7 @@ public class HttpTunnelServerChannelSinkTest { } }); - ChannelFuture virtualFuture = Channels.bind(channel, toAddress); - return virtualFuture; + return Channels.bind(channel, toAddress); } private final class ExceptionCatcher extends SimpleChannelUpstreamHandler { From 3b0eb64f1c3160c2029c4cb3defa5953241bbf28 Mon Sep 17 00:00:00 2001 From: Veebs Date: Sun, 13 Nov 2011 12:38:18 +1100 Subject: [PATCH 44/93] WebSocket Server with SSL example app --- .../sslserver/WebSocketSslServer.java | 74 +++++++++ .../sslserver/WebSocketSslServerHandler.java | 152 ++++++++++++++++++ .../WebSocketSslServerIndexPage.java | 73 +++++++++ .../WebSocketSslServerPipelineFactory.java | 52 ++++++ .../WebSocketSslServerSslContext.java | 111 +++++++++++++ .../websocketx/sslserver/package-info.java | 39 +++++ 6 files changed, 501 insertions(+) create mode 100644 src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java create mode 100644 src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java create mode 100644 src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java create mode 100644 src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerPipelineFactory.java create mode 100644 src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java create mode 100644 src/main/java/org/jboss/netty/example/http/websocketx/sslserver/package-info.java diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java new file mode 100644 index 0000000000..3fe4a60c5e --- /dev/null +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java @@ -0,0 +1,74 @@ +/* + * Copyright 2010 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.example.http.websocketx.sslserver; + +import java.net.InetSocketAddress; +import java.util.concurrent.Executors; +import java.util.logging.ConsoleHandler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.jboss.netty.bootstrap.ServerBootstrap; +import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; + +/** + * A HTTP server which serves Web Socket requests at: + * + * https://localhost:8081/websocket + * + * Open your browser at https://localhost:8081/, then the demo page will be + * loaded and a Web Socket connection will be made automatically. + * + * This server illustrates support for the different web socket specification + * versions and will work with: + * + *

    + *
  • Safari 5+ (draft-ietf-hybi-thewebsocketprotocol-00) + *
  • + *
  • Chrome 6-13 (draft-ietf-hybi-thewebsocketprotocol-00) + *
  • + *
  • Chrome 14+ (draft-ietf-hybi-thewebsocketprotocol-10) + *
  • + *
  • Firefox 7+ (draft-ietf-hybi-thewebsocketprotocol-10) + *
  • + *
+ * + * @author The Netty Project + * @author Trustin Lee + * @author Vibul Imtarnasan + * + * @version $Rev$, $Date$ + */ +public class WebSocketSslServer { + public static void main(String[] args) { + ConsoleHandler ch = new ConsoleHandler(); + ch.setLevel(Level.FINE); + Logger.getLogger("").addHandler(ch); + Logger.getLogger("").setLevel(Level.FINE); + + // Configure the server. + ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory( + Executors.newCachedThreadPool(), Executors.newCachedThreadPool())); + + // Set up the event pipeline factory. + bootstrap.setPipelineFactory(new WebSocketSslServerPipelineFactory()); + + // Bind and start to accept incoming connections. + bootstrap.bind(new InetSocketAddress(8081)); + + System.out.println("Web Socket Server started on 8081. Open your browser and navigate to https://localhost:8081/"); + } +} diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java new file mode 100644 index 0000000000..9b3875b1da --- /dev/null +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java @@ -0,0 +1,152 @@ +/* + * Copyright 2010 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.example.http.websocketx.sslserver; + +import static org.jboss.netty.handler.codec.http.HttpHeaders.*; +import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.*; +import static org.jboss.netty.handler.codec.http.HttpMethod.*; +import static org.jboss.netty.handler.codec.http.HttpResponseStatus.*; +import static org.jboss.netty.handler.codec.http.HttpVersion.*; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelFutureListener; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ExceptionEvent; +import org.jboss.netty.channel.MessageEvent; +import org.jboss.netty.channel.SimpleChannelUpstreamHandler; +import org.jboss.netty.handler.codec.http.DefaultHttpResponse; +import org.jboss.netty.handler.codec.http.HttpHeaders; +import org.jboss.netty.handler.codec.http.HttpRequest; +import org.jboss.netty.handler.codec.http.HttpResponse; +import org.jboss.netty.handler.codec.http.websocketx.CloseWebSocketFrame; +import org.jboss.netty.handler.codec.http.websocketx.PingWebSocketFrame; +import org.jboss.netty.handler.codec.http.websocketx.PongWebSocketFrame; +import org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame; +import org.jboss.netty.handler.codec.http.websocketx.WebSocketFrame; +import org.jboss.netty.handler.codec.http.websocketx.WebSocketServerHandshaker; +import org.jboss.netty.handler.codec.http.websocketx.WebSocketServerHandshakerFactory; +import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; +import org.jboss.netty.util.CharsetUtil; + +/** + * Handles handshakes and messages + * + * @author The Netty Project + * @author Trustin Lee + * @author Vibul Imtarnasan + * + * @version $Rev$, $Date$ + */ +public class WebSocketSslServerHandler extends SimpleChannelUpstreamHandler { + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketSslServerHandler.class); + + private static final String WEBSOCKET_PATH = "/websocket"; + + private WebSocketServerHandshaker handshaker = null; + + @Override + public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { + Object msg = e.getMessage(); + if (msg instanceof HttpRequest) { + handleHttpRequest(ctx, (HttpRequest) msg); + } else if (msg instanceof WebSocketFrame) { + handleWebSocketFrame(ctx, (WebSocketFrame) msg); + } + } + + private void handleHttpRequest(ChannelHandlerContext ctx, HttpRequest req) throws Exception { + // Allow only GET methods. + if (req.getMethod() != GET) { + sendHttpResponse(ctx, req, new DefaultHttpResponse(HTTP_1_1, FORBIDDEN)); + return; + } + + // Send the demo page and favicon.ico + if (req.getUri().equals("/")) { + HttpResponse res = new DefaultHttpResponse(HTTP_1_1, OK); + + ChannelBuffer content = WebSocketSslServerIndexPage.getContent(getWebSocketLocation(req)); + + res.setHeader(CONTENT_TYPE, "text/html; charset=UTF-8"); + setContentLength(res, content.readableBytes()); + + res.setContent(content); + sendHttpResponse(ctx, req, res); + return; + } else if (req.getUri().equals("/favicon.ico")) { + HttpResponse res = new DefaultHttpResponse(HTTP_1_1, NOT_FOUND); + sendHttpResponse(ctx, req, res); + return; + } + + // Handshake + WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( + this.getWebSocketLocation(req), null, false); + this.handshaker = wsFactory.newHandshaker(ctx, req); + if (this.handshaker == null) { + wsFactory.sendUnsupportedWebSocketVersionResponse(ctx); + } else { + this.handshaker.executeOpeningHandshake(ctx, req); + } + } + + private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) { + + // Check for closing frame + if (frame instanceof CloseWebSocketFrame) { + this.handshaker.executeClosingHandshake(ctx, (CloseWebSocketFrame) frame); + return; + } else if (frame instanceof PingWebSocketFrame) { + ctx.getChannel().write(new PongWebSocketFrame(frame.getBinaryData())); + return; + } else if (!(frame instanceof TextWebSocketFrame)) { + throw new UnsupportedOperationException(String.format("%s frame types not supported", frame.getClass() + .getName())); + } + + // Send the uppercase string back. + String request = ((TextWebSocketFrame) frame).getText(); + logger.debug(String.format("Channel %s received %s", ctx.getChannel().getId(), request)); + ctx.getChannel().write(new TextWebSocketFrame(request.toUpperCase())); + } + + private void sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res) { + // Generate an error page if response status code is not OK (200). + if (res.getStatus().getCode() != 200) { + res.setContent(ChannelBuffers.copiedBuffer(res.getStatus().toString(), CharsetUtil.UTF_8)); + setContentLength(res, res.getContent().readableBytes()); + } + + // Send the response and close the connection if necessary. + ChannelFuture f = ctx.getChannel().write(res); + if (!isKeepAlive(req) || res.getStatus().getCode() != 200) { + f.addListener(ChannelFutureListener.CLOSE); + } + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { + e.getCause().printStackTrace(); + e.getChannel().close(); + } + + private String getWebSocketLocation(HttpRequest req) { + return "wss://" + req.getHeader(HttpHeaders.Names.HOST) + WEBSOCKET_PATH; + } +} diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java new file mode 100644 index 0000000000..8fe45996f9 --- /dev/null +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java @@ -0,0 +1,73 @@ +/* + * Copyright 2010 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.example.http.websocketx.sslserver; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.jboss.netty.util.CharsetUtil; + + +/** + * Generates the demo HTML page which is served at http://localhost:8080/ + * + * @author The Netty Project + * @author Trustin Lee + * @author Vibul Imtarnasan + * + * @version $Rev$, $Date$ + */ +public 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); + } +} diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerPipelineFactory.java new file mode 100644 index 0000000000..6b3e2bf9ed --- /dev/null +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerPipelineFactory.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.example.http.websocketx.sslserver; + +import static org.jboss.netty.channel.Channels.*; + +import javax.net.ssl.SSLEngine; + +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.channel.ChannelPipelineFactory; +import org.jboss.netty.handler.codec.http.HttpChunkAggregator; +import org.jboss.netty.handler.codec.http.HttpRequestDecoder; +import org.jboss.netty.handler.codec.http.HttpResponseEncoder; +import org.jboss.netty.handler.ssl.SslHandler; + +/** + * @author The Netty Project + * @author Trustin Lee + * @author Vibul Imtarnasan + * + * @version $Rev$, $Date$ + */ +public class WebSocketSslServerPipelineFactory implements ChannelPipelineFactory { + @Override + public ChannelPipeline getPipeline() throws Exception { + // Create a default pipeline implementation. + ChannelPipeline pipeline = pipeline(); + + SSLEngine engine = WebSocketSslServerSslContext.getInstance().getServerContext().createSSLEngine(); + engine.setUseClientMode(false); + pipeline.addLast("ssl", new SslHandler(engine)); + + pipeline.addLast("decoder", new HttpRequestDecoder()); + pipeline.addLast("aggregator", new HttpChunkAggregator(65536)); + pipeline.addLast("encoder", new HttpResponseEncoder()); + pipeline.addLast("handler", new WebSocketSslServerHandler()); + return pipeline; + } +} diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java new file mode 100644 index 0000000000..6b668e60dc --- /dev/null +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java @@ -0,0 +1,111 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.example.http.websocketx.sslserver; + +import java.io.FileInputStream; +import java.security.KeyStore; +import java.security.Security; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; + +import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; + +/** + * Creates a {@link SSLContext} for just server certificates. + * + * @author The Netty Project + * @author Trustin Lee + * @author Vibul Imtarnasan + * + * @version $Rev$, $Date$ + */ +public class WebSocketSslServerSslContext { + + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketSslServerSslContext.class); + private static final String PROTOCOL = "TLS"; + private SSLContext _serverContext; + + /** + * Returns the singleton instance for this class + */ + public static WebSocketSslServerSslContext getInstance() { + return SingletonHolder.INSTANCE; + } + + /** + * SingletonHolder is loaded on the first execution of + * Singleton.getInstance() or the first access to SingletonHolder.INSTANCE, + * not before. + * + * See http://en.wikipedia.org/wiki/Singleton_pattern + */ + private static class SingletonHolder { + + public static final WebSocketSslServerSslContext INSTANCE = new WebSocketSslServerSslContext(); + } + + /** + * Constructor for singleton + */ + private WebSocketSslServerSslContext() { + try { + // Key store (Server side certificate) + String algorithm = Security.getProperty("ssl.KeyManagerFactory.algorithm"); + if (algorithm == null) { + algorithm = "SunX509"; + } + + SSLContext serverContext = null; + try { + String keyStoreFilePath = System.getProperty("keystore.file.path"); + String keyStoreFilePassword = System.getProperty("keystore.file.password"); + + KeyStore ks = KeyStore.getInstance("JKS"); + FileInputStream fin = new FileInputStream(keyStoreFilePath); + ks.load(fin, keyStoreFilePassword.toCharArray()); + + // Set up key manager factory to use our key store + // Assume key password is the same as the key store file + // password + KeyManagerFactory kmf = KeyManagerFactory.getInstance(algorithm); + kmf.init(ks, keyStoreFilePassword.toCharArray()); + + // Initialise the SSLContext to work with our key managers. + serverContext = SSLContext.getInstance(PROTOCOL); + serverContext.init(kmf.getKeyManagers(), null, null); + } catch (Exception e) { + throw new Error("Failed to initialize the server-side SSLContext", e); + } + _serverContext = serverContext; + + return; + } catch (Exception ex) { + logger.error("Error initializing SslContextManager. " + ex.getMessage(), ex); + System.exit(1); + + } + } + + /** + * Returns the server context with server side key store + */ + public SSLContext getServerContext() { + return _serverContext; + } + +} diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/package-info.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/package-info.java new file mode 100644 index 0000000000..3e91cb30a8 --- /dev/null +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/package-info.java @@ -0,0 +1,39 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * Red Hat 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. + */ + +/** + *

This package contains an example web socket web server with server SSL. + *

To run this example, follow the steps below: + *

+ *
Step 1. Generate Your Key
+ *
+ * keytool -genkey -keystore mySrvKeystore -keyalg RSA. + * Make sure that you set the key password to be the same the key file password. + *
+ *
Step 2. Specify your key store file and password as system properties
+ *
+ * -Dkeystore.file.path=<path to mySrvKeystore> -Dkeystore.file.password=<password> + *
+ *
Step 3. Run WebSocketSslServer as a Java application
+ *
+ * Once started, you can test the web server against your browser by navigating to https://localhost:8081/ + *
+ *
+ *

To find out more about setting up key stores, refer to this + * giude. + */ +package org.jboss.netty.example.http.websocketx.sslserver; + From 9461b31edd6d60207a7cf2a050f6f7028430e803 Mon Sep 17 00:00:00 2001 From: Veebs Date: Sun, 13 Nov 2011 14:42:59 +1100 Subject: [PATCH 45/93] Added checks to make sure expected system properties are present. --- .../websocketx/sslserver/WebSocketSslServer.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java index 3fe4a60c5e..9915e7c35e 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java @@ -59,6 +59,18 @@ public class WebSocketSslServer { Logger.getLogger("").addHandler(ch); Logger.getLogger("").setLevel(Level.FINE); + String keyStoreFilePath = System.getProperty("keystore.file.path"); + if (keyStoreFilePath == null || keyStoreFilePath.isEmpty()) { + System.out.println("ERROR: System property keystore.file.path not set. Exiting now!"); + System.exit(1); + } + + String keyStoreFilePassword = System.getProperty("keystore.file.password"); + if (keyStoreFilePassword == null || keyStoreFilePassword.isEmpty()) { + System.out.println("ERROR: System property keystore.file.password not set. Exiting now!"); + System.exit(1); + } + // Configure the server. ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool())); From 0d0764d082b35b1b9bf3aac555abd1e18bf31957 Mon Sep 17 00:00:00 2001 From: Jeff Griffith Date: Mon, 21 Nov 2011 15:03:18 -0500 Subject: [PATCH 46/93] Allow for multiple client boss threads. --- .../nio/NioClientSocketChannelFactory.java | 28 ++++++++++++++++++- .../nio/NioClientSocketPipelineSink.java | 27 +++++++++++++++--- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java index b9f06d639d..e77bfc8640 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java @@ -88,6 +88,7 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory private final Executor bossExecutor; private final Executor workerExecutor; private final NioClientSocketPipelineSink sink; + private static final int DEFAULT_BOSS_COUNT = 1; /** * Creates a new instance. Calling this constructor is same with calling @@ -118,12 +119,36 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory public NioClientSocketChannelFactory( Executor bossExecutor, Executor workerExecutor, int workerCount) { + this(bossExecutor, workerExecutor, DEFAULT_BOSS_COUNT, workerCount); + } + + /** + * Creates a new instance. + * + * @param bossExecutor + * the {@link Executor} which will execute the boss thread + * @param workerExecutor + * the {@link Executor} which will execute the I/O worker threads + * @param bossCount + * the maximum number of boss threads + * @param workerCount + * the maximum number of I/O worker threads + */ + public NioClientSocketChannelFactory( + Executor bossExecutor, Executor workerExecutor, + int bossCount, int workerCount) { + if (bossExecutor == null) { throw new NullPointerException("bossExecutor"); } if (workerExecutor == null) { throw new NullPointerException("workerExecutor"); } + if (bossCount <= 0) { + throw new IllegalArgumentException( + "bossCount (" + bossCount + ") " + + "must be a positive integer."); + } if (workerCount <= 0) { throw new IllegalArgumentException( "workerCount (" + workerCount + ") " + @@ -132,9 +157,10 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory this.bossExecutor = bossExecutor; this.workerExecutor = workerExecutor; - sink = new NioClientSocketPipelineSink(bossExecutor, workerExecutor, workerCount); + sink = new NioClientSocketPipelineSink(bossExecutor, workerExecutor, bossCount, workerCount); } + @Override public SocketChannel newChannel(ChannelPipeline pipeline) { return NioClientSocketChannel.create(this, pipeline, sink, sink.nextWorker()); diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java index 276dd2c929..1688d8ece7 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java @@ -59,17 +59,31 @@ class NioClientSocketPipelineSink extends AbstractChannelSink { InternalLoggerFactory.getInstance(NioClientSocketPipelineSink.class); final Executor bossExecutor; - private final Boss boss = new Boss(); + private int numBosses = 1; + private final Boss bosses[]; private final NioWorker[] workers; + + private final AtomicInteger bossIndex = new AtomicInteger(); private final AtomicInteger workerIndex = new AtomicInteger(); - NioClientSocketPipelineSink( - Executor bossExecutor, Executor workerExecutor, int workerCount) { + NioClientSocketPipelineSink(Executor bossExecutor, Executor workerExecutor, int workerCount) { + this(bossExecutor, workerExecutor, 1, workerCount); + } + + NioClientSocketPipelineSink(Executor bossExecutor, Executor workerExecutor, int bossCount, int workerCount) { + this.bossExecutor = bossExecutor; + this.numBosses = bossCount; + workers = new NioWorker[workerCount]; for (int i = 0; i < workers.length; i ++) { workers[i] = new NioWorker(workerExecutor); } + + bosses = new Boss[numBosses]; + for (int i = 0; i < numBosses; ++i) { + bosses[i] = new Boss(); + } } @Override @@ -149,7 +163,7 @@ class NioClientSocketPipelineSink extends AbstractChannelSink { }); cf.addListener(ChannelFutureListener.CLOSE_ON_FAILURE); channel.connectFuture = cf; - boss.register(channel); + nextBoss().register(channel); } } catch (Throwable t) { @@ -163,6 +177,11 @@ class NioClientSocketPipelineSink extends AbstractChannelSink { return workers[Math.abs( workerIndex.getAndIncrement() % workers.length)]; } + + Boss nextBoss() { + return bosses[Math.abs( + bossIndex.getAndIncrement() % bosses.length)]; + } private final class Boss implements Runnable { From e8766c4ba6f40dec8f5b03392ac4881dad757d24 Mon Sep 17 00:00:00 2001 From: Jeff Griffith Date: Mon, 21 Nov 2011 16:08:11 -0500 Subject: [PATCH 47/93] Added default num bosses const. --- .../channel/socket/nio/NioClientSocketPipelineSink.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java index 1688d8ece7..47b43098ce 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java @@ -58,8 +58,9 @@ class NioClientSocketPipelineSink extends AbstractChannelSink { static final InternalLogger logger = InternalLoggerFactory.getInstance(NioClientSocketPipelineSink.class); + private static final int DEFAULT_BOSS_COUNT = 1; final Executor bossExecutor; - private int numBosses = 1; + private final int numBosses; private final Boss bosses[]; private final NioWorker[] workers; @@ -67,7 +68,7 @@ class NioClientSocketPipelineSink extends AbstractChannelSink { private final AtomicInteger workerIndex = new AtomicInteger(); NioClientSocketPipelineSink(Executor bossExecutor, Executor workerExecutor, int workerCount) { - this(bossExecutor, workerExecutor, 1, workerCount); + this(bossExecutor, workerExecutor, DEFAULT_BOSS_COUNT, workerCount); } NioClientSocketPipelineSink(Executor bossExecutor, Executor workerExecutor, int bossCount, int workerCount) { From 1ac6c75d39114a89dcc13cd712eb907b9938c2d8 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Tue, 22 Nov 2011 16:32:01 +0900 Subject: [PATCH 48/93] Clean up * Static variables should come before member fields * Removed unused members --- .../nio/NioClientSocketChannelFactory.java | 25 +++++++++++-------- .../nio/NioClientSocketPipelineSink.java | 24 ++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java index e77bfc8640..3711be7c81 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java @@ -85,36 +85,40 @@ import org.jboss.netty.util.internal.ExecutorUtil; */ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory { + private static final int DEFAULT_BOSS_COUNT = 1; + private final Executor bossExecutor; private final Executor workerExecutor; private final NioClientSocketPipelineSink sink; - private static final int DEFAULT_BOSS_COUNT = 1; /** * Creates a new instance. Calling this constructor is same with calling - * {@link #NioClientSocketChannelFactory(Executor, Executor, int)} with 2 * - * the number of available processors in the machine. The number of + * {@link #NioClientSocketChannelFactory(Executor, Executor, int, int)} with + * 1 and (2 * the number of available processors in the machine) for + * bossCount and workerCount respectively. The number of * available processors is obtained by {@link Runtime#availableProcessors()}. * * @param bossExecutor * the {@link Executor} which will execute the boss thread * @param workerExecutor - * the {@link Executor} which will execute the I/O worker threads + * the {@link Executor} which will execute the worker threads */ public NioClientSocketChannelFactory( Executor bossExecutor, Executor workerExecutor) { - this(bossExecutor, workerExecutor, SelectorUtil.DEFAULT_IO_THREADS); + this(bossExecutor, workerExecutor, DEFAULT_BOSS_COUNT, SelectorUtil.DEFAULT_IO_THREADS); } /** - * Creates a new instance. + * Creates a new instance. Calling this constructor is same with calling + * {@link #NioClientSocketChannelFactory(Executor, Executor, int, int)} with + * 1 as bossCount. * * @param bossExecutor * the {@link Executor} which will execute the boss thread * @param workerExecutor - * the {@link Executor} which will execute the I/O worker threads + * the {@link Executor} which will execute the worker threads * @param workerCount - * the maximum number of I/O worker threads + * the maximum number of worker threads */ public NioClientSocketChannelFactory( Executor bossExecutor, Executor workerExecutor, @@ -132,7 +136,7 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory * @param bossCount * the maximum number of boss threads * @param workerCount - * the maximum number of I/O worker threads + * the maximum number of worker threads */ public NioClientSocketChannelFactory( Executor bossExecutor, Executor workerExecutor, @@ -157,7 +161,8 @@ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory this.bossExecutor = bossExecutor; this.workerExecutor = workerExecutor; - sink = new NioClientSocketPipelineSink(bossExecutor, workerExecutor, bossCount, workerCount); + sink = new NioClientSocketPipelineSink( + bossExecutor, workerExecutor, bossCount, workerCount); } diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java index 47b43098ce..9376768569 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java @@ -58,33 +58,29 @@ class NioClientSocketPipelineSink extends AbstractChannelSink { static final InternalLogger logger = InternalLoggerFactory.getInstance(NioClientSocketPipelineSink.class); - private static final int DEFAULT_BOSS_COUNT = 1; final Executor bossExecutor; - private final int numBosses; + private final Boss bosses[]; private final NioWorker[] workers; private final AtomicInteger bossIndex = new AtomicInteger(); private final AtomicInteger workerIndex = new AtomicInteger(); - NioClientSocketPipelineSink(Executor bossExecutor, Executor workerExecutor, int workerCount) { - this(bossExecutor, workerExecutor, DEFAULT_BOSS_COUNT, workerCount); - } - - NioClientSocketPipelineSink(Executor bossExecutor, Executor workerExecutor, int bossCount, int workerCount) { + NioClientSocketPipelineSink( + Executor bossExecutor, Executor workerExecutor, + int bossCount, int workerCount) { this.bossExecutor = bossExecutor; - this.numBosses = bossCount; - + + bosses = new Boss[bossCount]; + for (int i = 0; i < bosses.length; i ++) { + bosses[i] = new Boss(); + } + workers = new NioWorker[workerCount]; for (int i = 0; i < workers.length; i ++) { workers[i] = new NioWorker(workerExecutor); } - - bosses = new Boss[numBosses]; - for (int i = 0; i < numBosses; ++i) { - bosses[i] = new Boss(); - } } @Override From 0850449b096218c1bf1c5de5e9603ff490f8efcb Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Tue, 22 Nov 2011 18:37:36 +0900 Subject: [PATCH 49/93] Consistent fail-fast property * DelimiterBasedFrameDecoder and LengthFieldBasedFrameDecoder must expose the fail-fast option consistently * Renamed failImmediatelyOnTooLongFrame to failFast --- .../frame/DelimiterBasedFrameDecoder.java | 61 ++++++++++++++----- .../frame/LengthFieldBasedFrameDecoder.java | 60 +++++++++++------- .../frame/DelimiterBasedFrameDecoderTest.java | 11 ++-- .../LengthFieldBasedFrameDecoderTest.java | 12 ++-- 4 files changed, 96 insertions(+), 48 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java index c7ea5d3a8c..03ce644b61 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java @@ -67,9 +67,9 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { private final ChannelBuffer[] delimiters; private final int maxFrameLength; private final boolean stripDelimiter; + private final boolean failFast; private boolean discardingTooLongFrame; private int tooLongFrameLength; - private final boolean failImmediatelyOnTooLongFrame; /** * Creates a new instance. @@ -95,6 +95,29 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { */ public DelimiterBasedFrameDecoder( int maxFrameLength, boolean stripDelimiter, ChannelBuffer delimiter) { + this(maxFrameLength, stripDelimiter, true, delimiter); + } + + /** + * Creates a new instance. + * + * @param maxFrameLength the maximum length of the decoded frame. + * A {@link TooLongFrameException} is thrown if + * the length of the frame exceeds this value. + * @param stripDelimiter whether the decoded frame should strip out the + * delimiter or not + * @param failFast If true, a {@link TooLongFrameException} is + * thrown as soon as the decoder notices the length of the + * frame will exceed maxFrameLength regardless of + * whether the entire frame has been read. + * If false, a {@link TooLongFrameException} is + * thrown after the entire frame that exceeds + * maxFrameLength has been read. + * @param delimiter the delimiter + */ + public DelimiterBasedFrameDecoder( + int maxFrameLength, boolean stripDelimiter, boolean failFast, + ChannelBuffer delimiter) { validateMaxFrameLength(maxFrameLength); validateDelimiter(delimiter); delimiters = new ChannelBuffer[] { @@ -103,7 +126,7 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { }; this.maxFrameLength = maxFrameLength; this.stripDelimiter = stripDelimiter; - this.failImmediatelyOnTooLongFrame = false; + this.failFast = failFast; } /** @@ -119,11 +142,18 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { } /** - * Calls {@link #DelimiterBasedFrameDecoder(int, boolean, boolean, ChannelBuffer...)} with failImmediatelyOnTooLongFrame set to false + * Creates a new instance. + * + * @param maxFrameLength the maximum length of the decoded frame. + * A {@link TooLongFrameException} is thrown if + * the length of the frame exceeds this value. + * @param stripDelimiter whether the decoded frame should strip out the + * delimiter or not + * @param delimiters the delimiters */ public DelimiterBasedFrameDecoder( int maxFrameLength, boolean stripDelimiter, ChannelBuffer... delimiters) { - this(maxFrameLength, stripDelimiter, false, delimiters); + this(maxFrameLength, stripDelimiter, true, delimiters); } /** @@ -134,16 +164,17 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { * the length of the frame exceeds this value. * @param stripDelimiter whether the decoded frame should strip out the * delimiter or not - * @param failImmediatelyOnTooLongFrame If false (the default) a {@link TooLongFrameException} - * is thrown if the length of the frame exceeds maxFrameLength, - * after the delimiter has been read. - * If true a {@link TooLongFrameException} is thrown immediately - * when the length of the frame exceeds maxFrameLength, - * regardless of whether a delimiter has been found yet. + * @param failFast If true, a {@link TooLongFrameException} is + * thrown as soon as the decoder notices the length of the + * frame will exceed maxFrameLength regardless of + * whether the entire frame has been read. + * If false, a {@link TooLongFrameException} is + * thrown after the entire frame that exceeds + * maxFrameLength has been read. * @param delimiters the delimiters */ public DelimiterBasedFrameDecoder( - int maxFrameLength, boolean stripDelimiter, boolean failImmediatelyOnTooLongFrame, ChannelBuffer... delimiters) { + int maxFrameLength, boolean stripDelimiter, boolean failFast, ChannelBuffer... delimiters) { validateMaxFrameLength(maxFrameLength); if (delimiters == null) { throw new NullPointerException("delimiters"); @@ -159,9 +190,9 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { } this.maxFrameLength = maxFrameLength; this.stripDelimiter = stripDelimiter; - this.failImmediatelyOnTooLongFrame = failImmediatelyOnTooLongFrame; + this.failFast = failFast; } - + @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { @@ -188,7 +219,7 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { int tooLongFrameLength = this.tooLongFrameLength; this.tooLongFrameLength = 0; - if (!failImmediatelyOnTooLongFrame) { + if (!failFast) { fail(ctx, tooLongFrameLength); } return null; @@ -216,7 +247,7 @@ public class DelimiterBasedFrameDecoder extends FrameDecoder { tooLongFrameLength = buffer.readableBytes(); buffer.skipBytes(buffer.readableBytes()); discardingTooLongFrame = true; - if (failImmediatelyOnTooLongFrame) { + if (failFast) { fail(ctx, tooLongFrameLength); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java index 99cb528837..4a6c3b6fca 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java @@ -195,10 +195,10 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { private final int lengthFieldEndOffset; private final int lengthAdjustment; private final int initialBytesToStrip; + private final boolean failFast; private boolean discardingTooLongFrame; private long tooLongFrameLength; private long bytesToDiscard; - private boolean failImmediatelyOnTooLongFrame = false; /** * Creates a new instance. @@ -219,7 +219,6 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { this(maxFrameLength, lengthFieldOffset, lengthFieldLength, 0, 0); } - /** * Creates a new instance. * @@ -240,6 +239,39 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip) { + this( + maxFrameLength, + lengthFieldOffset, lengthFieldLength, lengthAdjustment, + initialBytesToStrip, true); + } + + /** + * Creates a new instance. + * + * @param maxFrameLength + * the maximum length of the frame. If the length of the frame is + * greater than this value, {@link TooLongFrameException} will be + * thrown. + * @param lengthFieldOffset + * the offset of the length field + * @param lengthFieldLength + * the length of the length field + * @param lengthAdjustment + * the compensation value to add to the value of the length field + * @param initialBytesToStrip + * the number of first bytes to strip out from the decoded frame + * @param failFast + * If true, a {@link TooLongFrameException} is thrown as + * soon as the decoder notices the length of the frame will exceed + * maxFrameLength regardless of whether the entire frame + * has been read. If false, a {@link TooLongFrameException} + * is thrown after the entire frame that exceeds maxFrameLength + * has been read. + */ + public LengthFieldBasedFrameDecoder( + int maxFrameLength, + int lengthFieldOffset, int lengthFieldLength, + int lengthAdjustment, int initialBytesToStrip, boolean failFast) { if (maxFrameLength <= 0) { throw new IllegalArgumentException( "maxFrameLength must be a positive integer: " + @@ -280,6 +312,7 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { this.lengthAdjustment = lengthAdjustment; lengthFieldEndOffset = lengthFieldOffset + lengthFieldLength; this.initialBytesToStrip = initialBytesToStrip; + this.failFast = failFast; } @Override @@ -376,14 +409,14 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { long tooLongFrameLength = this.tooLongFrameLength; this.tooLongFrameLength = 0; discardingTooLongFrame = false; - if ((!failImmediatelyOnTooLongFrame) || - (failImmediatelyOnTooLongFrame && firstDetectionOfTooLongFrame)) + if ((!failFast) || + (failFast && firstDetectionOfTooLongFrame)) { fail(ctx, tooLongFrameLength); } } else { // Keep discarding and notify handlers if necessary. - if (failImmediatelyOnTooLongFrame && firstDetectionOfTooLongFrame) + if (failFast && firstDetectionOfTooLongFrame) { fail(ctx, this.tooLongFrameLength); } @@ -412,23 +445,6 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder { return frame; } - /** - * Set the behavior when a frame longer than maxFrameLength is encountered. - * - * @param failImmediatelyOnTooLongFrame If false (the default) a {@link TooLongFrameException} - * is thrown if the length of the frame exceeds maxFrameLength, - * after the entire frame has been read. - * If true a {@link TooLongFrameException} is thrown immediately - * when the length of the frame exceeds maxFrameLength, - * regardless of whether the entire frame has been read. - */ - public LengthFieldBasedFrameDecoder setFailImmediatelyOnTooLongFrame( - boolean failImmediatelyOnTooLongFrame) - { - this.failImmediatelyOnTooLongFrame = failImmediatelyOnTooLongFrame; - return this; - } - private void fail(ChannelHandlerContext ctx, long frameLength) { if (frameLength > 0) { Channels.fireExceptionCaught( diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java index 13c6506867..0d03407b61 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoderTest.java @@ -28,13 +28,14 @@ import org.junit.Test; */ public class DelimiterBasedFrameDecoderTest { @Test - public void testTooLongFrameRecovery() throws Exception { + public void testFailSlowTooLongFrameRecovery() throws Exception { DecoderEmbedder embedder = new DecoderEmbedder( - new DelimiterBasedFrameDecoder(1, Delimiters.nulDelimiter())); + new DelimiterBasedFrameDecoder(1, true, false, Delimiters.nulDelimiter())); for (int i = 0; i < 2; i ++) { + embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 1, 2 })); try { - embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 1, 2, 0 })); + embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0 })); Assert.fail(CodecEmbedderException.class.getSimpleName() + " must be raised."); } catch (CodecEmbedderException e) { Assert.assertTrue(e.getCause() instanceof TooLongFrameException); @@ -48,9 +49,9 @@ public class DelimiterBasedFrameDecoderTest { } @Test - public void testFailImmediatelyTooLongFrameRecovery() throws Exception { + public void testFailFastTooLongFrameRecovery() throws Exception { DecoderEmbedder embedder = new DecoderEmbedder( - new DelimiterBasedFrameDecoder(1, true, true, Delimiters.nulDelimiter())); + new DelimiterBasedFrameDecoder(1, Delimiters.nulDelimiter())); for (int i = 0; i < 2; i ++) { try { diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoderTest.java index b1402f3c8a..54236f5424 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoderTest.java @@ -28,13 +28,14 @@ import org.junit.Test; */ public class LengthFieldBasedFrameDecoderTest { @Test - public void testTooLongFrameRecovery() throws Exception { + public void testFailSlowTooLongFrameRecovery() throws Exception { DecoderEmbedder embedder = new DecoderEmbedder( - new LengthFieldBasedFrameDecoder(5, 0, 4, 0, 4)); + new LengthFieldBasedFrameDecoder(5, 0, 4, 0, 4, false)); for (int i = 0; i < 2; i ++) { + embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0, 0, 0, 2 })); try { - embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0, 0, 0, 2, 0, 0 })); + embedder.offer(ChannelBuffers.wrappedBuffer(new byte[] { 0, 0 })); Assert.fail(CodecEmbedderException.class.getSimpleName() + " must be raised."); } catch (CodecEmbedderException e) { Assert.assertTrue(e.getCause() instanceof TooLongFrameException); @@ -48,10 +49,9 @@ public class LengthFieldBasedFrameDecoderTest { } @Test - public void testFailImmediatelyTooLongFrameRecovery() throws Exception { + public void testFailFastTooLongFrameRecovery() throws Exception { DecoderEmbedder embedder = new DecoderEmbedder( - new LengthFieldBasedFrameDecoder(5, 0, 4, 0, 4). - setFailImmediatelyOnTooLongFrame(true)); + new LengthFieldBasedFrameDecoder(5, 0, 4, 0, 4)); for (int i = 0; i < 2; i ++) { try { From b858fab8d7cd58971dc22f9b4b1d86c260054339 Mon Sep 17 00:00:00 2001 From: alepar Date: Tue, 22 Nov 2011 15:50:52 +0400 Subject: [PATCH 50/93] loadClass() already queries the cache, so no point in redoing it in resolveClass() --- .../serialization/CompactObjectInputStream.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java index c3f1afe557..a3e2c9dbe7 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java @@ -77,21 +77,13 @@ class CompactObjectInputStream extends ObjectInputStream { @Override protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { - // Query the cache first. - String className = desc.getName(); - Class clazz = classCache.get(className); - if (clazz != null) { - return clazz; - } - - // And then try to resolve. + Class clazz; try { - clazz = loadClass(className); + clazz = loadClass(desc.getName()); } catch (ClassNotFoundException ex) { clazz = super.resolveClass(desc); } - classCache.put(className, clazz); return clazz; } From dd567e059f6d45361c4cf2734bbf670daf6f6d32 Mon Sep 17 00:00:00 2001 From: alepar Date: Tue, 22 Nov 2011 15:51:14 +0400 Subject: [PATCH 51/93] there's a more general exception in the throws list already --- .../handler/codec/serialization/CompactObjectInputStream.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java index a3e2c9dbe7..27fd6f2ada 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java @@ -46,8 +46,7 @@ class CompactObjectInputStream extends ObjectInputStream { } @Override - protected void readStreamHeader() throws IOException, - StreamCorruptedException { + protected void readStreamHeader() throws IOException { int version = readByte() & 0xFF; if (version != STREAM_VERSION) { throw new StreamCorruptedException( From c7cea76d2fb550507f87fd350bd731cbb6929f08 Mon Sep 17 00:00:00 2001 From: alepar Date: Tue, 22 Nov 2011 15:54:59 +0400 Subject: [PATCH 52/93] moving classLoader selection to constructor --- .../CompactObjectInputStream.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java index 27fd6f2ada..95c9eccec0 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java @@ -42,7 +42,11 @@ class CompactObjectInputStream extends ObjectInputStream { CompactObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException { super(in); - this.classLoader = classLoader; + if (classLoader == null) { + this.classLoader = defaultClassLoader(); + } else { + this.classLoader = classLoader; + } } @Override @@ -95,18 +99,19 @@ class CompactObjectInputStream extends ObjectInputStream { } // And then try to load. - ClassLoader classLoader = this.classLoader; - if (classLoader == null) { - classLoader = Thread.currentThread().getContextClassLoader(); - } - - if (classLoader != null) { - clazz = classLoader.loadClass(className); - } else { - clazz = Class.forName(className); - } + clazz = classLoader.loadClass(className); classCache.put(className, clazz); return clazz; } + + private static ClassLoader defaultClassLoader() { + final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + if (contextClassLoader != null) { + return contextClassLoader; + } + + return CompactObjectInputStream.class.getClassLoader(); + } + } From deb61aa0219af6693c18b702d93a0ed57d4cd4ed Mon Sep 17 00:00:00 2001 From: alepar Date: Tue, 22 Nov 2011 17:33:54 +0400 Subject: [PATCH 53/93] extracting class resolving role to separate interface --- .../serialization/CachingClassResolver.java | 31 ++++++++++++ .../codec/serialization/ClassResolver.java | 7 +++ .../codec/serialization/ClassResolvers.java | 24 ++++++++++ .../ClassloaderClassResolver.java | 16 +++++++ .../CompactObjectInputStream.java | 47 +++---------------- .../codec/serialization/ObjectDecoder.java | 12 ++--- .../ObjectDecoderInputStream.java | 2 +- 7 files changed, 91 insertions(+), 48 deletions(-) create mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/CachingClassResolver.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CachingClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CachingClassResolver.java new file mode 100644 index 0000000000..93524d5438 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CachingClassResolver.java @@ -0,0 +1,31 @@ +package org.jboss.netty.handler.codec.serialization; + +import java.util.Map; + +class CachingClassResolver implements ClassResolver { + + private final Map> classCache; + private final ClassResolver delegate; + + CachingClassResolver(ClassResolver delegate, Map> classCache) { + this.delegate = delegate; + this.classCache = classCache; + } + + @Override + public Class resolve(String className) throws ClassNotFoundException { + // Query the cache first. + Class clazz; + clazz = classCache.get(className); + if (clazz != null) { + return clazz; + } + + // And then try to load. + clazz = delegate.resolve(className); + + classCache.put(className, clazz); + return clazz; + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java new file mode 100644 index 0000000000..a6fa1c52d7 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java @@ -0,0 +1,7 @@ +package org.jboss.netty.handler.codec.serialization; + +interface ClassResolver { + + Class resolve(String className) throws ClassNotFoundException; + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java new file mode 100644 index 0000000000..e802838080 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java @@ -0,0 +1,24 @@ +package org.jboss.netty.handler.codec.serialization; + +import java.util.HashMap; + +public class ClassResolvers { + + public static ClassResolver cachingResolver(ClassLoader classLoader) { + if (classLoader == null) { + classLoader = defaultClassLoader(); + } + + return new CachingClassResolver(new ClassloaderClassResolver(classLoader), new HashMap>()); + } + + static ClassLoader defaultClassLoader() { + final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + if (contextClassLoader != null) { + return contextClassLoader; + } + + return CompactObjectInputStream.class.getClassLoader(); + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java new file mode 100644 index 0000000000..545e8e3f08 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java @@ -0,0 +1,16 @@ +package org.jboss.netty.handler.codec.serialization; + +class ClassloaderClassResolver implements ClassResolver { + + private final ClassLoader classLoader; + + ClassloaderClassResolver(ClassLoader classLoader) { + this.classLoader = classLoader; + } + + @Override + public Class resolve(String className) throws ClassNotFoundException { + return classLoader.loadClass(className); + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java index 95c9eccec0..2ced2188d4 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java @@ -21,8 +21,6 @@ import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.io.StreamCorruptedException; -import java.util.HashMap; -import java.util.Map; /** * @author The Netty Project @@ -32,21 +30,12 @@ import java.util.Map; * */ class CompactObjectInputStream extends ObjectInputStream { + + private final ClassResolver classResolver; - private final Map> classCache = new HashMap>(); - private final ClassLoader classLoader; - - CompactObjectInputStream(InputStream in) throws IOException { - this(in, null); - } - - CompactObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException { + CompactObjectInputStream(InputStream in, ClassResolver classResolver) throws IOException { super(in); - if (classLoader == null) { - this.classLoader = defaultClassLoader(); - } else { - this.classLoader = classLoader; - } + this.classResolver = classResolver; } @Override @@ -70,7 +59,7 @@ class CompactObjectInputStream extends ObjectInputStream { return super.readClassDescriptor(); case CompactObjectOutputStream.TYPE_THIN_DESCRIPTOR: String className = readUTF(); - Class clazz = loadClass(className); + Class clazz = classResolver.resolve(className); return ObjectStreamClass.lookupAny(clazz); default: throw new StreamCorruptedException( @@ -82,7 +71,7 @@ class CompactObjectInputStream extends ObjectInputStream { protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { Class clazz; try { - clazz = loadClass(desc.getName()); + clazz = classResolver.resolve(desc.getName()); } catch (ClassNotFoundException ex) { clazz = super.resolveClass(desc); } @@ -90,28 +79,4 @@ class CompactObjectInputStream extends ObjectInputStream { return clazz; } - protected Class loadClass(String className) throws ClassNotFoundException { - // Query the cache first. - Class clazz; - clazz = classCache.get(className); - if (clazz != null) { - return clazz; - } - - // And then try to load. - clazz = classLoader.loadClass(className); - - classCache.put(className, clazz); - return clazz; - } - - private static ClassLoader defaultClassLoader() { - final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - if (contextClassLoader != null) { - return contextClassLoader; - } - - return CompactObjectInputStream.class.getClassLoader(); - } - } diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java index 3bf80a82ca..4efab6c9c8 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java @@ -43,7 +43,7 @@ import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; */ public class ObjectDecoder extends LengthFieldBasedFrameDecoder { - private final ClassLoader classLoader; + private final ClassResolver classResolver; /** * Creates a new decoder whose maximum object size is {@code 1048576} @@ -64,7 +64,7 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder { * will be raised. */ public ObjectDecoder(int maxObjectSize) { - this(maxObjectSize, null); + this(maxObjectSize, ClassResolvers.cachingResolver(null)); } /** @@ -74,12 +74,12 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder { * if the length of the received object is greater * than this value, {@link StreamCorruptedException} * will be raised. - * @param classLoader the {@link ClassLoader} which will load the class + * @param classResolver the {@link ClassResolver} which will load the class * of the serialized object */ - public ObjectDecoder(int maxObjectSize, ClassLoader classLoader) { + public ObjectDecoder(int maxObjectSize, ClassResolver classResolver) { super(maxObjectSize, 0, 4, 0, 4); - this.classLoader = classLoader; + this.classResolver = classResolver; } @Override @@ -92,7 +92,7 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder { } return new CompactObjectInputStream( - new ChannelBufferInputStream(frame), classLoader).readObject(); + new ChannelBufferInputStream(frame), classResolver).readObject(); } @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java index aa4aa439c0..158f0ad3a1 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java @@ -119,7 +119,7 @@ public class ObjectDecoderInputStream extends InputStream implements "data length too big: " + dataLen + " (max: " + maxObjectSize + ')'); } - return new CompactObjectInputStream(in, classLoader).readObject(); + return new CompactObjectInputStream(in, ClassResolvers.cachingResolver(classLoader)).readObject(); } @Override From 99e9da1e75188bf78f71d5b89e627c8372212cde Mon Sep 17 00:00:00 2001 From: alepar Date: Tue, 22 Nov 2011 18:09:37 +0400 Subject: [PATCH 54/93] sharing classResolver cache across all CompactObjectInputStream's in the same way, as we did in ObjectDecoder --- .../codec/serialization/ObjectDecoderInputStream.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java index 158f0ad3a1..a1590fee8c 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java @@ -35,8 +35,8 @@ public class ObjectDecoderInputStream extends InputStream implements ObjectInput { private final DataInputStream in; - private final ClassLoader classLoader; private final int maxObjectSize; + private final ClassResolver classResolver; /** * Creates a new {@link ObjectInput}. @@ -104,7 +104,7 @@ public class ObjectDecoderInputStream extends InputStream implements } else { this.in = new DataInputStream(in); } - this.classLoader = classLoader; + this.classResolver = ClassResolvers.cachingResolver(classLoader); this.maxObjectSize = maxObjectSize; } @@ -119,7 +119,7 @@ public class ObjectDecoderInputStream extends InputStream implements "data length too big: " + dataLen + " (max: " + maxObjectSize + ')'); } - return new CompactObjectInputStream(in, ClassResolvers.cachingResolver(classLoader)).readObject(); + return new CompactObjectInputStream(in, classResolver).readObject(); } @Override From 7e6d07afaf057df683a48901f23aff55a117588e Mon Sep 17 00:00:00 2001 From: alepar Date: Tue, 22 Nov 2011 18:16:30 +0400 Subject: [PATCH 55/93] use weak cache as default cache - it doesn't break class unloading providing multiple implementations for caching, each good for its own specific use-case --- .../codec/serialization/ClassResolver.java | 4 + .../codec/serialization/ClassResolvers.java | 58 +++++++++++-- .../codec/serialization/ObjectDecoder.java | 2 +- .../ObjectDecoderInputStream.java | 2 +- .../codec/serialization/ReferenceMap.java | 87 +++++++++++++++++++ .../codec/serialization/SoftReferenceMap.java | 18 ++++ .../codec/serialization/WeakReferenceMap.java | 18 ++++ 7 files changed, 179 insertions(+), 10 deletions(-) create mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/SoftReferenceMap.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/WeakReferenceMap.java diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java index a6fa1c52d7..6f9f13b887 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java @@ -1,5 +1,9 @@ package org.jboss.netty.handler.codec.serialization; + +/** + * please use {@link ClassResolvers} as instance factory + */ interface ClassResolver { Class resolve(String className) throws ClassNotFoundException; diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java index e802838080..4df8e3d3bc 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java @@ -1,24 +1,66 @@ package org.jboss.netty.handler.codec.serialization; +import java.lang.ref.Reference; import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; public class ClassResolvers { - - public static ClassResolver cachingResolver(ClassLoader classLoader) { - if (classLoader == null) { - classLoader = defaultClassLoader(); - } - return new CachingClassResolver(new ClassloaderClassResolver(classLoader), new HashMap>()); + /** + * non-agressive non-concurrent cache + * good for non-shared default cache + * + * @param classLoader - specific classLoader to use, or null if you want to revert to default + * @return new instance of class resolver + */ + public static ClassResolver weakCachingResolver(ClassLoader classLoader) { + return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap>(new HashMap>>())); } - static ClassLoader defaultClassLoader() { + /** + * agressive non-concurrent cache + * good for non-shared cache, when we're not worried about class unloading + * + * @param classLoader - specific classLoader to use, or null if you want to revert to default + * @return new instance of class resolver + */ + public static ClassResolver softCachingResolver(ClassLoader classLoader) { + return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new SoftReferenceMap>(new HashMap>>())); + } + + /** + * non-agressive concurrent cache + * good for shared cache, when we're worried about class unloading + * + * @param classLoader - specific classLoader to use, or null if you want to revert to default + * @return new instance of class resolver + */ + public static ClassResolver weakCachingConcurrentResolver(ClassLoader classLoader) { + return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap>(new ConcurrentHashMap>>())); + } + + /** + * agressive concurrent cache + * good for shared cache, when we're not worried about class unloading + * + * @param classLoader - specific classLoader to use, or null if you want to revert to default + * @return new instance of class resolver + */ + public static ClassResolver softCachingConcurrentResolver(ClassLoader classLoader) { + return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new SoftReferenceMap>(new ConcurrentHashMap>>())); + } + + static ClassLoader defaultClassLoader(ClassLoader classLoader) { + if (classLoader != null) { + return classLoader; + } + final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); if (contextClassLoader != null) { return contextClassLoader; } - return CompactObjectInputStream.class.getClassLoader(); + return ClassResolvers.class.getClassLoader(); } } diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java index 4efab6c9c8..73fd1eb2c0 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java @@ -64,7 +64,7 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder { * will be raised. */ public ObjectDecoder(int maxObjectSize) { - this(maxObjectSize, ClassResolvers.cachingResolver(null)); + this(maxObjectSize, ClassResolvers.weakCachingResolver(null)); } /** diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java index a1590fee8c..234035bd74 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java @@ -104,7 +104,7 @@ public class ObjectDecoderInputStream extends InputStream implements } else { this.in = new DataInputStream(in); } - this.classResolver = ClassResolvers.cachingResolver(classLoader); + this.classResolver = ClassResolvers.weakCachingResolver(classLoader); this.maxObjectSize = maxObjectSize; } diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java new file mode 100644 index 0000000000..64a3e3c750 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java @@ -0,0 +1,87 @@ +package org.jboss.netty.handler.codec.serialization; + +import java.lang.ref.Reference; +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +abstract class ReferenceMap implements Map { + + private final Map> delegate; + + protected ReferenceMap(Map> delegate) { + this.delegate = delegate; + } + + abstract Reference fold(V value); + + private V unfold(Reference ref) { + if (ref == null) { + return null; + } + + return ref.get(); + } + + @Override + public int size() { + return delegate.size(); + } + + @Override + public boolean isEmpty() { + return delegate.isEmpty(); + } + + @Override + public boolean containsKey(Object key) { + return delegate.containsKey(key); + } + + @Override + public boolean containsValue(Object value) { + throw new UnsupportedOperationException(); + } + + @Override + public V get(Object key) { + return unfold(delegate.get(key)); + } + + @Override + public V put(K key, V value) { + return unfold(delegate.put(key, fold(value))); + } + + @Override + public V remove(Object key) { + return unfold(delegate.remove(key)); + } + + @Override + public void putAll(Map m) { + for (Entry entry : m.entrySet()) { + delegate.put(entry.getKey(), fold(entry.getValue())); + } + } + + @Override + public void clear() { + delegate.clear(); + } + + @Override + public Set keySet() { + return delegate.keySet(); + } + + @Override + public Collection values() { + throw new UnsupportedOperationException(); + } + + @Override + public Set> entrySet() { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/SoftReferenceMap.java b/src/main/java/org/jboss/netty/handler/codec/serialization/SoftReferenceMap.java new file mode 100644 index 0000000000..7bf82e02da --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/SoftReferenceMap.java @@ -0,0 +1,18 @@ +package org.jboss.netty.handler.codec.serialization; + +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; +import java.util.Map; + +public class SoftReferenceMap extends ReferenceMap { + + public SoftReferenceMap(Map> delegate) { + super(delegate); + } + + @Override + Reference fold(V value) { + return new SoftReference(value); + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/WeakReferenceMap.java b/src/main/java/org/jboss/netty/handler/codec/serialization/WeakReferenceMap.java new file mode 100644 index 0000000000..9217baac0c --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/WeakReferenceMap.java @@ -0,0 +1,18 @@ +package org.jboss.netty.handler.codec.serialization; + +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; +import java.util.Map; + +public class WeakReferenceMap extends ReferenceMap { + + public WeakReferenceMap(Map> delegate) { + super(delegate); + } + + @Override + Reference fold(V value) { + return new WeakReference(value); + } + +} From 3ecb93eadeaaf4df065862709dc4b456bd5a7f66 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 22 Nov 2011 17:29:54 +0100 Subject: [PATCH 56/93] Include the name which was the cause of the IllegalArgumentException while try to add a handler to the pipeline --- .../java/org/jboss/netty/channel/DefaultChannelPipeline.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java index 57adf425b6..8cf19ca572 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java @@ -685,7 +685,7 @@ public class DefaultChannelPipeline implements ChannelPipeline { private void checkDuplicateName(String name) { if (name2ctx.containsKey(name)) { - throw new IllegalArgumentException("Duplicate handler name."); + throw new IllegalArgumentException("Duplicate handler name " + name); } } From c9a24729bdde00e2bbd0bed5e307af16db71e1c3 Mon Sep 17 00:00:00 2001 From: Ngoc Dao Date: Wed, 23 Nov 2011 04:14:10 +0900 Subject: [PATCH 57/93] Fix #72 --- .../netty/handler/codec/http/QueryStringDecoder.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/QueryStringDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/QueryStringDecoder.java index 743875e5b8..94d2715923 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/QueryStringDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/QueryStringDecoder.java @@ -30,9 +30,11 @@ import org.jboss.netty.util.CharsetUtil; * Splits an HTTP query string into a path string and key-value parameter pairs. * This decoder is for one time use only. Create a new instance for each URI: *

- * {@link QueryStringDecoder} decoder = new {@link QueryStringDecoder}("/hello?recipient=world");
+ * {@link QueryStringDecoder} decoder = new {@link QueryStringDecoder}("/hello?recipient=world&x=1;y=2");
  * assert decoder.getPath().equals("/hello");
  * assert decoder.getParameters().get("recipient").equals("world");
+ * assert decoder.getParameters().get("x").equals("1");
+ * assert decoder.getParameters().get("y").equals("2");
  * 
* * @author The Netty Project @@ -73,7 +75,8 @@ public class QueryStringDecoder { throw new NullPointerException("charset"); } - this.uri = uri; + // http://en.wikipedia.org/wiki/Query_string + this.uri = uri.replace(';', '&'); this.charset = charset; } @@ -97,7 +100,8 @@ public class QueryStringDecoder { throw new NullPointerException("charset"); } - this.uri = uri.toASCIIString(); + // http://en.wikipedia.org/wiki/Query_string + this.uri = uri.toASCIIString().replace(';', '&'); this.charset = charset; } From cdbaeb86b07580858f6006207c5313dc573591fe Mon Sep 17 00:00:00 2001 From: alepar Date: Wed, 23 Nov 2011 02:57:32 +0400 Subject: [PATCH 58/93] adding class resolver with disabled cache, fixing unit tests --- .../handler/codec/serialization/ClassResolvers.java | 10 +++++++++- .../serialization/CompactObjectSerializationTest.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java index 4df8e3d3bc..cbc4d1db15 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java @@ -6,6 +6,15 @@ import java.util.concurrent.ConcurrentHashMap; public class ClassResolvers { + /** + * cache disabled + * @param classLoader - specific classLoader to use, or null if you want to revert to default + * @return new instance of class resolver + */ + public static ClassResolver cacheDisabled(ClassLoader classLoader) { + return new ClassloaderClassResolver(defaultClassLoader(classLoader)); + } + /** * non-agressive non-concurrent cache * good for non-shared default cache @@ -62,5 +71,4 @@ public class ClassResolvers { return ClassResolvers.class.getClassLoader(); } - } diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/CompactObjectSerializationTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/CompactObjectSerializationTest.java index 0db5000c7c..b233981ddb 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/CompactObjectSerializationTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/CompactObjectSerializationTest.java @@ -32,7 +32,7 @@ public class CompactObjectSerializationTest { PipedOutputStream pipeOut = new PipedOutputStream(); PipedInputStream pipeIn = new PipedInputStream(pipeOut); CompactObjectOutputStream out = new CompactObjectOutputStream(pipeOut); - CompactObjectInputStream in = new CompactObjectInputStream(pipeIn); + CompactObjectInputStream in = new CompactObjectInputStream(pipeIn, ClassResolvers.cacheDisabled(null)); out.writeObject(List.class); Assert.assertSame(List.class, in.readObject()); } From 01c45650aa834b19f362367a3fd558e6df1b0679 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Wed, 23 Nov 2011 14:01:30 +0900 Subject: [PATCH 59/93] Add a missing close(SelectionKey) call * Without calling close(SelectionKey), the client boss loop can fall into an infinite loop. --- .../netty/channel/socket/nio/NioClientSocketPipelineSink.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java index 9376768569..c009b11efd 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java @@ -372,6 +372,7 @@ class NioClientSocketPipelineSink extends AbstractChannelSink { ConnectException cause = null; for (SelectionKey k: keys) { if (!k.isValid()) { + close(k); continue; } From 2dafb3d91bb8c113c38997c9b61812240afc197e Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Wed, 23 Nov 2011 14:07:26 +0900 Subject: [PATCH 60/93] Add a missing colon --- .../java/org/jboss/netty/channel/DefaultChannelPipeline.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java index 8cf19ca572..16529ea47b 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java @@ -685,7 +685,7 @@ public class DefaultChannelPipeline implements ChannelPipeline { private void checkDuplicateName(String name) { if (name2ctx.containsKey(name)) { - throw new IllegalArgumentException("Duplicate handler name " + name); + throw new IllegalArgumentException("Duplicate handler name: " + name); } } From 800a9fc20d7258275f687b29ef8eddea3f944192 Mon Sep 17 00:00:00 2001 From: alepar Date: Wed, 23 Nov 2011 14:48:42 +0400 Subject: [PATCH 61/93] making interface public, so that others can implement it jic --- .../jboss/netty/handler/codec/serialization/ClassResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java index 6f9f13b887..73958e1108 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java @@ -4,7 +4,7 @@ package org.jboss.netty.handler.codec.serialization; /** * please use {@link ClassResolvers} as instance factory */ -interface ClassResolver { +public interface ClassResolver { Class resolve(String className) throws ClassNotFoundException; From cee5ee5679de2a8900afe9bbf05f973ace08ce71 Mon Sep 17 00:00:00 2001 From: alepar Date: Wed, 23 Nov 2011 15:18:43 +0400 Subject: [PATCH 62/93] now able to resolve array types to classes --- .../codec/serialization/ClassloaderClassResolver.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java index 545e8e3f08..691b9dd0c9 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java @@ -10,7 +10,11 @@ class ClassloaderClassResolver implements ClassResolver { @Override public Class resolve(String className) throws ClassNotFoundException { - return classLoader.loadClass(className); + try { + return classLoader.loadClass(className); + } catch (ClassNotFoundException e) { + return Class.forName(className, false, classLoader); + } } } From 946d4be69ebe607ae4488087cd515759b3c724a1 Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 23 Nov 2011 13:47:59 +0100 Subject: [PATCH 63/93] Add constructors to make it possible to backport it to 3.2 without breaking the api --- .../codec/serialization/ObjectDecoder.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java index 73fd1eb2c0..6f73987fe3 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java @@ -50,11 +50,27 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder { * bytes. If the size of the received object is greater than * {@code 1048576} bytes, a {@link StreamCorruptedException} will be * raised. + * + * @deprecated use {@link #ObjectDecoder(ClassResolver)} */ + @Deprecated public ObjectDecoder() { this(1048576); } + + /** + * Creates a new decoder whose maximum object size is {@code 1048576} + * bytes. If the size of the received object is greater than + * {@code 1048576} bytes, a {@link StreamCorruptedException} will be + * raised. + * + * @param classResolver the {@link ClassResolver} to use for this decoder + */ + public ObjectDecoder(ClassResolver classResolver) { + this(1048576, classResolver); + } + /** * Creates a new decoder with the specified maximum object size. * @@ -62,7 +78,9 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder { * if the length of the received object is greater * than this value, {@link StreamCorruptedException} * will be raised. + * @deprecated use {@link #ObjectDecoder(int, ClassResolver)} */ + @Deprecated public ObjectDecoder(int maxObjectSize) { this(maxObjectSize, ClassResolvers.weakCachingResolver(null)); } @@ -82,6 +100,23 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder { this.classResolver = classResolver; } + + /** + * Create a new decoder with the specified maximum object size and the {@link ClassLoader} wrapped in {@link ClassResolvers#weakCachingResolver(ClassLoader)} + * + * + * @param maxObjectSize the maximum byte length of the serialized object. + * if the length of the received object is greater + * than this value, {@link StreamCorruptedException} + * will be raised. + * @param classLoader the the classloader to use + * @deprecated use {@link #ObjectDecoder(int, ClassResolver)} + */ + @Deprecated + public ObjectDecoder(int maxObjectSize, ClassLoader classLoader) { + this(maxObjectSize, ClassResolvers.weakCachingResolver(classLoader)); + } + @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { From b6f8b5871c6092a42edce07a543da6f6d352e38b Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 24 Nov 2011 10:15:51 +0900 Subject: [PATCH 64/93] Rename ClassloaderClassResolver to ClassLoaderClassResolver --- .../ClassLoaderClassResolver.java | 20 +++++++++++++++++++ .../codec/serialization/ClassResolvers.java | 10 +++++----- .../ClassloaderClassResolver.java | 4 ++-- 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/ClassLoaderClassResolver.java diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassLoaderClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassLoaderClassResolver.java new file mode 100644 index 0000000000..6c73c81557 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassLoaderClassResolver.java @@ -0,0 +1,20 @@ +package org.jboss.netty.handler.codec.serialization; + +class ClassLoaderClassResolver implements ClassResolver { + + private final ClassLoader classLoader; + + ClassLoaderClassResolver(ClassLoader classLoader) { + this.classLoader = classLoader; + } + + @Override + public Class resolve(String className) throws ClassNotFoundException { + try { + return classLoader.loadClass(className); + } catch (ClassNotFoundException e) { + return Class.forName(className, false, classLoader); + } + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java index cbc4d1db15..02157c46a9 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java @@ -12,7 +12,7 @@ public class ClassResolvers { * @return new instance of class resolver */ public static ClassResolver cacheDisabled(ClassLoader classLoader) { - return new ClassloaderClassResolver(defaultClassLoader(classLoader)); + return new ClassLoaderClassResolver(defaultClassLoader(classLoader)); } /** @@ -23,7 +23,7 @@ public class ClassResolvers { * @return new instance of class resolver */ public static ClassResolver weakCachingResolver(ClassLoader classLoader) { - return new CachingClassResolver(new ClassloaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap>(new HashMap>>())); + return new CachingClassResolver(new ClassLoaderClassResolver(defaultClassLoader(classLoader)), new WeakReferenceMap>(new HashMap>>())); } /** @@ -34,7 +34,7 @@ public 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>>())); } /** @@ -45,7 +45,7 @@ public 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>>())); } /** @@ -56,7 +56,7 @@ public 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/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java index 691b9dd0c9..6c73c81557 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java @@ -1,10 +1,10 @@ package org.jboss.netty.handler.codec.serialization; -class ClassloaderClassResolver implements ClassResolver { +class ClassLoaderClassResolver implements ClassResolver { private final ClassLoader classLoader; - ClassloaderClassResolver(ClassLoader classLoader) { + ClassLoaderClassResolver(ClassLoader classLoader) { this.classLoader = classLoader; } From 8debdb59e42f46b09616686173b57f0c2afc8012 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 24 Nov 2011 10:18:31 +0900 Subject: [PATCH 65/93] Fix weird repo mess --- .../ClassloaderClassResolver.java | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java deleted file mode 100644 index 6c73c81557..0000000000 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassloaderClassResolver.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.jboss.netty.handler.codec.serialization; - -class ClassLoaderClassResolver implements ClassResolver { - - private final ClassLoader classLoader; - - ClassLoaderClassResolver(ClassLoader classLoader) { - this.classLoader = classLoader; - } - - @Override - public Class resolve(String className) throws ClassNotFoundException { - try { - return classLoader.loadClass(className); - } catch (ClassNotFoundException e) { - return Class.forName(className, false, classLoader); - } - } - -} From e015456ae103d4add48c3297c25432f8cd3d26dd Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 24 Nov 2011 10:22:21 +0900 Subject: [PATCH 66/93] Add missing license headers --- .../serialization/CachingClassResolver.java | 15 +++++++++++++++ .../serialization/ClassLoaderClassResolver.java | 15 +++++++++++++++ .../codec/serialization/ClassResolver.java | 16 +++++++++++++++- .../codec/serialization/ClassResolvers.java | 15 +++++++++++++++ .../codec/serialization/ReferenceMap.java | 15 +++++++++++++++ .../codec/serialization/SoftReferenceMap.java | 15 +++++++++++++++ .../codec/serialization/WeakReferenceMap.java | 15 +++++++++++++++ 7 files changed, 105 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CachingClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CachingClassResolver.java index 93524d5438..aad29776de 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CachingClassResolver.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CachingClassResolver.java @@ -1,3 +1,18 @@ +/* + * Copyright 2011 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.serialization; import java.util.Map; diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassLoaderClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassLoaderClassResolver.java index 6c73c81557..9e1d0781aa 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassLoaderClassResolver.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassLoaderClassResolver.java @@ -1,3 +1,18 @@ +/* + * Copyright 2011 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.serialization; class ClassLoaderClassResolver implements ClassResolver { diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java index 73958e1108..4340a746a2 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolver.java @@ -1,6 +1,20 @@ +/* + * Copyright 2011 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.serialization; - /** * please use {@link ClassResolvers} as instance factory */ diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java index 02157c46a9..4bb22794e8 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ClassResolvers.java @@ -1,3 +1,18 @@ +/* + * Copyright 2011 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.serialization; import java.lang.ref.Reference; diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java index 64a3e3c750..ade1e98934 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ReferenceMap.java @@ -1,3 +1,18 @@ +/* + * Copyright 2011 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.serialization; import java.lang.ref.Reference; diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/SoftReferenceMap.java b/src/main/java/org/jboss/netty/handler/codec/serialization/SoftReferenceMap.java index 7bf82e02da..b8c53a0808 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/SoftReferenceMap.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/SoftReferenceMap.java @@ -1,3 +1,18 @@ +/* + * Copyright 2011 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.serialization; import java.lang.ref.Reference; diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/WeakReferenceMap.java b/src/main/java/org/jboss/netty/handler/codec/serialization/WeakReferenceMap.java index 9217baac0c..7f404a2a1b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/WeakReferenceMap.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/WeakReferenceMap.java @@ -1,3 +1,18 @@ +/* + * Copyright 2011 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.serialization; import java.lang.ref.Reference; From 5abd23d3baf1f3c5be2b92c267df926c4bc46877 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 24 Nov 2011 10:54:01 +0900 Subject: [PATCH 67/93] Upgrade depepdencies to the latest versions * Regenerate LocalTimeProtocol.java with the latest protoc * Add an instruction on how to generate LocalTimeProtocol.java * Not upgrading maven-bundle-plugin, which has a regression in 2.3.5: * https://issues.apache.org/jira/browse/FELIX-3058 Conflicts: src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java --- pom.xml | 26 +- .../example/localtime/LocalTimeProtocol.java | 2071 +++++++++++------ .../example/localtime/LocalTimeProtocol.proto | 7 + 3 files changed, 1404 insertions(+), 700 deletions(-) diff --git a/pom.xml b/pom.xml index 0754080c99..435e023f97 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ com.google.protobuf protobuf-java - 2.3.0 + 2.4.1 compile true @@ -114,7 +114,7 @@ org.slf4j slf4j-api - 1.6.1 + 1.6.4 compile true @@ -168,13 +168,13 @@ org.easymock easymock - 2.5.2 + 3.1 test org.easymock easymockclassextension - 2.5.2 + 3.1 test @@ -186,7 +186,7 @@ org.slf4j slf4j-simple - 1.6.1 + 1.6.4 test @@ -211,7 +211,7 @@ maven-enforcer-plugin - 1.0 + 1.0.1 maven-compiler-plugin @@ -227,7 +227,7 @@ maven-resources-plugin - 2.4.3 + 2.5 UTF-8 @@ -258,7 +258,7 @@ maven-surefire-plugin - 2.7.2 + 2.10 once @@ -315,7 +315,7 @@ maven-antrun-plugin - 1.6 + 1.7 write-version @@ -420,7 +420,7 @@ maven-javadoc-plugin - 2.7 + 2.8 generate-javadoc @@ -479,7 +479,7 @@ maven-jxr-plugin - 2.2 + 2.3 generate-xref @@ -601,7 +601,7 @@ maven-assembly-plugin - 2.2 + 2.2.1 generate-distribution @@ -622,7 +622,7 @@ maven-release-plugin - 2.1 + 2.2.1 diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java index 8628f34d64..2d894fe7e2 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.java @@ -1,5 +1,5 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: LocalTimeProtocol.proto +// source: src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.proto package org.jboss.netty.example.localtime; @@ -23,11 +23,22 @@ public final class LocalTimeProtocol { MIDEAST(9, 9), PACIFIC(10, 10), ; - - - @Override + + public static final int AFRICA_VALUE = 0; + public static final int AMERICA_VALUE = 1; + public static final int ANTARCTICA_VALUE = 2; + public static final int ARCTIC_VALUE = 3; + public static final int ASIA_VALUE = 4; + public static final int ATLANTIC_VALUE = 5; + public static final int AUSTRALIA_VALUE = 6; + public static final int EUROPE_VALUE = 7; + public static final int INDIAN_VALUE = 8; + public static final int MIDEAST_VALUE = 9; + public static final int PACIFIC_VALUE = 10; + + public final int getNumber() { return value; } - + public static Continent valueOf(int value) { switch (value) { case 0: return AFRICA; @@ -44,38 +55,36 @@ public final class LocalTimeProtocol { default: return null; } } - + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { return internalValueMap; } - private static final com.google.protobuf.Internal.EnumLiteMap + private static com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { - @Override public Continent findValueByNumber(int number) { - return Continent.valueOf(number) - ; } + return Continent.valueOf(number); + } }; - - @Override + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); } - @Override public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } - public static com.google.protobuf.Descriptors.EnumDescriptor + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.getDescriptor().getEnumTypes().get(0); } - + private static final Continent[] VALUES = { - AFRICA, AMERICA, ANTARCTICA, ARCTIC, ASIA, ATLANTIC, AUSTRALIA, EUROPE, INDIAN, MIDEAST, PACIFIC, + AFRICA, AMERICA, ANTARCTICA, ARCTIC, ASIA, ATLANTIC, AUSTRALIA, EUROPE, INDIAN, MIDEAST, PACIFIC, }; + public static Continent valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { @@ -84,20 +93,18 @@ public final class LocalTimeProtocol { } return VALUES[desc.getIndex()]; } + private final int index; private final int value; - Continent(int index, int value) { + + private Continent(int index, int value) { this.index = index; this.value = value; } - - static { - org.jboss.netty.example.localtime.LocalTimeProtocol.getDescriptor(); - } - + // @@protoc_insertion_point(enum_scope:org.jboss.netty.example.localtime.Continent) } - + public enum DayOfWeek implements com.google.protobuf.ProtocolMessageEnum { SUNDAY(0, 1), @@ -108,11 +115,18 @@ public final class LocalTimeProtocol { FRIDAY(5, 6), SATURDAY(6, 7), ; - - - @Override + + public static final int SUNDAY_VALUE = 1; + public static final int MONDAY_VALUE = 2; + public static final int TUESDAY_VALUE = 3; + public static final int WEDNESDAY_VALUE = 4; + public static final int THURSDAY_VALUE = 5; + public static final int FRIDAY_VALUE = 6; + public static final int SATURDAY_VALUE = 7; + + public final int getNumber() { return value; } - + public static DayOfWeek valueOf(int value) { switch (value) { case 1: return SUNDAY; @@ -125,38 +139,36 @@ public final class LocalTimeProtocol { default: return null; } } - + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { return internalValueMap; } - private static final com.google.protobuf.Internal.EnumLiteMap + private static com.google.protobuf.Internal.EnumLiteMap internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { - @Override public DayOfWeek findValueByNumber(int number) { - return DayOfWeek.valueOf(number) - ; } + return DayOfWeek.valueOf(number); + } }; - - @Override + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(index); } - @Override public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } - public static com.google.protobuf.Descriptors.EnumDescriptor + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.getDescriptor().getEnumTypes().get(1); } - + private static final DayOfWeek[] VALUES = { - SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, + SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, }; + public static DayOfWeek valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { @@ -165,107 +177,159 @@ public final class LocalTimeProtocol { } return VALUES[desc.getIndex()]; } + private final int index; private final int value; - DayOfWeek(int index, int value) { + + private DayOfWeek(int index, int value) { this.index = index; this.value = value; } - - static { - org.jboss.netty.example.localtime.LocalTimeProtocol.getDescriptor(); - } - + // @@protoc_insertion_point(enum_scope:org.jboss.netty.example.localtime.DayOfWeek) } - + + public interface LocationOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .org.jboss.netty.example.localtime.Continent continent = 1; + boolean hasContinent(); + org.jboss.netty.example.localtime.LocalTimeProtocol.Continent getContinent(); + + // required string city = 2; + boolean hasCity(); + String getCity(); + } public static final class Location extends - com.google.protobuf.GeneratedMessage { + com.google.protobuf.GeneratedMessage + implements LocationOrBuilder { // Use Location.newBuilder() to construct. - private Location() { - initFields(); + private Location(Builder builder) { + super(builder); } private Location(boolean noInit) {} - + private static final Location defaultInstance; public static Location getDefaultInstance() { return defaultInstance; } - - @Override + public Location getDefaultInstanceForType() { return defaultInstance; } - - public static com.google.protobuf.Descriptors.Descriptor + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Location_descriptor; } - - @Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Location_fieldAccessorTable; } - + + private int bitField0_; // required .org.jboss.netty.example.localtime.Continent continent = 1; public static final int CONTINENT_FIELD_NUMBER = 1; - private boolean hasContinent; private org.jboss.netty.example.localtime.LocalTimeProtocol.Continent continent_; - public boolean hasContinent() { return hasContinent; } - public org.jboss.netty.example.localtime.LocalTimeProtocol.Continent getContinent() { return continent_; } - + public boolean hasContinent() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.Continent getContinent() { + return continent_; + } + // required string city = 2; public static final int CITY_FIELD_NUMBER = 2; - private boolean hasCity; - private java.lang.String city_ = ""; - public boolean hasCity() { return hasCity; } - public java.lang.String getCity() { return city_; } - + private java.lang.Object city_; + public boolean hasCity() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getCity() { + java.lang.Object ref = city_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + city_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getCityBytes() { + java.lang.Object ref = city_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + city_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; + city_ = ""; } - - @Override - public boolean isInitialized() { - return hasContinent && hasCity; + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasContinent()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasCity()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; } - - @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasContinent()) { - output.writeEnum(1, getContinent().getNumber()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, continent_.getNumber()); } - if (hasCity()) { - output.writeString(2, getCity()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getCityBytes()); } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; - @Override public int getSerializedSize() { int size = memoizedSerializedSize; - if (size != -1) { - return size; - } - + if (size != -1) return size; + size = 0; - if (hasContinent()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, getContinent().getNumber()); + .computeEnumSize(1, continent_.getNumber()); } - if (hasCity()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(2, getCity()); + .computeBytesSize(2, getCityBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static org.jboss.netty.example.localtime.LocalTimeProtocol.Location parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -332,93 +396,107 @@ public final class LocalTimeProtocol { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - + public static Builder newBuilder() { return Builder.create(); } - @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.jboss.netty.example.localtime.LocalTimeProtocol.Location prototype) { return newBuilder().mergeFrom(prototype); } - @Override public Builder toBuilder() { return newBuilder(this); } - + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder { - private org.jboss.netty.example.localtime.LocalTimeProtocol.Location result; - + com.google.protobuf.GeneratedMessage.Builder + implements org.jboss.netty.example.localtime.LocalTimeProtocol.LocationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Location_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Location_fieldAccessorTable; + } + // Construct using org.jboss.netty.example.localtime.LocalTimeProtocol.Location.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new org.jboss.netty.example.localtime.LocalTimeProtocol.Location(); - return builder; + private Builder() { + maybeForceBuilderInitialization(); } - - @Override - protected org.jboss.netty.example.localtime.LocalTimeProtocol.Location internalGetResult() { - return result; + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); } - - @Override - public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } - result = new org.jboss.netty.example.localtime.LocalTimeProtocol.Location(); + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; + bitField0_ = (bitField0_ & ~0x00000001); + city_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); return this; } - - @Override + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - - @Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.Location.getDescriptor(); } - - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.Location getDefaultInstanceForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.Location.getDefaultInstance(); } - - @Override - public boolean isInitialized() { - return result.isInitialized(); - } - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.Location build() { - if (result != null && !isInitialized()) { + org.jboss.netty.example.localtime.LocalTimeProtocol.Location result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - + private org.jboss.netty.example.localtime.LocalTimeProtocol.Location buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { + org.jboss.netty.example.localtime.LocalTimeProtocol.Location result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } - return buildPartial(); + return result; } - - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.Location buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + org.jboss.netty.example.localtime.LocalTimeProtocol.Location result = new org.jboss.netty.example.localtime.LocalTimeProtocol.Location(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - org.jboss.netty.example.localtime.LocalTimeProtocol.Location returnMe = result; - result = null; - return returnMe; + result.continent_ = continent_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.city_ = city_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; } - - @Override + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jboss.netty.example.localtime.LocalTimeProtocol.Location) { return mergeFrom((org.jboss.netty.example.localtime.LocalTimeProtocol.Location)other); @@ -427,39 +505,50 @@ public final class LocalTimeProtocol { return this; } } - + public Builder mergeFrom(org.jboss.netty.example.localtime.LocalTimeProtocol.Location other) { - if (other == org.jboss.netty.example.localtime.LocalTimeProtocol.Location.getDefaultInstance()) { - return this; - } + if (other == org.jboss.netty.example.localtime.LocalTimeProtocol.Location.getDefaultInstance()) return this; if (other.hasContinent()) { setContinent(other.getContinent()); } if (other.hasCity()) { setCity(other.getCity()); } - mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.getUnknownFields()); return this; } - - @Override + + public final boolean isInitialized() { + if (!hasContinent()) { + + return false; + } + if (!hasCity()) { + + return false; + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( - getUnknownFields()); + this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: - setUnknownFields(unknownFields.build()); + this.setUnknownFields(unknownFields.build()); + onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - setUnknownFields(unknownFields.build()); + this.setUnknownFields(unknownFields.build()); + onChanged(); return this; } break; @@ -470,154 +559,204 @@ public final class LocalTimeProtocol { if (value == null) { unknownFields.mergeVarintField(1, rawValue); } else { - setContinent(value); + bitField0_ |= 0x00000001; + continent_ = value; } break; } case 18: { - setCity(input.readString()); + bitField0_ |= 0x00000002; + city_ = input.readBytes(); break; } } } } - - + + private int bitField0_; + // required .org.jboss.netty.example.localtime.Continent continent = 1; + private org.jboss.netty.example.localtime.LocalTimeProtocol.Continent continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; public boolean hasContinent() { - return result.hasContinent(); + return ((bitField0_ & 0x00000001) == 0x00000001); } public org.jboss.netty.example.localtime.LocalTimeProtocol.Continent getContinent() { - return result.getContinent(); + return continent_; } public Builder setContinent(org.jboss.netty.example.localtime.LocalTimeProtocol.Continent value) { if (value == null) { throw new NullPointerException(); } - result.hasContinent = true; - result.continent_ = value; + bitField0_ |= 0x00000001; + continent_ = value; + onChanged(); return this; } public Builder clearContinent() { - result.hasContinent = false; - result.continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; + bitField0_ = (bitField0_ & ~0x00000001); + continent_ = org.jboss.netty.example.localtime.LocalTimeProtocol.Continent.AFRICA; + onChanged(); return this; } - + // required string city = 2; + private java.lang.Object city_ = ""; public boolean hasCity() { - return result.hasCity(); + return ((bitField0_ & 0x00000002) == 0x00000002); } - public java.lang.String getCity() { - return result.getCity(); + public String getCity() { + java.lang.Object ref = city_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + city_ = s; + return s; + } else { + return (String) ref; + } } - public Builder setCity(java.lang.String value) { + public Builder setCity(String value) { if (value == null) { throw new NullPointerException(); } - result.hasCity = true; - result.city_ = value; + bitField0_ |= 0x00000002; + city_ = value; + onChanged(); return this; } public Builder clearCity() { - result.hasCity = false; - result.city_ = getDefaultInstance().getCity(); + bitField0_ = (bitField0_ & ~0x00000002); + city_ = getDefaultInstance().getCity(); + onChanged(); return this; } - + void setCity(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + city_ = value; + onChanged(); + } + // @@protoc_insertion_point(builder_scope:org.jboss.netty.example.localtime.Location) } - + static { defaultInstance = new Location(true); - org.jboss.netty.example.localtime.LocalTimeProtocol.internalForceInit(); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:org.jboss.netty.example.localtime.Location) } - + + public interface LocationsOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .org.jboss.netty.example.localtime.Location location = 1; + java.util.List + getLocationList(); + org.jboss.netty.example.localtime.LocalTimeProtocol.Location getLocation(int index); + int getLocationCount(); + java.util.List + getLocationOrBuilderList(); + org.jboss.netty.example.localtime.LocalTimeProtocol.LocationOrBuilder getLocationOrBuilder( + int index); + } public static final class Locations extends - com.google.protobuf.GeneratedMessage { + com.google.protobuf.GeneratedMessage + implements LocationsOrBuilder { // Use Locations.newBuilder() to construct. - private Locations() { - initFields(); + private Locations(Builder builder) { + super(builder); } private Locations(boolean noInit) {} - + private static final Locations defaultInstance; public static Locations getDefaultInstance() { return defaultInstance; } - - @Override + public Locations getDefaultInstanceForType() { return defaultInstance; } - - public static com.google.protobuf.Descriptors.Descriptor + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Locations_descriptor; } - - @Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Locations_fieldAccessorTable; } - + // repeated .org.jboss.netty.example.localtime.Location location = 1; public static final int LOCATION_FIELD_NUMBER = 1; - private java.util.List location_ = - java.util.Collections.emptyList(); + private java.util.List location_; public java.util.List getLocationList() { return location_; } - public int getLocationCount() { return location_.size(); } + public java.util.List + getLocationOrBuilderList() { + return location_; + } + public int getLocationCount() { + return location_.size(); + } public org.jboss.netty.example.localtime.LocalTimeProtocol.Location getLocation(int index) { return location_.get(index); } - - private void initFields() { + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocationOrBuilder getLocationOrBuilder( + int index) { + return location_.get(index); } - @Override - public boolean isInitialized() { - for (org.jboss.netty.example.localtime.LocalTimeProtocol.Location element : getLocationList()) { - if (!element.isInitialized()) { - return false; + + private void initFields() { + location_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getLocationCount(); i++) { + if (!getLocation(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; } } + memoizedIsInitialized = 1; return true; } - - @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - for (org.jboss.netty.example.localtime.LocalTimeProtocol.Location element : getLocationList()) { - output.writeMessage(1, element); + for (int i = 0; i < location_.size(); i++) { + output.writeMessage(1, location_.get(i)); } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; - @Override public int getSerializedSize() { int size = memoizedSerializedSize; - if (size != -1) { - return size; - } - + if (size != -1) return size; + size = 0; - for (org.jboss.netty.example.localtime.LocalTimeProtocol.Location element : getLocationList()) { + for (int i = 0; i < location_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, element); + .computeMessageSize(1, location_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static org.jboss.netty.example.localtime.LocalTimeProtocol.Locations parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -684,97 +823,109 @@ public final class LocalTimeProtocol { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - + public static Builder newBuilder() { return Builder.create(); } - @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.jboss.netty.example.localtime.LocalTimeProtocol.Locations prototype) { return newBuilder().mergeFrom(prototype); } - @Override public Builder toBuilder() { return newBuilder(this); } - + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder { - private org.jboss.netty.example.localtime.LocalTimeProtocol.Locations result; - + com.google.protobuf.GeneratedMessage.Builder + implements org.jboss.netty.example.localtime.LocalTimeProtocol.LocationsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Locations_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_Locations_fieldAccessorTable; + } + // Construct using org.jboss.netty.example.localtime.LocalTimeProtocol.Locations.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new org.jboss.netty.example.localtime.LocalTimeProtocol.Locations(); - return builder; + private Builder() { + maybeForceBuilderInitialization(); } - - @Override - protected org.jboss.netty.example.localtime.LocalTimeProtocol.Locations internalGetResult() { - return result; + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); } - - @Override - public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getLocationFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (locationBuilder_ == null) { + location_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + locationBuilder_.clear(); } - result = new org.jboss.netty.example.localtime.LocalTimeProtocol.Locations(); return this; } - - @Override + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - - @Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.Locations.getDescriptor(); } - - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.Locations getDefaultInstanceForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.Locations.getDefaultInstance(); } - - @Override - public boolean isInitialized() { - return result.isInitialized(); - } - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.Locations build() { - if (result != null && !isInitialized()) { + org.jboss.netty.example.localtime.LocalTimeProtocol.Locations result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - + private org.jboss.netty.example.localtime.LocalTimeProtocol.Locations buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { + org.jboss.netty.example.localtime.LocalTimeProtocol.Locations result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } - return buildPartial(); + return result; } - - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.Locations buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + org.jboss.netty.example.localtime.LocalTimeProtocol.Locations result = new org.jboss.netty.example.localtime.LocalTimeProtocol.Locations(this); + int from_bitField0_ = bitField0_; + if (locationBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + location_ = java.util.Collections.unmodifiableList(location_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.location_ = location_; + } else { + result.location_ = locationBuilder_.build(); } - if (result.location_ != java.util.Collections.EMPTY_LIST) { - result.location_ = - java.util.Collections.unmodifiableList(result.location_); - } - org.jboss.netty.example.localtime.LocalTimeProtocol.Locations returnMe = result; - result = null; - return returnMe; + onBuilt(); + return result; } - - @Override + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jboss.netty.example.localtime.LocalTimeProtocol.Locations) { return mergeFrom((org.jboss.netty.example.localtime.LocalTimeProtocol.Locations)other); @@ -783,39 +934,68 @@ public final class LocalTimeProtocol { return this; } } - + public Builder mergeFrom(org.jboss.netty.example.localtime.LocalTimeProtocol.Locations other) { - if (other == org.jboss.netty.example.localtime.LocalTimeProtocol.Locations.getDefaultInstance()) { - return this; - } - if (!other.location_.isEmpty()) { - if (result.location_.isEmpty()) { - result.location_ = new java.util.ArrayList(); + if (other == org.jboss.netty.example.localtime.LocalTimeProtocol.Locations.getDefaultInstance()) return this; + if (locationBuilder_ == null) { + if (!other.location_.isEmpty()) { + if (location_.isEmpty()) { + location_ = other.location_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLocationIsMutable(); + location_.addAll(other.location_); + } + onChanged(); + } + } else { + if (!other.location_.isEmpty()) { + if (locationBuilder_.isEmpty()) { + locationBuilder_.dispose(); + locationBuilder_ = null; + location_ = other.location_; + bitField0_ = (bitField0_ & ~0x00000001); + locationBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getLocationFieldBuilder() : null; + } else { + locationBuilder_.addAllMessages(other.location_); + } } - result.location_.addAll(other.location_); } - mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.getUnknownFields()); return this; } - - @Override + + public final boolean isInitialized() { + for (int i = 0; i < getLocationCount(); i++) { + if (!getLocation(i).isInitialized()) { + + return false; + } + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( - getUnknownFields()); + this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: - setUnknownFields(unknownFields.build()); + this.setUnknownFields(unknownFields.build()); + onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - setUnknownFields(unknownFields.build()); + this.setUnknownFields(unknownFields.build()); + onChanged(); return this; } break; @@ -829,245 +1009,455 @@ public final class LocalTimeProtocol { } } } - - + + private int bitField0_; + // repeated .org.jboss.netty.example.localtime.Location location = 1; + private java.util.List location_ = + java.util.Collections.emptyList(); + private void ensureLocationIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + location_ = new java.util.ArrayList(location_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.jboss.netty.example.localtime.LocalTimeProtocol.Location, org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder, org.jboss.netty.example.localtime.LocalTimeProtocol.LocationOrBuilder> locationBuilder_; + public java.util.List getLocationList() { - return java.util.Collections.unmodifiableList(result.location_); + if (locationBuilder_ == null) { + return java.util.Collections.unmodifiableList(location_); + } else { + return locationBuilder_.getMessageList(); + } } public int getLocationCount() { - return result.getLocationCount(); + if (locationBuilder_ == null) { + return location_.size(); + } else { + return locationBuilder_.getCount(); + } } public org.jboss.netty.example.localtime.LocalTimeProtocol.Location getLocation(int index) { - return result.getLocation(index); - } - public Builder setLocation(int index, org.jboss.netty.example.localtime.LocalTimeProtocol.Location value) { - if (value == null) { - throw new NullPointerException(); + if (locationBuilder_ == null) { + return location_.get(index); + } else { + return locationBuilder_.getMessage(index); + } + } + public Builder setLocation( + int index, org.jboss.netty.example.localtime.LocalTimeProtocol.Location value) { + if (locationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocationIsMutable(); + location_.set(index, value); + onChanged(); + } else { + locationBuilder_.setMessage(index, value); } - result.location_.set(index, value); return this; } - public Builder setLocation(int index, org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder builderForValue) { - result.location_.set(index, builderForValue.build()); + public Builder setLocation( + int index, org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder builderForValue) { + if (locationBuilder_ == null) { + ensureLocationIsMutable(); + location_.set(index, builderForValue.build()); + onChanged(); + } else { + locationBuilder_.setMessage(index, builderForValue.build()); + } return this; } public Builder addLocation(org.jboss.netty.example.localtime.LocalTimeProtocol.Location value) { - if (value == null) { - throw new NullPointerException(); + if (locationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocationIsMutable(); + location_.add(value); + onChanged(); + } else { + locationBuilder_.addMessage(value); } - if (result.location_.isEmpty()) { - result.location_ = new java.util.ArrayList(); - } - result.location_.add(value); return this; } - public Builder addLocation(org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder builderForValue) { - if (result.location_.isEmpty()) { - result.location_ = new java.util.ArrayList(); + public Builder addLocation( + int index, org.jboss.netty.example.localtime.LocalTimeProtocol.Location value) { + if (locationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocationIsMutable(); + location_.add(index, value); + onChanged(); + } else { + locationBuilder_.addMessage(index, value); + } + return this; + } + public Builder addLocation( + org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder builderForValue) { + if (locationBuilder_ == null) { + ensureLocationIsMutable(); + location_.add(builderForValue.build()); + onChanged(); + } else { + locationBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addLocation( + int index, org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder builderForValue) { + if (locationBuilder_ == null) { + ensureLocationIsMutable(); + location_.add(index, builderForValue.build()); + onChanged(); + } else { + locationBuilder_.addMessage(index, builderForValue.build()); } - result.location_.add(builderForValue.build()); return this; } public Builder addAllLocation( java.lang.Iterable values) { - if (result.location_.isEmpty()) { - result.location_ = new java.util.ArrayList(); + if (locationBuilder_ == null) { + ensureLocationIsMutable(); + super.addAll(values, location_); + onChanged(); + } else { + locationBuilder_.addAllMessages(values); } - super.addAll(values, result.location_); return this; } public Builder clearLocation() { - result.location_ = java.util.Collections.emptyList(); + if (locationBuilder_ == null) { + location_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + locationBuilder_.clear(); + } return this; } - + public Builder removeLocation(int index) { + if (locationBuilder_ == null) { + ensureLocationIsMutable(); + location_.remove(index); + onChanged(); + } else { + locationBuilder_.remove(index); + } + return this; + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder getLocationBuilder( + int index) { + return getLocationFieldBuilder().getBuilder(index); + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocationOrBuilder getLocationOrBuilder( + int index) { + if (locationBuilder_ == null) { + return location_.get(index); } else { + return locationBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getLocationOrBuilderList() { + if (locationBuilder_ != null) { + return locationBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(location_); + } + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder addLocationBuilder() { + return getLocationFieldBuilder().addBuilder( + org.jboss.netty.example.localtime.LocalTimeProtocol.Location.getDefaultInstance()); + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder addLocationBuilder( + int index) { + return getLocationFieldBuilder().addBuilder( + index, org.jboss.netty.example.localtime.LocalTimeProtocol.Location.getDefaultInstance()); + } + public java.util.List + getLocationBuilderList() { + return getLocationFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.jboss.netty.example.localtime.LocalTimeProtocol.Location, org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder, org.jboss.netty.example.localtime.LocalTimeProtocol.LocationOrBuilder> + getLocationFieldBuilder() { + if (locationBuilder_ == null) { + locationBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.jboss.netty.example.localtime.LocalTimeProtocol.Location, org.jboss.netty.example.localtime.LocalTimeProtocol.Location.Builder, org.jboss.netty.example.localtime.LocalTimeProtocol.LocationOrBuilder>( + location_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + location_ = null; + } + return locationBuilder_; + } + // @@protoc_insertion_point(builder_scope:org.jboss.netty.example.localtime.Locations) } - + static { defaultInstance = new Locations(true); - org.jboss.netty.example.localtime.LocalTimeProtocol.internalForceInit(); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:org.jboss.netty.example.localtime.Locations) } - + + public interface LocalTimeOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required uint32 year = 1; + boolean hasYear(); + int getYear(); + + // required uint32 month = 2; + boolean hasMonth(); + int getMonth(); + + // required uint32 dayOfMonth = 4; + boolean hasDayOfMonth(); + int getDayOfMonth(); + + // required .org.jboss.netty.example.localtime.DayOfWeek dayOfWeek = 5; + boolean hasDayOfWeek(); + org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek getDayOfWeek(); + + // required uint32 hour = 6; + boolean hasHour(); + int getHour(); + + // required uint32 minute = 7; + boolean hasMinute(); + int getMinute(); + + // required uint32 second = 8; + boolean hasSecond(); + int getSecond(); + } public static final class LocalTime extends - com.google.protobuf.GeneratedMessage { + com.google.protobuf.GeneratedMessage + implements LocalTimeOrBuilder { // Use LocalTime.newBuilder() to construct. - private LocalTime() { - initFields(); + private LocalTime(Builder builder) { + super(builder); } private LocalTime(boolean noInit) {} - + private static final LocalTime defaultInstance; public static LocalTime getDefaultInstance() { return defaultInstance; } - - @Override + public LocalTime getDefaultInstanceForType() { return defaultInstance; } - - public static com.google.protobuf.Descriptors.Descriptor + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTime_descriptor; } - - @Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTime_fieldAccessorTable; } - + + private int bitField0_; // required uint32 year = 1; public static final int YEAR_FIELD_NUMBER = 1; - private boolean hasYear; - private int year_ = 0; - public boolean hasYear() { return hasYear; } - public int getYear() { return year_; } - + private int year_; + public boolean hasYear() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getYear() { + return year_; + } + // required uint32 month = 2; public static final int MONTH_FIELD_NUMBER = 2; - private boolean hasMonth; - private int month_ = 0; - public boolean hasMonth() { return hasMonth; } - public int getMonth() { return month_; } - + private int month_; + public boolean hasMonth() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getMonth() { + return month_; + } + // required uint32 dayOfMonth = 4; public static final int DAYOFMONTH_FIELD_NUMBER = 4; - private boolean hasDayOfMonth; - private int dayOfMonth_ = 0; - public boolean hasDayOfMonth() { return hasDayOfMonth; } - public int getDayOfMonth() { return dayOfMonth_; } - + private int dayOfMonth_; + public boolean hasDayOfMonth() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getDayOfMonth() { + return dayOfMonth_; + } + // required .org.jboss.netty.example.localtime.DayOfWeek dayOfWeek = 5; public static final int DAYOFWEEK_FIELD_NUMBER = 5; - private boolean hasDayOfWeek; private org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek dayOfWeek_; - public boolean hasDayOfWeek() { return hasDayOfWeek; } - public org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek getDayOfWeek() { return dayOfWeek_; } - + public boolean hasDayOfWeek() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek getDayOfWeek() { + return dayOfWeek_; + } + // required uint32 hour = 6; public static final int HOUR_FIELD_NUMBER = 6; - private boolean hasHour; - private int hour_ = 0; - public boolean hasHour() { return hasHour; } - public int getHour() { return hour_; } - + private int hour_; + public boolean hasHour() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public int getHour() { + return hour_; + } + // required uint32 minute = 7; public static final int MINUTE_FIELD_NUMBER = 7; - private boolean hasMinute; - private int minute_ = 0; - public boolean hasMinute() { return hasMinute; } - public int getMinute() { return minute_; } - + private int minute_; + public boolean hasMinute() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public int getMinute() { + return minute_; + } + // required uint32 second = 8; public static final int SECOND_FIELD_NUMBER = 8; - private boolean hasSecond; - private int second_ = 0; - public boolean hasSecond() { return hasSecond; } - public int getSecond() { return second_; } - + private int second_; + public boolean hasSecond() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public int getSecond() { + return second_; + } + private void initFields() { + year_ = 0; + month_ = 0; + dayOfMonth_ = 0; dayOfWeek_ = org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek.SUNDAY; + hour_ = 0; + minute_ = 0; + second_ = 0; } - @Override - public boolean isInitialized() { - if (!hasYear) { + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasYear()) { + memoizedIsInitialized = 0; return false; - } - if (!hasMonth) { + } + if (!hasMonth()) { + memoizedIsInitialized = 0; return false; - } - if (!hasDayOfMonth) { + } + if (!hasDayOfMonth()) { + memoizedIsInitialized = 0; return false; - } - if (!hasDayOfWeek) { + } + if (!hasDayOfWeek()) { + memoizedIsInitialized = 0; return false; - } - if (!hasHour) { + } + if (!hasHour()) { + memoizedIsInitialized = 0; return false; - } - if (!hasMinute) { + } + if (!hasMinute()) { + memoizedIsInitialized = 0; return false; + } + if (!hasSecond()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; } - return hasSecond; - } - - @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasYear()) { - output.writeUInt32(1, getYear()); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeUInt32(1, year_); } - if (hasMonth()) { - output.writeUInt32(2, getMonth()); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeUInt32(2, month_); } - if (hasDayOfMonth()) { - output.writeUInt32(4, getDayOfMonth()); + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeUInt32(4, dayOfMonth_); } - if (hasDayOfWeek()) { - output.writeEnum(5, getDayOfWeek().getNumber()); + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeEnum(5, dayOfWeek_.getNumber()); } - if (hasHour()) { - output.writeUInt32(6, getHour()); + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeUInt32(6, hour_); } - if (hasMinute()) { - output.writeUInt32(7, getMinute()); + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeUInt32(7, minute_); } - if (hasSecond()) { - output.writeUInt32(8, getSecond()); + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeUInt32(8, second_); } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; - @Override public int getSerializedSize() { int size = memoizedSerializedSize; - if (size != -1) { - return size; - } - + if (size != -1) return size; + size = 0; - if (hasYear()) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, getYear()); + .computeUInt32Size(1, year_); } - if (hasMonth()) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(2, getMonth()); + .computeUInt32Size(2, month_); } - if (hasDayOfMonth()) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(4, getDayOfMonth()); + .computeUInt32Size(4, dayOfMonth_); } - if (hasDayOfWeek()) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream - .computeEnumSize(5, getDayOfWeek().getNumber()); + .computeEnumSize(5, dayOfWeek_.getNumber()); } - if (hasHour()) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(6, getHour()); + .computeUInt32Size(6, hour_); } - if (hasMinute()) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(7, getMinute()); + .computeUInt32Size(7, minute_); } - if (hasSecond()) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(8, getSecond()); + .computeUInt32Size(8, second_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -1134,93 +1524,137 @@ public final class LocalTimeProtocol { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - + public static Builder newBuilder() { return Builder.create(); } - @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime prototype) { return newBuilder().mergeFrom(prototype); } - @Override public Builder toBuilder() { return newBuilder(this); } - + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder { - private org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime result; - + com.google.protobuf.GeneratedMessage.Builder + implements org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTime_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTime_fieldAccessorTable; + } + // Construct using org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime(); - return builder; + private Builder() { + maybeForceBuilderInitialization(); } - - @Override - protected org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime internalGetResult() { - return result; + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); } - - @Override - public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } - result = new org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime(); + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + year_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + month_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + dayOfMonth_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + dayOfWeek_ = org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek.SUNDAY; + bitField0_ = (bitField0_ & ~0x00000008); + hour_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + minute_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + second_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); return this; } - - @Override + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - - @Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.getDescriptor(); } - - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime getDefaultInstanceForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.getDefaultInstance(); } - - @Override - public boolean isInitialized() { - return result.isInitialized(); - } - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime build() { - if (result != null && !isInitialized()) { + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - + private org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } - return buildPartial(); + return result; } - - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime result = new org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; } - org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime returnMe = result; - result = null; - return returnMe; + result.year_ = year_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.month_ = month_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.dayOfMonth_ = dayOfMonth_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.dayOfWeek_ = dayOfWeek_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.hour_ = hour_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.minute_ = minute_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.second_ = second_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; } - - @Override + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime) { return mergeFrom((org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime)other); @@ -1229,11 +1663,9 @@ public final class LocalTimeProtocol { return this; } } - + public Builder mergeFrom(org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime other) { - if (other == org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.getDefaultInstance()) { - return this; - } + if (other == org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.getDefaultInstance()) return this; if (other.hasYear()) { setYear(other.getYear()); } @@ -1255,42 +1687,78 @@ public final class LocalTimeProtocol { if (other.hasSecond()) { setSecond(other.getSecond()); } - mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.getUnknownFields()); return this; } - - @Override + + public final boolean isInitialized() { + if (!hasYear()) { + + return false; + } + if (!hasMonth()) { + + return false; + } + if (!hasDayOfMonth()) { + + return false; + } + if (!hasDayOfWeek()) { + + return false; + } + if (!hasHour()) { + + return false; + } + if (!hasMinute()) { + + return false; + } + if (!hasSecond()) { + + return false; + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( - getUnknownFields()); + this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: - setUnknownFields(unknownFields.build()); + this.setUnknownFields(unknownFields.build()); + onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - setUnknownFields(unknownFields.build()); + this.setUnknownFields(unknownFields.build()); + onChanged(); return this; } break; } case 8: { - setYear(input.readUInt32()); + bitField0_ |= 0x00000001; + year_ = input.readUInt32(); break; } case 16: { - setMonth(input.readUInt32()); + bitField0_ |= 0x00000002; + month_ = input.readUInt32(); break; } case 32: { - setDayOfMonth(input.readUInt32()); + bitField0_ |= 0x00000004; + dayOfMonth_ = input.readUInt32(); break; } case 40: { @@ -1299,249 +1767,304 @@ public final class LocalTimeProtocol { if (value == null) { unknownFields.mergeVarintField(5, rawValue); } else { - setDayOfWeek(value); + bitField0_ |= 0x00000008; + dayOfWeek_ = value; } break; } case 48: { - setHour(input.readUInt32()); + bitField0_ |= 0x00000010; + hour_ = input.readUInt32(); break; } case 56: { - setMinute(input.readUInt32()); + bitField0_ |= 0x00000020; + minute_ = input.readUInt32(); break; } case 64: { - setSecond(input.readUInt32()); + bitField0_ |= 0x00000040; + second_ = input.readUInt32(); break; } } } } - - + + private int bitField0_; + // required uint32 year = 1; + private int year_ ; public boolean hasYear() { - return result.hasYear(); + return ((bitField0_ & 0x00000001) == 0x00000001); } public int getYear() { - return result.getYear(); + return year_; } public Builder setYear(int value) { - result.hasYear = true; - result.year_ = value; + bitField0_ |= 0x00000001; + year_ = value; + onChanged(); return this; } public Builder clearYear() { - result.hasYear = false; - result.year_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + year_ = 0; + onChanged(); return this; } - + // required uint32 month = 2; + private int month_ ; public boolean hasMonth() { - return result.hasMonth(); + return ((bitField0_ & 0x00000002) == 0x00000002); } public int getMonth() { - return result.getMonth(); + return month_; } public Builder setMonth(int value) { - result.hasMonth = true; - result.month_ = value; + bitField0_ |= 0x00000002; + month_ = value; + onChanged(); return this; } public Builder clearMonth() { - result.hasMonth = false; - result.month_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + month_ = 0; + onChanged(); return this; } - + // required uint32 dayOfMonth = 4; + private int dayOfMonth_ ; public boolean hasDayOfMonth() { - return result.hasDayOfMonth(); + return ((bitField0_ & 0x00000004) == 0x00000004); } public int getDayOfMonth() { - return result.getDayOfMonth(); + return dayOfMonth_; } public Builder setDayOfMonth(int value) { - result.hasDayOfMonth = true; - result.dayOfMonth_ = value; + bitField0_ |= 0x00000004; + dayOfMonth_ = value; + onChanged(); return this; } public Builder clearDayOfMonth() { - result.hasDayOfMonth = false; - result.dayOfMonth_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + dayOfMonth_ = 0; + onChanged(); return this; } - + // required .org.jboss.netty.example.localtime.DayOfWeek dayOfWeek = 5; + private org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek dayOfWeek_ = org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek.SUNDAY; public boolean hasDayOfWeek() { - return result.hasDayOfWeek(); + return ((bitField0_ & 0x00000008) == 0x00000008); } public org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek getDayOfWeek() { - return result.getDayOfWeek(); + return dayOfWeek_; } public Builder setDayOfWeek(org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek value) { if (value == null) { throw new NullPointerException(); } - result.hasDayOfWeek = true; - result.dayOfWeek_ = value; + bitField0_ |= 0x00000008; + dayOfWeek_ = value; + onChanged(); return this; } public Builder clearDayOfWeek() { - result.hasDayOfWeek = false; - result.dayOfWeek_ = org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek.SUNDAY; + bitField0_ = (bitField0_ & ~0x00000008); + dayOfWeek_ = org.jboss.netty.example.localtime.LocalTimeProtocol.DayOfWeek.SUNDAY; + onChanged(); return this; } - + // required uint32 hour = 6; + private int hour_ ; public boolean hasHour() { - return result.hasHour(); + return ((bitField0_ & 0x00000010) == 0x00000010); } public int getHour() { - return result.getHour(); + return hour_; } public Builder setHour(int value) { - result.hasHour = true; - result.hour_ = value; + bitField0_ |= 0x00000010; + hour_ = value; + onChanged(); return this; } public Builder clearHour() { - result.hasHour = false; - result.hour_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + hour_ = 0; + onChanged(); return this; } - + // required uint32 minute = 7; + private int minute_ ; public boolean hasMinute() { - return result.hasMinute(); + return ((bitField0_ & 0x00000020) == 0x00000020); } public int getMinute() { - return result.getMinute(); + return minute_; } public Builder setMinute(int value) { - result.hasMinute = true; - result.minute_ = value; + bitField0_ |= 0x00000020; + minute_ = value; + onChanged(); return this; } public Builder clearMinute() { - result.hasMinute = false; - result.minute_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + minute_ = 0; + onChanged(); return this; } - + // required uint32 second = 8; + private int second_ ; public boolean hasSecond() { - return result.hasSecond(); + return ((bitField0_ & 0x00000040) == 0x00000040); } public int getSecond() { - return result.getSecond(); + return second_; } public Builder setSecond(int value) { - result.hasSecond = true; - result.second_ = value; + bitField0_ |= 0x00000040; + second_ = value; + onChanged(); return this; } public Builder clearSecond() { - result.hasSecond = false; - result.second_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + second_ = 0; + onChanged(); return this; } - + // @@protoc_insertion_point(builder_scope:org.jboss.netty.example.localtime.LocalTime) } - + static { defaultInstance = new LocalTime(true); - org.jboss.netty.example.localtime.LocalTimeProtocol.internalForceInit(); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:org.jboss.netty.example.localtime.LocalTime) } - + + public interface LocalTimesOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .org.jboss.netty.example.localtime.LocalTime localTime = 1; + java.util.List + getLocalTimeList(); + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime getLocalTime(int index); + int getLocalTimeCount(); + java.util.List + getLocalTimeOrBuilderList(); + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimeOrBuilder getLocalTimeOrBuilder( + int index); + } public static final class LocalTimes extends - com.google.protobuf.GeneratedMessage { + com.google.protobuf.GeneratedMessage + implements LocalTimesOrBuilder { // Use LocalTimes.newBuilder() to construct. - private LocalTimes() { - initFields(); + private LocalTimes(Builder builder) { + super(builder); } private LocalTimes(boolean noInit) {} - + private static final LocalTimes defaultInstance; public static LocalTimes getDefaultInstance() { return defaultInstance; } - - @Override + public LocalTimes getDefaultInstanceForType() { return defaultInstance; } - - public static com.google.protobuf.Descriptors.Descriptor + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTimes_descriptor; } - - @Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTimes_fieldAccessorTable; } - + // repeated .org.jboss.netty.example.localtime.LocalTime localTime = 1; public static final int LOCALTIME_FIELD_NUMBER = 1; - private java.util.List localTime_ = - java.util.Collections.emptyList(); + private java.util.List localTime_; public java.util.List getLocalTimeList() { return localTime_; } - public int getLocalTimeCount() { return localTime_.size(); } + public java.util.List + getLocalTimeOrBuilderList() { + return localTime_; + } + public int getLocalTimeCount() { + return localTime_.size(); + } public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime getLocalTime(int index) { return localTime_.get(index); } - - private void initFields() { + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimeOrBuilder getLocalTimeOrBuilder( + int index) { + return localTime_.get(index); } - @Override - public boolean isInitialized() { - for (org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime element : getLocalTimeList()) { - if (!element.isInitialized()) { - return false; + + private void initFields() { + localTime_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getLocalTimeCount(); i++) { + if (!getLocalTime(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; } } + memoizedIsInitialized = 1; return true; } - - @Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - for (org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime element : getLocalTimeList()) { - output.writeMessage(1, element); + for (int i = 0; i < localTime_.size(); i++) { + output.writeMessage(1, localTime_.get(i)); } getUnknownFields().writeTo(output); } - + private int memoizedSerializedSize = -1; - @Override public int getSerializedSize() { int size = memoizedSerializedSize; - if (size != -1) { - return size; - } - + if (size != -1) return size; + size = 0; - for (org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime element : getLocalTimeList()) { + for (int i = 0; i < localTime_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, element); + .computeMessageSize(1, localTime_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } - + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + public static org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -1608,97 +2131,109 @@ public final class LocalTimeProtocol { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - + public static Builder newBuilder() { return Builder.create(); } - @Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes prototype) { return newBuilder().mergeFrom(prototype); } - @Override public Builder toBuilder() { return newBuilder(this); } - + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder { - private org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes result; - + com.google.protobuf.GeneratedMessage.Builder + implements org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTimes_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.jboss.netty.example.localtime.LocalTimeProtocol.internal_static_org_jboss_netty_example_localtime_LocalTimes_fieldAccessorTable; + } + // Construct using org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes(); - return builder; + private Builder() { + maybeForceBuilderInitialization(); } - - @Override - protected org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes internalGetResult() { - return result; + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); } - - @Override - public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getLocalTimeFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (localTimeBuilder_ == null) { + localTime_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + localTimeBuilder_.clear(); } - result = new org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes(); return this; } - - @Override + public Builder clone() { - return create().mergeFrom(result); + return create().mergeFrom(buildPartial()); } - - @Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes.getDescriptor(); } - - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes getDefaultInstanceForType() { return org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes.getDefaultInstance(); } - - @Override - public boolean isInitialized() { - return result.isInitialized(); - } - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes build() { - if (result != null && !isInitialized()) { + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException(result); } - return buildPartial(); + return result; } - + private org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes result = buildPartial(); + if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); } - return buildPartial(); + return result; } - - @Override + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes result = new org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes(this); + int from_bitField0_ = bitField0_; + if (localTimeBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + localTime_ = java.util.Collections.unmodifiableList(localTime_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.localTime_ = localTime_; + } else { + result.localTime_ = localTimeBuilder_.build(); } - if (result.localTime_ != java.util.Collections.EMPTY_LIST) { - result.localTime_ = - java.util.Collections.unmodifiableList(result.localTime_); - } - org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes returnMe = result; - result = null; - return returnMe; + onBuilt(); + return result; } - - @Override + public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes) { return mergeFrom((org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes)other); @@ -1707,39 +2242,68 @@ public final class LocalTimeProtocol { return this; } } - + public Builder mergeFrom(org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes other) { - if (other == org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes.getDefaultInstance()) { - return this; - } - if (!other.localTime_.isEmpty()) { - if (result.localTime_.isEmpty()) { - result.localTime_ = new java.util.ArrayList(); + if (other == org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimes.getDefaultInstance()) return this; + if (localTimeBuilder_ == null) { + if (!other.localTime_.isEmpty()) { + if (localTime_.isEmpty()) { + localTime_ = other.localTime_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLocalTimeIsMutable(); + localTime_.addAll(other.localTime_); + } + onChanged(); + } + } else { + if (!other.localTime_.isEmpty()) { + if (localTimeBuilder_.isEmpty()) { + localTimeBuilder_.dispose(); + localTimeBuilder_ = null; + localTime_ = other.localTime_; + bitField0_ = (bitField0_ & ~0x00000001); + localTimeBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getLocalTimeFieldBuilder() : null; + } else { + localTimeBuilder_.addAllMessages(other.localTime_); + } } - result.localTime_.addAll(other.localTime_); } - mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.getUnknownFields()); return this; } - - @Override + + public final boolean isInitialized() { + for (int i = 0; i < getLocalTimeCount(); i++) { + if (!getLocalTime(i).isInitialized()) { + + return false; + } + } + return true; + } + public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder( - getUnknownFields()); + this.getUnknownFields()); while (true) { int tag = input.readTag(); switch (tag) { case 0: - setUnknownFields(unknownFields.build()); + this.setUnknownFields(unknownFields.build()); + onChanged(); return this; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - setUnknownFields(unknownFields.build()); + this.setUnknownFields(unknownFields.build()); + onChanged(); return this; } break; @@ -1753,71 +2317,206 @@ public final class LocalTimeProtocol { } } } - - + + private int bitField0_; + // repeated .org.jboss.netty.example.localtime.LocalTime localTime = 1; + private java.util.List localTime_ = + java.util.Collections.emptyList(); + private void ensureLocalTimeIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + localTime_ = new java.util.ArrayList(localTime_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimeOrBuilder> localTimeBuilder_; + public java.util.List getLocalTimeList() { - return java.util.Collections.unmodifiableList(result.localTime_); + if (localTimeBuilder_ == null) { + return java.util.Collections.unmodifiableList(localTime_); + } else { + return localTimeBuilder_.getMessageList(); + } } public int getLocalTimeCount() { - return result.getLocalTimeCount(); + if (localTimeBuilder_ == null) { + return localTime_.size(); + } else { + return localTimeBuilder_.getCount(); + } } public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime getLocalTime(int index) { - return result.getLocalTime(index); - } - public Builder setLocalTime(int index, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime value) { - if (value == null) { - throw new NullPointerException(); + if (localTimeBuilder_ == null) { + return localTime_.get(index); + } else { + return localTimeBuilder_.getMessage(index); + } + } + public Builder setLocalTime( + int index, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime value) { + if (localTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocalTimeIsMutable(); + localTime_.set(index, value); + onChanged(); + } else { + localTimeBuilder_.setMessage(index, value); } - result.localTime_.set(index, value); return this; } - public Builder setLocalTime(int index, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder builderForValue) { - result.localTime_.set(index, builderForValue.build()); + public Builder setLocalTime( + int index, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder builderForValue) { + if (localTimeBuilder_ == null) { + ensureLocalTimeIsMutable(); + localTime_.set(index, builderForValue.build()); + onChanged(); + } else { + localTimeBuilder_.setMessage(index, builderForValue.build()); + } return this; } public Builder addLocalTime(org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime value) { - if (value == null) { - throw new NullPointerException(); + if (localTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocalTimeIsMutable(); + localTime_.add(value); + onChanged(); + } else { + localTimeBuilder_.addMessage(value); } - if (result.localTime_.isEmpty()) { - result.localTime_ = new java.util.ArrayList(); - } - result.localTime_.add(value); return this; } - public Builder addLocalTime(org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder builderForValue) { - if (result.localTime_.isEmpty()) { - result.localTime_ = new java.util.ArrayList(); + public Builder addLocalTime( + int index, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime value) { + if (localTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocalTimeIsMutable(); + localTime_.add(index, value); + onChanged(); + } else { + localTimeBuilder_.addMessage(index, value); + } + return this; + } + public Builder addLocalTime( + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder builderForValue) { + if (localTimeBuilder_ == null) { + ensureLocalTimeIsMutable(); + localTime_.add(builderForValue.build()); + onChanged(); + } else { + localTimeBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addLocalTime( + int index, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder builderForValue) { + if (localTimeBuilder_ == null) { + ensureLocalTimeIsMutable(); + localTime_.add(index, builderForValue.build()); + onChanged(); + } else { + localTimeBuilder_.addMessage(index, builderForValue.build()); } - result.localTime_.add(builderForValue.build()); return this; } public Builder addAllLocalTime( java.lang.Iterable values) { - if (result.localTime_.isEmpty()) { - result.localTime_ = new java.util.ArrayList(); + if (localTimeBuilder_ == null) { + ensureLocalTimeIsMutable(); + super.addAll(values, localTime_); + onChanged(); + } else { + localTimeBuilder_.addAllMessages(values); } - super.addAll(values, result.localTime_); return this; } public Builder clearLocalTime() { - result.localTime_ = java.util.Collections.emptyList(); + if (localTimeBuilder_ == null) { + localTime_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + localTimeBuilder_.clear(); + } return this; } - + public Builder removeLocalTime(int index) { + if (localTimeBuilder_ == null) { + ensureLocalTimeIsMutable(); + localTime_.remove(index); + onChanged(); + } else { + localTimeBuilder_.remove(index); + } + return this; + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder getLocalTimeBuilder( + int index) { + return getLocalTimeFieldBuilder().getBuilder(index); + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimeOrBuilder getLocalTimeOrBuilder( + int index) { + if (localTimeBuilder_ == null) { + return localTime_.get(index); } else { + return localTimeBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getLocalTimeOrBuilderList() { + if (localTimeBuilder_ != null) { + return localTimeBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(localTime_); + } + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder addLocalTimeBuilder() { + return getLocalTimeFieldBuilder().addBuilder( + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.getDefaultInstance()); + } + public org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder addLocalTimeBuilder( + int index) { + return getLocalTimeFieldBuilder().addBuilder( + index, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.getDefaultInstance()); + } + public java.util.List + getLocalTimeBuilderList() { + return getLocalTimeFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimeOrBuilder> + getLocalTimeFieldBuilder() { + if (localTimeBuilder_ == null) { + localTimeBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTime.Builder, org.jboss.netty.example.localtime.LocalTimeProtocol.LocalTimeOrBuilder>( + localTime_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + localTime_ = null; + } + return localTimeBuilder_; + } + // @@protoc_insertion_point(builder_scope:org.jboss.netty.example.localtime.LocalTimes) } - + static { defaultInstance = new LocalTimes(true); - org.jboss.netty.example.localtime.LocalTimeProtocol.internalForceInit(); defaultInstance.initFields(); } - + // @@protoc_insertion_point(class_scope:org.jboss.netty.example.localtime.LocalTimes) } - + private static com.google.protobuf.Descriptors.Descriptor internal_static_org_jboss_netty_example_localtime_Location_descriptor; private static @@ -1838,7 +2537,7 @@ public final class LocalTimeProtocol { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_org_jboss_netty_example_localtime_LocalTimes_fieldAccessorTable; - + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -1847,29 +2546,29 @@ public final class LocalTimeProtocol { descriptor; static { java.lang.String[] descriptorData = { - "\n\027LocalTimeProtocol.proto\022!org.jboss.net" + - "ty.example.localtime\"Y\n\010Location\022?\n\tcont" + - "inent\030\001 \002(\0162,.org.jboss.netty.example.lo" + - "caltime.Continent\022\014\n\004city\030\002 \002(\t\"J\n\tLocat" + - "ions\022=\n\010location\030\001 \003(\0132+.org.jboss.netty" + - ".example.localtime.Location\"\253\001\n\tLocalTim" + - "e\022\014\n\004year\030\001 \002(\r\022\r\n\005month\030\002 \002(\r\022\022\n\ndayOfM" + - "onth\030\004 \002(\r\022?\n\tdayOfWeek\030\005 \002(\0162,.org.jbos" + - "s.netty.example.localtime.DayOfWeek\022\014\n\004h" + - "our\030\006 \002(\r\022\016\n\006minute\030\007 \002(\r\022\016\n\006second\030\010 \002(", - "\r\"M\n\nLocalTimes\022?\n\tlocalTime\030\001 \003(\0132,.org" + - ".jboss.netty.example.localtime.LocalTime" + - "*\231\001\n\tContinent\022\n\n\006AFRICA\020\000\022\013\n\007AMERICA\020\001\022" + - "\016\n\nANTARCTICA\020\002\022\n\n\006ARCTIC\020\003\022\010\n\004ASIA\020\004\022\014\n" + - "\010ATLANTIC\020\005\022\r\n\tAUSTRALIA\020\006\022\n\n\006EUROPE\020\007\022\n" + - "\n\006INDIAN\020\010\022\013\n\007MIDEAST\020\t\022\013\n\007PACIFIC\020\n*g\n\t" + - "DayOfWeek\022\n\n\006SUNDAY\020\001\022\n\n\006MONDAY\020\002\022\013\n\007TUE" + - "SDAY\020\003\022\r\n\tWEDNESDAY\020\004\022\014\n\010THURSDAY\020\005\022\n\n\006F" + - "RIDAY\020\006\022\014\n\010SATURDAY\020\007B\002H\001" + "\nGsrc/main/java/org/jboss/netty/example/" + + "localtime/LocalTimeProtocol.proto\022!org.j" + + "boss.netty.example.localtime\"Y\n\010Location" + + "\022?\n\tcontinent\030\001 \002(\0162,.org.jboss.netty.ex" + + "ample.localtime.Continent\022\014\n\004city\030\002 \002(\t\"" + + "J\n\tLocations\022=\n\010location\030\001 \003(\0132+.org.jbo" + + "ss.netty.example.localtime.Location\"\253\001\n\t" + + "LocalTime\022\014\n\004year\030\001 \002(\r\022\r\n\005month\030\002 \002(\r\022\022" + + "\n\ndayOfMonth\030\004 \002(\r\022?\n\tdayOfWeek\030\005 \002(\0162,." + + "org.jboss.netty.example.localtime.DayOfW", + "eek\022\014\n\004hour\030\006 \002(\r\022\016\n\006minute\030\007 \002(\r\022\016\n\006sec" + + "ond\030\010 \002(\r\"M\n\nLocalTimes\022?\n\tlocalTime\030\001 \003" + + "(\0132,.org.jboss.netty.example.localtime.L" + + "ocalTime*\231\001\n\tContinent\022\n\n\006AFRICA\020\000\022\013\n\007AM" + + "ERICA\020\001\022\016\n\nANTARCTICA\020\002\022\n\n\006ARCTIC\020\003\022\010\n\004A" + + "SIA\020\004\022\014\n\010ATLANTIC\020\005\022\r\n\tAUSTRALIA\020\006\022\n\n\006EU" + + "ROPE\020\007\022\n\n\006INDIAN\020\010\022\013\n\007MIDEAST\020\t\022\013\n\007PACIF" + + "IC\020\n*g\n\tDayOfWeek\022\n\n\006SUNDAY\020\001\022\n\n\006MONDAY\020" + + "\002\022\013\n\007TUESDAY\020\003\022\r\n\tWEDNESDAY\020\004\022\014\n\010THURSDA" + + "Y\020\005\022\n\n\006FRIDAY\020\006\022\014\n\010SATURDAY\020\007B\002H\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - @Override public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; @@ -1913,8 +2612,6 @@ public final class LocalTimeProtocol { new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); } - - public static void internalForceInit() {} - + // @@protoc_insertion_point(outer_class_scope) } diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.proto b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.proto index 197275adee..6dcec2faee 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.proto +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.proto @@ -15,6 +15,13 @@ */ package org.jboss.netty.example.localtime; +// How to generate +// =============== +// $ protoc src/main/java/org/jboss/netty/example/localtime/LocalTimeProtocol.proto \ +// --java_out=src/main/java +// +// Add @SuppressWarnings("all") to the generated code not to pollute IDE task list. + option optimize_for = SPEED; enum Continent { From bbd251baed34001bdf8590811dba70f231e6c732 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 24 Nov 2011 12:16:31 +0900 Subject: [PATCH 68/93] Fix build errors --- pom.xml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 435e023f97..44cc22f217 100644 --- a/pom.xml +++ b/pom.xml @@ -479,7 +479,7 @@ maven-jxr-plugin - 2.3 + 2.2 generate-xref @@ -515,6 +515,36 @@ + + org.eclipse.wst.css + core + 1.1.101-v200705302225 + + + org.apache + xerces + + + com.ibm + icu + + + + + org.eclipse.wst.sse + core + 1.1.202-v200709061102 + + + org.apache + xerces + + + com.ibm + icu + + + org.jboss jbossorg-docbook-xslt From caa925198e8eca352d5b679e38311d6c3ba33aef Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 24 Nov 2011 09:51:49 +0100 Subject: [PATCH 69/93] Make OrderedMemoryAwareThreadPoolExecutor lock free --- .../OrderedMemoryAwareThreadPoolExecutor.java | 67 ++++++++++--------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java index 6d03fb029c..f2729d542f 100644 --- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java @@ -16,13 +16,14 @@ package org.jboss.netty.handler.execution; import java.util.IdentityHashMap; -import java.util.LinkedList; import java.util.Set; import java.util.WeakHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelEvent; @@ -284,51 +285,57 @@ public class OrderedMemoryAwareThreadPoolExecutor extends } private final class ChildExecutor implements Executor, Runnable { - private final LinkedList tasks = new LinkedList(); - + private final ConcurrentLinkedQueue tasks = new ConcurrentLinkedQueue(); + private final AtomicBoolean isRunning = new AtomicBoolean(false); + ChildExecutor() { } @Override public void execute(Runnable command) { - boolean needsExecution; - synchronized (tasks) { - needsExecution = tasks.isEmpty(); - tasks.add(command); - } + tasks.add(command); + - if (needsExecution) { + if (isRunning.get() == false) { doUnorderedExecute(this); } } @Override public void run() { - Thread thread = Thread.currentThread(); - for (;;) { - final Runnable task; - synchronized (tasks) { - task = tasks.getFirst(); - } - - boolean ran = false; - beforeExecute(thread, task); + // check if its already running by using CAS. If so just return here. So in the worst case the thread + // is executed and do nothing + if (isRunning.compareAndSet(false, true)) { try { - task.run(); - ran = true; - onAfterExecute(task, null); - } catch (RuntimeException e) { - if (!ran) { - onAfterExecute(task, e); - } - throw e; - } finally { - synchronized (tasks) { - tasks.removeFirst(); - if (tasks.isEmpty()) { + Thread thread = Thread.currentThread(); + for (;;) { + final Runnable task = tasks.poll(); + // this should never happen but just in case check if + // the queue was empty + if (task == null) { break; } + + boolean ran = false; + beforeExecute(thread, task); + try { + task.run(); + ran = true; + onAfterExecute(task, null); + } catch (RuntimeException e) { + if (!ran) { + onAfterExecute(task, e); + } + throw e; + } finally { + if (tasks.isEmpty()) { + break; + } + } } + } finally { + // set it back to not running + isRunning.set(false); } } } From 9f712e3291565fa357a959b26dbe77da59691aa8 Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 24 Nov 2011 11:07:16 +0100 Subject: [PATCH 70/93] Replace synchronization with an lock free approach --- .../OrderedMemoryAwareThreadPoolExecutor.java | 67 ++++++++++--------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java index 6d03fb029c..f2729d542f 100644 --- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java @@ -16,13 +16,14 @@ package org.jboss.netty.handler.execution; import java.util.IdentityHashMap; -import java.util.LinkedList; import java.util.Set; import java.util.WeakHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelEvent; @@ -284,51 +285,57 @@ public class OrderedMemoryAwareThreadPoolExecutor extends } private final class ChildExecutor implements Executor, Runnable { - private final LinkedList tasks = new LinkedList(); - + private final ConcurrentLinkedQueue tasks = new ConcurrentLinkedQueue(); + private final AtomicBoolean isRunning = new AtomicBoolean(false); + ChildExecutor() { } @Override public void execute(Runnable command) { - boolean needsExecution; - synchronized (tasks) { - needsExecution = tasks.isEmpty(); - tasks.add(command); - } + tasks.add(command); + - if (needsExecution) { + if (isRunning.get() == false) { doUnorderedExecute(this); } } @Override public void run() { - Thread thread = Thread.currentThread(); - for (;;) { - final Runnable task; - synchronized (tasks) { - task = tasks.getFirst(); - } - - boolean ran = false; - beforeExecute(thread, task); + // check if its already running by using CAS. If so just return here. So in the worst case the thread + // is executed and do nothing + if (isRunning.compareAndSet(false, true)) { try { - task.run(); - ran = true; - onAfterExecute(task, null); - } catch (RuntimeException e) { - if (!ran) { - onAfterExecute(task, e); - } - throw e; - } finally { - synchronized (tasks) { - tasks.removeFirst(); - if (tasks.isEmpty()) { + Thread thread = Thread.currentThread(); + for (;;) { + final Runnable task = tasks.poll(); + // this should never happen but just in case check if + // the queue was empty + if (task == null) { break; } + + boolean ran = false; + beforeExecute(thread, task); + try { + task.run(); + ran = true; + onAfterExecute(task, null); + } catch (RuntimeException e) { + if (!ran) { + onAfterExecute(task, e); + } + throw e; + } finally { + if (tasks.isEmpty()) { + break; + } + } } + } finally { + // set it back to not running + isRunning.set(false); } } } From 2686dc99b42046eb6f5fbe08ff628bef7da612a2 Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 24 Nov 2011 11:13:54 +0100 Subject: [PATCH 71/93] Add some TODO --- .../handler/execution/OrderedMemoryAwareThreadPoolExecutor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java index f2729d542f..185c185473 100644 --- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java @@ -293,6 +293,7 @@ public class OrderedMemoryAwareThreadPoolExecutor extends @Override public void execute(Runnable command) { + // TODO: What todo if the add return false ? tasks.add(command); From a382149bba690626e8f64c67d87f4f293525b8bc Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 24 Nov 2011 11:32:05 +0100 Subject: [PATCH 72/93] Catch InterruptedException and interrupt the current Thread so we at least give someone the chance todo something about it. --- .../netty/handler/execution/MemoryAwareThreadPoolExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index ca849d532a..ad63becd3f 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -545,7 +545,7 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { try { wait(); } catch (InterruptedException e) { - // Ignore + Thread.currentThread().interrupt(); } finally { waiters --; } From 263f2fe98ba9dd72dc618ddba57b7d141920fc22 Mon Sep 17 00:00:00 2001 From: norman Date: Fri, 25 Nov 2011 09:13:37 +0100 Subject: [PATCH 73/93] Make it easier to issue the handshake when SslHandler is used in a client. See #84 --- .../jboss/netty/handler/ssl/SslHandler.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java b/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java index bf6926a710..7e151f0c97 100644 --- a/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java +++ b/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java @@ -67,6 +67,14 @@ import org.jboss.netty.util.internal.NonReentrantLock; * returned by the {@link #handshake()} method when the handshake * process succeeds or fails. * + *

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. + *

+ * *

Renegotiation

*

* If {@link #isEnableRenegotiation() enableRenegotiation} is {@code true} @@ -192,7 +200,19 @@ public class SslHandler extends FrameDecoder private final Queue pendingUnencryptedWrites = new LinkedList(); private final Queue pendingEncryptedWrites = new LinkedTransferQueue(); private final NonReentrantLock pendingEncryptedWritesLock = new NonReentrantLock(); + private volatile boolean issueHandshake = false; + + private static final ChannelFutureListener HANDSHAKE_LISTENER = new ChannelFutureListener() { + @Override + public void operationComplete(ChannelFuture future) throws Exception { + if (!future.isSuccess()) { + Channels.fireExceptionCaught(future.getChannel(), future.getCause()); + } + } + + }; + /** * Creates a new instance. * @@ -396,6 +416,23 @@ public class SslHandler extends FrameDecoder this.enableRenegotiation = enableRenegotiation; } + + /** + * Enables or disables the automatic handshake once the {@link Channel} is connected. The value will only have affect if its set before the + * {@link Channel} is connected. + * + */ + public void setIssueHandshake(boolean issueHandshake) { + this.issueHandshake = issueHandshake; + } + + /** + * Returns true if the automatic handshake is enabled + */ + public boolean isIssueHandshake() { + return issueHandshake; + } + @Override public void handleDownstream( final ChannelHandlerContext context, final ChannelEvent evt) throws Exception { @@ -1151,4 +1188,18 @@ public class SslHandler extends FrameDecoder public void afterRemove(ChannelHandlerContext ctx) throws Exception { // Unused } + + + /** + * Calls {@link #handshake()} once the {@link Channel} is connected + */ + @Override + public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { + if (issueHandshake) { + // 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(HANDSHAKE_LISTENER); + } + super.channelConnected(ctx, e); + } } From 6b7b822f721e7f8f72cef71bf2aa01d5d1002ee3 Mon Sep 17 00:00:00 2001 From: norman Date: Fri, 25 Nov 2011 14:00:17 +0100 Subject: [PATCH 74/93] Revert "Make OrderedMemoryAwareThreadPoolExecutor lock free" This reverts commit caa925198e8eca352d5b679e38311d6c3ba33aef. --- .../OrderedMemoryAwareThreadPoolExecutor.java | 67 +++++++++---------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java index f2729d542f..6d03fb029c 100644 --- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java @@ -16,14 +16,13 @@ package org.jboss.netty.handler.execution; import java.util.IdentityHashMap; +import java.util.LinkedList; import java.util.Set; import java.util.WeakHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelEvent; @@ -285,57 +284,51 @@ public class OrderedMemoryAwareThreadPoolExecutor extends } private final class ChildExecutor implements Executor, Runnable { - private final ConcurrentLinkedQueue tasks = new ConcurrentLinkedQueue(); - private final AtomicBoolean isRunning = new AtomicBoolean(false); - + private final LinkedList tasks = new LinkedList(); + ChildExecutor() { } @Override public void execute(Runnable command) { - tasks.add(command); - + boolean needsExecution; + synchronized (tasks) { + needsExecution = tasks.isEmpty(); + tasks.add(command); + } - if (isRunning.get() == false) { + if (needsExecution) { doUnorderedExecute(this); } } @Override public void run() { - // check if its already running by using CAS. If so just return here. So in the worst case the thread - // is executed and do nothing - if (isRunning.compareAndSet(false, true)) { + Thread thread = Thread.currentThread(); + for (;;) { + final Runnable task; + synchronized (tasks) { + task = tasks.getFirst(); + } + + boolean ran = false; + beforeExecute(thread, task); try { - Thread thread = Thread.currentThread(); - for (;;) { - final Runnable task = tasks.poll(); - // this should never happen but just in case check if - // the queue was empty - if (task == null) { + task.run(); + ran = true; + onAfterExecute(task, null); + } catch (RuntimeException e) { + if (!ran) { + onAfterExecute(task, e); + } + throw e; + } finally { + synchronized (tasks) { + tasks.removeFirst(); + if (tasks.isEmpty()) { break; } - - boolean ran = false; - beforeExecute(thread, task); - try { - task.run(); - ran = true; - onAfterExecute(task, null); - } catch (RuntimeException e) { - if (!ran) { - onAfterExecute(task, e); - } - throw e; - } finally { - if (tasks.isEmpty()) { - break; - } - } } - } finally { - // set it back to not running - isRunning.set(false); } } } From e68aa06dfa374c52270555ec62d695b565dd927d Mon Sep 17 00:00:00 2001 From: norman Date: Fri, 25 Nov 2011 14:00:56 +0100 Subject: [PATCH 75/93] Revert committed change which I added by mistake --- .../netty/handler/execution/MemoryAwareThreadPoolExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index ad63becd3f..ca849d532a 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -545,7 +545,7 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { try { wait(); } catch (InterruptedException e) { - Thread.currentThread().interrupt(); + // Ignore } finally { waiters --; } From 1bb3322268b26a2efb0a965e5982b12ce5510cb1 Mon Sep 17 00:00:00 2001 From: norman Date: Fri, 25 Nov 2011 14:03:17 +0100 Subject: [PATCH 76/93] Catch InterruptedException and interrupt the current Thread so we at least give someone the chance todo something about it. --- .../netty/handler/execution/MemoryAwareThreadPoolExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index ca849d532a..ad63becd3f 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -545,7 +545,7 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { try { wait(); } catch (InterruptedException e) { - // Ignore + Thread.currentThread().interrupt(); } finally { waiters --; } From 8efe131eb0881e8c39eca1e537006224be1ef6da Mon Sep 17 00:00:00 2001 From: Veebs Date: Mon, 28 Nov 2011 22:27:58 +1100 Subject: [PATCH 77/93] Fix closing handshake and run against Autobahn V0.4.3 --- .../websocketx/autobahn/package-info.java | 13 ++++++++----- .../websocketx/WebSocket08FrameDecoder.java | 19 +++++++++++-------- .../WebSocketServerHandshaker10.java | 7 +++++-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/package-info.java b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/package-info.java index 46de920b06..3d010b0da2 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/package-info.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/package-info.java @@ -32,20 +32,23 @@ * *

06. Go to AutoBahn directory: cd Autobahn * - *

07. Checkout stable version: git checkout v0.4.2 + *

07. Checkout stable version: git checkout v0.4.3 * *

08. Go to test suite directory: cd testsuite/websockets * - *

09. Edit fuzzing_clinet_spec.json and set the version to 10. + *

09. Edit fuzzing_clinet_spec.json and set the version to 10 or 17. * * { - * "servers": [{"agent": "Netty", "hostname": "localhost", "port": 9000, "version": 10}], - * "cases": ["*"] + * "options": {"failByDrop": false}, + * "servers": [{"agent": "Netty", "url": "ws://localhost:9000", "options": {"version": 17}}], + * "cases": ["*"], + * "exclude-cases": [], + * "exclude-agent-cases": {"FoobarServer*": ["4.*", "1.1.3"]} * } * * *

10. Run the test python fuzzing_client.py. Note that the actual test case python code is - * located in /usr/local/lib/python2.6/dist-packages/autobahn-0.4.2-py2.6.egg/autobahn/cases + * located in /usr/local/lib/python2.6/dist-packages/autobahn-0.4.3-py2.6.egg/autobahn/cases * and not in the checked out git repository. * *

11. See the results in reports/servers/index.html diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java index 146768db62..9ac57aa992 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java @@ -260,7 +260,17 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder Date: Tue, 29 Nov 2011 09:45:13 +1100 Subject: [PATCH 78/93] Added support for Hybi V17 and run against Autobahn V0.4.3 --- .../websocketx/WebSocket08FrameDecoder.java | 556 +++++++++--------- .../websocketx/WebSocket08FrameEncoder.java | 6 +- .../websocketx/WebSocket13FrameDecoder.java | 61 ++ .../websocketx/WebSocket13FrameEncoder.java | 62 ++ .../WebSocketClientHandshaker17.java | 186 ++++++ .../WebSocketClientHandshakerFactory.java | 3 + .../WebSocketServerHandshaker17.java | 168 ++++++ .../WebSocketServerHandshakerFactory.java | 115 ++-- .../WebSocketSpecificationVersion.java | 10 +- 9 files changed, 835 insertions(+), 332 deletions(-) create mode 100644 src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket13FrameDecoder.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket13FrameEncoder.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker17.java create mode 100644 src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker17.java diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java index 9ac57aa992..4a346f1a25 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java @@ -59,317 +59,325 @@ import org.jboss.netty.logging.InternalLoggerFactory; */ public class WebSocket08FrameDecoder extends ReplayingDecoder { - private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameDecoder.class); + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameDecoder.class); - private static final byte OPCODE_CONT = 0x0; - private static final byte OPCODE_TEXT = 0x1; - private static final byte OPCODE_BINARY = 0x2; - private static final byte OPCODE_CLOSE = 0x8; - private static final byte OPCODE_PING = 0x9; - private static final byte OPCODE_PONG = 0xA; + private static final byte OPCODE_CONT = 0x0; + private static final byte OPCODE_TEXT = 0x1; + private static final byte OPCODE_BINARY = 0x2; + private static final byte OPCODE_CLOSE = 0x8; + private static final byte OPCODE_PING = 0x9; + private static final byte OPCODE_PONG = 0xA; - private UTF8Output fragmentedFramesText = null; - private int fragmentedFramesCount = 0; + private UTF8Output fragmentedFramesText = null; + private int fragmentedFramesCount = 0; - private boolean frameFinalFlag; - private int frameRsv; - private int frameOpcode; - private long framePayloadLength; - private ChannelBuffer framePayload = null; - private int framePayloadBytesRead = 0; - private ChannelBuffer maskingKey; + private boolean frameFinalFlag; + private int frameRsv; + private int frameOpcode; + private long framePayloadLength; + private ChannelBuffer framePayload = null; + private int framePayloadBytesRead = 0; + private ChannelBuffer maskingKey; - private boolean allowExtensions = false; - private boolean maskedPayload = false; - private boolean receivedClosingHandshake = false; + private boolean allowExtensions = false; + private boolean maskedPayload = false; + private boolean receivedClosingHandshake = false; - public enum State { - FRAME_START, MASKING_KEY, PAYLOAD, CORRUPT - } + public enum State { + FRAME_START, MASKING_KEY, PAYLOAD, CORRUPT + } - /** - * Constructor - * - * @param maskedPayload - * Web socket servers must set this to true processed incoming - * masked payload. Client implementations must set this to false. - * @param allowExtensions - * Flag to allow reserved extension bits to be used or not - */ - public WebSocket08FrameDecoder(boolean maskedPayload, boolean allowExtensions) { - super(State.FRAME_START); - this.maskedPayload = maskedPayload; - this.allowExtensions = allowExtensions; - } + /** + * Constructor + * + * @param maskedPayload + * Web socket servers must set this to true processed incoming + * masked payload. Client implementations must set this to false. + * @param allowExtensions + * Flag to allow reserved extension bits to be used or not + */ + public WebSocket08FrameDecoder(boolean maskedPayload, boolean allowExtensions) { + super(State.FRAME_START); + this.maskedPayload = maskedPayload; + this.allowExtensions = allowExtensions; + } - @Override - protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, State state) throws Exception { + @Override + protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, State state) + throws Exception { - // Discard all data received if closing handshake was received before. - if (receivedClosingHandshake) { - buffer.skipBytes(actualReadableBytes()); - return null; - } + // Discard all data received if closing handshake was received before. + if (receivedClosingHandshake) { + buffer.skipBytes(actualReadableBytes()); + return null; + } - switch (state) { - case FRAME_START: - framePayloadBytesRead = 0; - framePayloadLength = -1; - framePayload = null; + switch (state) { + case FRAME_START: + framePayloadBytesRead = 0; + framePayloadLength = -1; + framePayload = null; - // FIN, RSV, OPCODE - byte b = buffer.readByte(); - frameFinalFlag = (b & 0x80) != 0; - frameRsv = (b & 0x70) >> 4; - frameOpcode = (b & 0x0F); + // FIN, RSV, OPCODE + byte b = buffer.readByte(); + frameFinalFlag = (b & 0x80) != 0; + frameRsv = (b & 0x70) >> 4; + frameOpcode = (b & 0x0F); - logger.debug("Decoding WebSocket Frame opCode=" + frameOpcode); + if (logger.isDebugEnabled()) { + logger.debug("Decoding WebSocket Frame opCode=" + frameOpcode); + } - // MASK, PAYLOAD LEN 1 - b = buffer.readByte(); - boolean frameMasked = (b & 0x80) != 0; - int framePayloadLen1 = (b & 0x7F); + // MASK, PAYLOAD LEN 1 + b = buffer.readByte(); + boolean frameMasked = (b & 0x80) != 0; + int framePayloadLen1 = (b & 0x7F); - if (frameRsv != 0 && !this.allowExtensions) { - protocolViolation(channel, "RSV != 0 and no extension negotiated, RSV:" + frameRsv); - return null; - } + if (frameRsv != 0 && !this.allowExtensions) { + protocolViolation(channel, "RSV != 0 and no extension negotiated, RSV:" + frameRsv); + return null; + } - if (this.maskedPayload && !frameMasked) { - protocolViolation(channel, "unmasked client to server frame"); - return null; - } - if (frameOpcode > 7) { // control frame (have MSB in opcode set) + if (this.maskedPayload && !frameMasked) { + protocolViolation(channel, "unmasked client to server frame"); + return null; + } + if (frameOpcode > 7) { // control frame (have MSB in opcode set) - // control frames MUST NOT be fragmented - if (!frameFinalFlag) { - protocolViolation(channel, "fragmented control frame"); - return null; - } + // control frames MUST NOT be fragmented + if (!frameFinalFlag) { + protocolViolation(channel, "fragmented control frame"); + return null; + } - // control frames MUST have payload 125 octets or less - if (framePayloadLen1 > 125) { - protocolViolation(channel, "control frame with payload length > 125 octets"); - return null; - } + // control frames MUST have payload 125 octets or less + if (framePayloadLen1 > 125) { + protocolViolation(channel, "control frame with payload length > 125 octets"); + return null; + } - // check for reserved control frame opcodes - if (!(frameOpcode == OPCODE_CLOSE || frameOpcode == OPCODE_PING || frameOpcode == OPCODE_PONG)) { - protocolViolation(channel, "control frame using reserved opcode " + frameOpcode); - return null; - } + // check for reserved control frame opcodes + if (!(frameOpcode == OPCODE_CLOSE || frameOpcode == OPCODE_PING || frameOpcode == OPCODE_PONG)) { + protocolViolation(channel, "control frame using reserved opcode " + frameOpcode); + return null; + } - // close frame : if there is a body, the first two bytes of the - // body MUST be a 2-byte - // unsigned integer (in network byte order) representing a - // status code - if (frameOpcode == 8 && framePayloadLen1 == 1) { - protocolViolation(channel, "received close control frame with payload len 1"); - return null; - } - } else { // data frame - // check for reserved data frame opcodes - if (!(frameOpcode == OPCODE_CONT || frameOpcode == OPCODE_TEXT || frameOpcode == OPCODE_BINARY)) { - protocolViolation(channel, "data frame using reserved opcode " + frameOpcode); - return null; - } + // close frame : if there is a body, the first two bytes of the + // body MUST be a 2-byte unsigned integer (in network byte + // order) representing a status code + if (frameOpcode == 8 && framePayloadLen1 == 1) { + protocolViolation(channel, "received close control frame with payload len 1"); + return null; + } + } else { // data frame + // check for reserved data frame opcodes + if (!(frameOpcode == OPCODE_CONT || frameOpcode == OPCODE_TEXT || frameOpcode == OPCODE_BINARY)) { + protocolViolation(channel, "data frame using reserved opcode " + frameOpcode); + return null; + } - // check opcode vs message fragmentation state 1/2 - if (fragmentedFramesCount == 0 && frameOpcode == OPCODE_CONT) { - protocolViolation(channel, "received continuation data frame outside fragmented message"); - return null; - } + // check opcode vs message fragmentation state 1/2 + if (fragmentedFramesCount == 0 && frameOpcode == OPCODE_CONT) { + protocolViolation(channel, "received continuation data frame outside fragmented message"); + return null; + } - // check opcode vs message fragmentation state 2/2 - if (fragmentedFramesCount != 0 && frameOpcode != OPCODE_CONT && frameOpcode != OPCODE_PING) { - protocolViolation(channel, "received non-continuation data frame while inside fragmented message"); - return null; - } - } + // check opcode vs message fragmentation state 2/2 + if (fragmentedFramesCount != 0 && frameOpcode != OPCODE_CONT && frameOpcode != OPCODE_PING) { + protocolViolation(channel, "received non-continuation data frame while inside fragmented message"); + return null; + } + } - if (framePayloadLen1 == 126) { - framePayloadLength = buffer.readUnsignedShort(); - if (framePayloadLength < 126) { - protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); - return null; - } - } else if (framePayloadLen1 == 127) { - framePayloadLength = buffer.readLong(); - // TODO: check if it's bigger than 0x7FFFFFFFFFFFFFFF, Maybe - // just check if it's negative? + // Read frame payload length + if (framePayloadLen1 == 126) { + framePayloadLength = buffer.readUnsignedShort(); + if (framePayloadLength < 126) { + protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); + return null; + } + } else if (framePayloadLen1 == 127) { + framePayloadLength = buffer.readLong(); + // TODO: check if it's bigger than 0x7FFFFFFFFFFFFFFF, Maybe + // just check if it's negative? - if (framePayloadLength < 65536) { - protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); - return null; - } - } else { - framePayloadLength = framePayloadLen1; - } + if (framePayloadLength < 65536) { + protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); + return null; + } + } else { + framePayloadLength = framePayloadLen1; + } - // logger.debug("Frame length=" + framePayloadLength); - checkpoint(State.MASKING_KEY); - case MASKING_KEY: - if (this.maskedPayload) { - maskingKey = buffer.readBytes(4); - } - checkpoint(State.PAYLOAD); - case PAYLOAD: - // Some times, the payload may not be delivered in 1 nice packet - // We need to accumulate the data until we have it all - int rbytes = actualReadableBytes(); - ChannelBuffer payloadBuffer = null; + if (logger.isDebugEnabled()) { + logger.debug("Decoding WebSocket Frame length=" + framePayloadLength); + } - int willHaveReadByteCount = framePayloadBytesRead + rbytes; - // logger.debug("Frame rbytes=" + rbytes + " willHaveReadByteCount=" - // + willHaveReadByteCount + " framePayloadLength=" + - // framePayloadLength); - if (willHaveReadByteCount == framePayloadLength) { - // We have all our content so proceed to process - payloadBuffer = buffer.readBytes(rbytes); - } else if (willHaveReadByteCount < framePayloadLength) { - // We don't have all our content so accumulate payload. - // Returning null means we will get called back - payloadBuffer = buffer.readBytes(rbytes); - if (framePayload == null) { - framePayload = channel.getConfig().getBufferFactory().getBuffer(toFrameLength(framePayloadLength)); - } - framePayload.writeBytes(payloadBuffer); - framePayloadBytesRead = framePayloadBytesRead + rbytes; + checkpoint(State.MASKING_KEY); + case MASKING_KEY: + if (this.maskedPayload) { + maskingKey = buffer.readBytes(4); + } + checkpoint(State.PAYLOAD); + case PAYLOAD: + // Sometimes, the payload may not be delivered in 1 nice packet + // We need to accumulate the data until we have it all + int rbytes = actualReadableBytes(); + ChannelBuffer payloadBuffer = null; - // Return null to wait for more bytes to arrive - return null; - } else if (willHaveReadByteCount > framePayloadLength) { - // We have more than what we need so read up to the end of frame - // Leave the remainder in the buffer for next frame - payloadBuffer = buffer.readBytes(toFrameLength(framePayloadLength - framePayloadBytesRead)); - } + int willHaveReadByteCount = framePayloadBytesRead + rbytes; + // logger.debug("Frame rbytes=" + rbytes + " willHaveReadByteCount=" + // + willHaveReadByteCount + " framePayloadLength=" + + // framePayloadLength); + if (willHaveReadByteCount == framePayloadLength) { + // We have all our content so proceed to process + payloadBuffer = buffer.readBytes(rbytes); + } else if (willHaveReadByteCount < framePayloadLength) { + // We don't have all our content so accumulate payload. + // Returning null means we will get called back + payloadBuffer = buffer.readBytes(rbytes); + if (framePayload == null) { + framePayload = channel.getConfig().getBufferFactory().getBuffer(toFrameLength(framePayloadLength)); + } + framePayload.writeBytes(payloadBuffer); + framePayloadBytesRead = framePayloadBytesRead + rbytes; - // Now we have all the data, the next checkpoint must be the next - // frame - checkpoint(State.FRAME_START); + // Return null to wait for more bytes to arrive + return null; + } else if (willHaveReadByteCount > framePayloadLength) { + // We have more than what we need so read up to the end of frame + // Leave the remainder in the buffer for next frame + payloadBuffer = buffer.readBytes(toFrameLength(framePayloadLength - framePayloadBytesRead)); + } - // Take the data that we have in this packet - if (framePayload == null) { - framePayload = payloadBuffer; - } else { - framePayload.writeBytes(payloadBuffer); - } + // Now we have all the data, the next checkpoint must be the next + // frame + checkpoint(State.FRAME_START); - // Unmask data if needed - if (this.maskedPayload) { - unmask(framePayload); - } + // Take the data that we have in this packet + if (framePayload == null) { + framePayload = payloadBuffer; + } else { + framePayload.writeBytes(payloadBuffer); + } - // Processing ping/pong/close frames because they cannot be fragmented - if (frameOpcode == OPCODE_PING) { - return new PingWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_PONG) { - return new PongWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_CLOSE) { - this.receivedClosingHandshake = true; - return new CloseWebSocketFrame(frameFinalFlag, frameRsv); - } - - // Processing for possible fragmented messages for text and binary frames - String aggregatedText = null; - if (frameFinalFlag) { - // Final frame of the sequence. Apparently ping frames are - // allowed in the middle of a fragmented message - if (frameOpcode != OPCODE_PING) { - fragmentedFramesCount = 0; + // Unmask data if needed + if (this.maskedPayload) { + unmask(framePayload); + } - // Check text for UTF8 correctness - if (frameOpcode == OPCODE_TEXT || fragmentedFramesText != null) { - // Check UTF-8 correctness for this payload - checkUTF8String(channel, framePayload.array()); + // Processing ping/pong/close frames because they cannot be + // fragmented + if (frameOpcode == OPCODE_PING) { + return new PingWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_PONG) { + return new PongWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_CLOSE) { + this.receivedClosingHandshake = true; + return new CloseWebSocketFrame(frameFinalFlag, frameRsv); + } - // This does a second check to make sure UTF-8 - // correctness for entire text message - aggregatedText = fragmentedFramesText.toString(); + // Processing for possible fragmented messages for text and binary + // frames + String aggregatedText = null; + if (frameFinalFlag) { + // Final frame of the sequence. Apparently ping frames are + // allowed in the middle of a fragmented message + if (frameOpcode != OPCODE_PING) { + fragmentedFramesCount = 0; - fragmentedFramesText = null; - } - } - } else { - // Not final frame so we can expect more frames in the - // fragmented sequence - if (fragmentedFramesCount == 0) { - // First text or binary frame for a fragmented set - fragmentedFramesText = null; - if (frameOpcode == OPCODE_TEXT) { - checkUTF8String(channel, framePayload.array()); - } - } else { - // Subsequent frames - only check if init frame is text - if (fragmentedFramesText != null) { - checkUTF8String(channel, framePayload.array()); - } - } + // Check text for UTF8 correctness + if (frameOpcode == OPCODE_TEXT || fragmentedFramesText != null) { + // Check UTF-8 correctness for this payload + checkUTF8String(channel, framePayload.array()); - // Increment counter - fragmentedFramesCount++; - } + // This does a second check to make sure UTF-8 + // correctness for entire text message + aggregatedText = fragmentedFramesText.toString(); - // Return the frame - if (frameOpcode == OPCODE_TEXT) { - return new TextWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_BINARY) { - return new BinaryWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_CONT) { - return new ContinuationWebSocketFrame(frameFinalFlag, frameRsv, framePayload, aggregatedText); - } else { - throw new UnsupportedOperationException("Cannot decode web socket frame with opcode: " + frameOpcode); - } - case CORRUPT: - // If we don't keep reading Netty will throw an exception saying - // we can't return null if no bytes read and state not changed. - buffer.readByte(); - return null; - default: - throw new Error("Shouldn't reach here."); - } - } + fragmentedFramesText = null; + } + } + } else { + // Not final frame so we can expect more frames in the + // fragmented sequence + if (fragmentedFramesCount == 0) { + // First text or binary frame for a fragmented set + fragmentedFramesText = null; + if (frameOpcode == OPCODE_TEXT) { + checkUTF8String(channel, framePayload.array()); + } + } else { + // Subsequent frames - only check if init frame is text + if (fragmentedFramesText != null) { + checkUTF8String(channel, framePayload.array()); + } + } - private void unmask(ChannelBuffer frame) { - byte[] bytes = frame.array(); - for (int i = 0; i < bytes.length; i++) { - frame.setByte(i, frame.getByte(i) ^ maskingKey.getByte(i % 4)); - } - } + // Increment counter + fragmentedFramesCount++; + } - private void protocolViolation(Channel channel, String reason) throws CorruptedFrameException { - checkpoint(State.CORRUPT); - if (channel.isConnected()) { - channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); - channel.close().awaitUninterruptibly(); - } - throw new CorruptedFrameException(reason); - } + // Return the frame + if (frameOpcode == OPCODE_TEXT) { + return new TextWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_BINARY) { + return new BinaryWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_CONT) { + return new ContinuationWebSocketFrame(frameFinalFlag, frameRsv, framePayload, aggregatedText); + } else { + throw new UnsupportedOperationException("Cannot decode web socket frame with opcode: " + frameOpcode); + } + case CORRUPT: + // If we don't keep reading Netty will throw an exception saying + // we can't return null if no bytes read and state not changed. + buffer.readByte(); + return null; + default: + throw new Error("Shouldn't reach here."); + } + } - private int toFrameLength(long l) throws TooLongFrameException { - if (l > Integer.MAX_VALUE) { - throw new TooLongFrameException("Length:" + l); - } else { - return (int) l; - } - } + private void unmask(ChannelBuffer frame) { + byte[] bytes = frame.array(); + for (int i = 0; i < bytes.length; i++) { + frame.setByte(i, frame.getByte(i) ^ maskingKey.getByte(i % 4)); + } + } - private void checkUTF8String(Channel channel, byte[] bytes) throws CorruptedFrameException { - try { - // StringBuilder sb = new StringBuilder("UTF8 " + bytes.length + - // " bytes: "); - // for (byte b : bytes) { - // sb.append(Integer.toHexString(b)).append(" "); - // } - // logger.debug(sb.toString()); + private void protocolViolation(Channel channel, String reason) throws CorruptedFrameException { + checkpoint(State.CORRUPT); + if (channel.isConnected()) { + channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); + channel.close().awaitUninterruptibly(); + } + throw new CorruptedFrameException(reason); + } - if (fragmentedFramesText == null) { - fragmentedFramesText = new UTF8Output(bytes); - } else { - fragmentedFramesText.write(bytes); - } - } catch (UTF8Exception ex) { - protocolViolation(channel, "invalid UTF-8 bytes"); - } - } + private int toFrameLength(long l) throws TooLongFrameException { + if (l > Integer.MAX_VALUE) { + throw new TooLongFrameException("Length:" + l); + } else { + return (int) l; + } + } + + private void checkUTF8String(Channel channel, byte[] bytes) throws CorruptedFrameException { + try { + // StringBuilder sb = new StringBuilder("UTF8 " + bytes.length + + // " bytes: "); + // for (byte b : bytes) { + // sb.append(Integer.toHexString(b)).append(" "); + // } + // logger.debug(sb.toString()); + + if (fragmentedFramesText == null) { + fragmentedFramesText = new UTF8Output(bytes); + } else { + fragmentedFramesText.write(bytes); + } + } catch (UTF8Exception ex) { + protocolViolation(channel, "invalid UTF-8 bytes"); + } + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameEncoder.java index 35538e3ddf..9270a2f7c7 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameEncoder.java @@ -114,8 +114,10 @@ public class WebSocket08FrameEncoder extends OneToOneEncoder { int length = data.readableBytes(); - logger.debug("Encoding WebSocket Frame opCode=" + opcode + " length=" + length); - + if (logger.isDebugEnabled()) { + logger.debug("Encoding WebSocket Frame opCode=" + opcode + " length=" + length); + } + int b0 = 0; if (frame.isFinalFragment()) { b0 |= (1 << 7); diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket13FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket13FrameDecoder.java new file mode 100644 index 0000000000..5cf746952a --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket13FrameDecoder.java @@ -0,0 +1,61 @@ +// (BSD License: http://www.opensource.org/licenses/bsd-license) +// +// Copyright (c) 2011, Joe Walnes and contributors +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or +// without modification, are permitted provided that the +// following conditions are met: +// +// * Redistributions of source code must retain the above +// copyright notice, this list of conditions and the +// following disclaimer. +// +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the +// following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// * Neither the name of the Webbit nor the names of +// its contributors may be used to endorse or promote products +// derived from this software without specific prior written +// permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +package org.jboss.netty.handler.codec.http.websocketx; + +/** + * Decodes a web socket frame from wire protocol version 13 format. + * V13 is essentially the same as V8. + * + * @author Vibul Imtarnasan + */ +public class WebSocket13FrameDecoder extends WebSocket08FrameDecoder { + + /** + * Constructor + * + * @param maskedPayload + * Web socket servers must set this to true processed incoming + * masked payload. Client implementations must set this to false. + * @param allowExtensions + * Flag to allow reserved extension bits to be used or not + */ + public WebSocket13FrameDecoder(boolean maskedPayload, boolean allowExtensions) { + super(maskedPayload, allowExtensions); + } +} diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket13FrameEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket13FrameEncoder.java new file mode 100644 index 0000000000..fb63448a77 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket13FrameEncoder.java @@ -0,0 +1,62 @@ +// (BSD License: http://www.opensource.org/licenses/bsd-license) +// +// Copyright (c) 2011, Joe Walnes and contributors +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or +// without modification, are permitted provided that the +// following conditions are met: +// +// * Redistributions of source code must retain the above +// copyright notice, this list of conditions and the +// following disclaimer. +// +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the +// following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// * Neither the name of the Webbit nor the names of +// its contributors may be used to endorse or promote products +// derived from this software without specific prior written +// permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +package org.jboss.netty.handler.codec.http.websocketx; + + +/** + *

+ * Encodes a web socket frame into wire protocol version 13 format. V13 is essentially the same + * as V8. + *

+ * + * @author Vibul Imtarnasan + */ +public class WebSocket13FrameEncoder extends WebSocket08FrameEncoder { + + /** + * Constructor + * + * @param maskPayload + * Web socket clients must set this to true to mask payload. + * Server implementations must set this to false. + */ + public WebSocket13FrameEncoder(boolean maskPayload) { + super(maskPayload); + } +} diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker17.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker17.java new file mode 100644 index 0000000000..8d7b2caf37 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshaker17.java @@ -0,0 +1,186 @@ +/* + * Copyright 2010 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.http.websocketx; + +import java.net.URI; + +import org.jboss.netty.channel.Channel; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.handler.codec.http.DefaultHttpRequest; +import org.jboss.netty.handler.codec.http.HttpHeaders.Names; +import org.jboss.netty.handler.codec.http.HttpHeaders.Values; +import org.jboss.netty.handler.codec.http.HttpMethod; +import org.jboss.netty.handler.codec.http.HttpRequest; +import org.jboss.netty.handler.codec.http.HttpResponse; +import org.jboss.netty.handler.codec.http.HttpResponseStatus; +import org.jboss.netty.handler.codec.http.HttpVersion; +import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; +import org.jboss.netty.util.CharsetUtil; + +/** + *

+ * Performs client side opening and closing handshakes for web socket + * specification version draft-ietf-hybi-thewebsocketprotocol- 17 + *

+ * + * @author The Netty Project + */ +public class WebSocketClientHandshaker17 extends WebSocketClientHandshaker { + + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketClientHandshaker17.class); + + public static final String MAGIC_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + + private String expectedChallengeResponseString = null; + + private static final String protocol = null; + + private boolean allowExtensions = false; + + /** + * Constructor specifying the destination web socket location and version to + * initiate + * + * @param webSocketURL + * URL for web socket communications. e.g + * "ws://myhost.com/mypath". Subsequent web socket frames will be + * sent to this URL. + * @param version + * Version of web socket specification to use to connect to the + * server + * @param subProtocol + * Sub protocol request sent to the server. + * @param allowExtensions + * Allow extensions to be used in the reserved bits of the web + * socket frame + */ + public WebSocketClientHandshaker17(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol, boolean allowExtensions) { + super(webSocketURL, version, subProtocol); + this.allowExtensions = allowExtensions; + } + + /** + * /** + *

+ * Sends the opening request to the server: + *

+ * + *
+     * GET /chat HTTP/1.1
+     * Host: server.example.com
+     * Upgrade: websocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
+     * Sec-WebSocket-Origin: http://example.com
+     * Sec-WebSocket-Protocol: chat, superchat
+     * Sec-WebSocket-Version: 13
+     * 
+ * + * @param ctx + * Channel context + * @param channel + * Channel into which we can write our request + */ + @Override + public void beginOpeningHandshake(ChannelHandlerContext ctx, Channel channel) { + // Get path + URI wsURL = this.getWebSocketURL(); + String path = wsURL.getPath(); + if (wsURL.getQuery() != null && wsURL.getQuery().length() > 0) { + path = wsURL.getPath() + "?" + wsURL.getQuery(); + } + + // Get 16 bit nonce and base 64 encode it + byte[] nonce = createRandomBytes(16); + String key = base64Encode(nonce); + + String acceptSeed = key + MAGIC_GUID; + byte[] sha1 = sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); + this.expectedChallengeResponseString = base64Encode(sha1); + + if (logger.isDebugEnabled()) { + logger.debug(String.format("HyBi17 Client Handshake key: %s. Expected response: %s.", key, this.expectedChallengeResponseString)); + } + + // Format request + HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); + request.addHeader(Names.UPGRADE, Values.WEBSOCKET.toLowerCase()); + request.addHeader(Names.CONNECTION, Values.UPGRADE); + request.addHeader(Names.SEC_WEBSOCKET_KEY, key); + request.addHeader(Names.HOST, wsURL.getHost()); + request.addHeader(Names.ORIGIN, "http://" + wsURL.getHost()); + if (protocol != null && !protocol.equals("")) { + request.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, protocol); + } + request.addHeader(Names.SEC_WEBSOCKET_VERSION, "13"); + + channel.write(request); + + ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket13FrameEncoder(true)); + } + + /** + *

+ * Process server response: + *

+ * + *
+     * HTTP/1.1 101 Switching Protocols
+     * Upgrade: websocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
+     * Sec-WebSocket-Protocol: chat
+     * 
+ * + * @param ctx + * Channel context + * @param response + * HTTP response returned from the server for the request sent by + * beginOpeningHandshake00(). + * @throws WebSocketHandshakeException + */ + @Override + public void endOpeningHandshake(ChannelHandlerContext ctx, HttpResponse response) throws WebSocketHandshakeException { + final HttpResponseStatus status = new HttpResponseStatus(101, "Switching Protocols"); + + if (!response.getStatus().equals(status)) { + throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus()); + } + + String upgrade = response.getHeader(Names.UPGRADE); + if (upgrade == null || !upgrade.equals(Values.WEBSOCKET.toLowerCase())) { + throw new WebSocketHandshakeException("Invalid handshake response upgrade: " + response.getHeader(Names.UPGRADE)); + } + + String connection = response.getHeader(Names.CONNECTION); + if (connection == null || !connection.equals(Values.UPGRADE)) { + throw new WebSocketHandshakeException("Invalid handshake response connection: " + response.getHeader(Names.CONNECTION)); + } + + String accept = response.getHeader(Names.SEC_WEBSOCKET_ACCEPT); + if (accept == null || !accept.equals(this.expectedChallengeResponseString)) { + throw new WebSocketHandshakeException(String.format("Invalid challenge. Actual: %s. Expected: %s", accept, this.expectedChallengeResponseString)); + } + + ctx.getPipeline().replace("decoder", "ws-decoder", new WebSocket13FrameDecoder(false, this.allowExtensions)); + + this.setOpenningHandshakeCompleted(true); + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java index a8c13e4d5f..c908b13f6e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java @@ -43,6 +43,9 @@ public class WebSocketClientHandshakerFactory { * @throws WebSocketHandshakeException */ public WebSocketClientHandshaker newHandshaker(URI webSocketURL, WebSocketSpecificationVersion version, String subProtocol, boolean allowExtensions) throws WebSocketHandshakeException { + if (version == WebSocketSpecificationVersion.V17) { + return new WebSocketClientHandshaker17(webSocketURL, version, subProtocol, allowExtensions); + } if (version == WebSocketSpecificationVersion.V10) { return new WebSocketClientHandshaker10(webSocketURL, version, subProtocol, allowExtensions); } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker17.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker17.java new file mode 100644 index 0000000000..8a9ac4aeb5 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker17.java @@ -0,0 +1,168 @@ +/* + * Copyright 2010 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.codec.http.websocketx; + +import static org.jboss.netty.handler.codec.http.HttpHeaders.Values.WEBSOCKET; +import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1; + +import java.security.NoSuchAlgorithmException; + +import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelFutureListener; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.handler.codec.http.DefaultHttpResponse; +import org.jboss.netty.handler.codec.http.HttpRequest; +import org.jboss.netty.handler.codec.http.HttpResponse; +import org.jboss.netty.handler.codec.http.HttpResponseStatus; +import org.jboss.netty.handler.codec.http.HttpHeaders.Names; +import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; +import org.jboss.netty.util.CharsetUtil; + +/** + *

+ * Performs server side opening and closing handshakes for web socket + * specification version draft-ietf-hybi-thewebsocketprotocol- 17 + *

+ * + * @author The Netty Project + */ +public class WebSocketServerHandshaker17 extends WebSocketServerHandshaker { + + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandshaker17.class); + + public static final String WEBSOCKET_17_ACCEPT_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + + private boolean allowExtensions = false; + + /** + * 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. + * @param subProtocols + * CSV of supported protocols + * @param allowExtensions + * Allow extensions to be used in the reserved bits of the web + * socket frame + */ + public WebSocketServerHandshaker17(String webSocketURL, String subProtocols, boolean allowExtensions) { + super(webSocketURL, subProtocols); + this.allowExtensions = allowExtensions; + } + + /** + *

+ * Handle the web socket handshake for the web socket specification HyBi + * versions 13-17. Versions 13-17 share the same wire protocol. + *

+ * + *

+ * Browser request to the server: + *

+ * + *
+     * GET /chat HTTP/1.1
+     * Host: server.example.com
+     * Upgrade: websocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
+     * Sec-WebSocket-Origin: http://example.com
+     * Sec-WebSocket-Protocol: chat, superchat
+     * Sec-WebSocket-Version: 13
+     * 
+ * + *

+ * Server response: + *

+ * + *
+     * HTTP/1.1 101 Switching Protocols
+     * Upgrade: websocket
+     * Connection: Upgrade
+     * Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
+     * Sec-WebSocket-Protocol: chat
+     * 
+ * + * @param ctx + * Channel context + * @param req + * HTTP request + * @throws NoSuchAlgorithmException + */ + @Override + public void executeOpeningHandshake(ChannelHandlerContext ctx, HttpRequest req) { + + if (logger.isDebugEnabled()) { + logger.debug(String.format("Channel %s web socket spec version 17 handshake", ctx.getChannel().getId())); + } + + HttpResponse res = new DefaultHttpResponse(HTTP_1_1, new HttpResponseStatus(101, "Switching Protocols")); + this.setVersion(WebSocketSpecificationVersion.V17); + + String key = req.getHeader(Names.SEC_WEBSOCKET_KEY); + if (key == null) { + res.setStatus(HttpResponseStatus.BAD_REQUEST); + return; + } + String acceptSeed = key + WEBSOCKET_17_ACCEPT_GUID; + byte[] sha1 = sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); + String accept = base64Encode(sha1); + + if (logger.isDebugEnabled()) { + logger.debug(String.format("HyBi17 Server Handshake key: %s. Response: %s.", key, accept)); + } + + res.setStatus(new HttpResponseStatus(101, "Switching Protocols")); + res.addHeader(Names.UPGRADE, WEBSOCKET.toLowerCase()); + res.addHeader(Names.CONNECTION, Names.UPGRADE); + res.addHeader(Names.SEC_WEBSOCKET_ACCEPT, accept); + String protocol = req.getHeader(Names.SEC_WEBSOCKET_PROTOCOL); + if (protocol != null) { + res.addHeader(Names.SEC_WEBSOCKET_PROTOCOL, this.selectSubProtocol(protocol)); + } + + ctx.getChannel().write(res); + + // Upgrade the connection and send the handshake response. + ChannelPipeline p = ctx.getChannel().getPipeline(); + p.remove("aggregator"); + p.replace("decoder", "wsdecoder", new WebSocket13FrameDecoder(true, this.allowExtensions)); + p.replace("encoder", "wsencoder", new WebSocket13FrameEncoder(false)); + + } + + /** + * Echo back the closing frame and close the connection + * + * @param ctx + * Channel context + * @param frame + * Web Socket frame that was received + */ + @Override + public void executeClosingHandshake(ChannelHandlerContext ctx, CloseWebSocketFrame frame) { + ChannelFuture f = ctx.getChannel().write(frame); + f.addListener(ChannelFutureListener.CLOSE); + } + +} diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java index 5c33b5989c..f1306b572e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java @@ -30,66 +30,71 @@ import org.jboss.netty.handler.codec.http.HttpHeaders.Names; */ public class WebSocketServerHandshakerFactory { - private final String webSocketURL; + private final String webSocketURL; - private final String subProtocols; + private final String subProtocols; - private boolean allowExtensions = false; + private boolean allowExtensions = false; - /** - * 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. - * @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 - */ - public WebSocketServerHandshakerFactory(String webSocketURL, String subProtocols, boolean allowExtensions) { - this.webSocketURL = webSocketURL; - this.subProtocols = subProtocols; - this.allowExtensions = allowExtensions; - } + /** + * 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. + * @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 + */ + public WebSocketServerHandshakerFactory(String webSocketURL, String subProtocols, boolean allowExtensions) { + this.webSocketURL = webSocketURL; + this.subProtocols = subProtocols; + this.allowExtensions = allowExtensions; + } - /** - * Instances a new handshaker - * - * @return A new WebSocketServerHandshaker for the requested web socket - * version. Null if web socket version is not supported. - */ - public WebSocketServerHandshaker newHandshaker(ChannelHandlerContext ctx, HttpRequest req) { + /** + * Instances a new handshaker + * + * @return A new WebSocketServerHandshaker for the requested web socket + * version. Null if web socket version is not supported. + */ + public WebSocketServerHandshaker newHandshaker(ChannelHandlerContext ctx, HttpRequest req) { - String version = req.getHeader(Names.SEC_WEBSOCKET_VERSION); - if (version != null) { - if (version.equals("8")) { - // Version 8 of the wire protocol - assume version 10 of the - // specification. - return new WebSocketServerHandshaker10(webSocketURL, subProtocols, this.allowExtensions); - } else { - return null; - } - } else { - // Assume version 00 where version header was not specified - return new WebSocketServerHandshaker00(webSocketURL, subProtocols); - } - } + String version = req.getHeader(Names.SEC_WEBSOCKET_VERSION); + if (version != null) { + if (version.equals("13")) { + // Version 13 of the wire protocol - assume version 17 of the + // specification. + return new WebSocketServerHandshaker17(webSocketURL, subProtocols, this.allowExtensions); + } else if (version.equals("8")) { + // Version 8 of the wire protocol - assume version 10 of the + // specification. + return new WebSocketServerHandshaker10(webSocketURL, subProtocols, this.allowExtensions); + } else { + return null; + } + } else { + // Assume version 00 where version header was not specified + return new WebSocketServerHandshaker00(webSocketURL, subProtocols); + } + } - /** - * Return that we need cannot not support the web socket version - * - * @param ctx - * Context - */ - public void sendUnsupportedWebSocketVersionResponse(ChannelHandlerContext ctx) { - HttpResponse res = new DefaultHttpResponse(HttpVersion.HTTP_1_1, new HttpResponseStatus(101, "Switching Protocols")); - res.setStatus(HttpResponseStatus.UPGRADE_REQUIRED); - res.setHeader(Names.SEC_WEBSOCKET_VERSION, "8"); - ctx.getChannel().write(res); - } + /** + * Return that we need cannot not support the web socket version + * + * @param ctx + * Context + */ + public void sendUnsupportedWebSocketVersionResponse(ChannelHandlerContext ctx) { + HttpResponse res = new DefaultHttpResponse(HttpVersion.HTTP_1_1, new HttpResponseStatus(101, + "Switching Protocols")); + res.setStatus(HttpResponseStatus.UPGRADE_REQUIRED); + res.setHeader(Names.SEC_WEBSOCKET_VERSION, "13"); + ctx.getChannel().write(res); + } } diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketSpecificationVersion.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketSpecificationVersion.java index 8103296b4d..58a160a998 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketSpecificationVersion.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocketSpecificationVersion.java @@ -41,5 +41,13 @@ public enum WebSocketSpecificationVersion { * "http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10" * >draft-ietf-hybi-thewebsocketprotocol- 10 */ - V10 + V10, + + /** + * draft-ietf-hybi-thewebsocketprotocol- 17 + */ + V17 + } From 181355665be56f8c52e871ff0561de770abaa9e8 Mon Sep 17 00:00:00 2001 From: Veebs Date: Tue, 29 Nov 2011 10:12:42 +1100 Subject: [PATCH 79/93] Fixed formatting. --- .../websocketx/WebSocket08FrameDecoder.java | 560 +++++++++--------- 1 file changed, 280 insertions(+), 280 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java index 4a346f1a25..76d0988b8d 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket08FrameDecoder.java @@ -59,325 +59,325 @@ import org.jboss.netty.logging.InternalLoggerFactory; */ public class WebSocket08FrameDecoder extends ReplayingDecoder { - private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameDecoder.class); + private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocket08FrameDecoder.class); - private static final byte OPCODE_CONT = 0x0; - private static final byte OPCODE_TEXT = 0x1; - private static final byte OPCODE_BINARY = 0x2; - private static final byte OPCODE_CLOSE = 0x8; - private static final byte OPCODE_PING = 0x9; - private static final byte OPCODE_PONG = 0xA; + private static final byte OPCODE_CONT = 0x0; + private static final byte OPCODE_TEXT = 0x1; + private static final byte OPCODE_BINARY = 0x2; + private static final byte OPCODE_CLOSE = 0x8; + private static final byte OPCODE_PING = 0x9; + private static final byte OPCODE_PONG = 0xA; - private UTF8Output fragmentedFramesText = null; - private int fragmentedFramesCount = 0; + private UTF8Output fragmentedFramesText = null; + private int fragmentedFramesCount = 0; - private boolean frameFinalFlag; - private int frameRsv; - private int frameOpcode; - private long framePayloadLength; - private ChannelBuffer framePayload = null; - private int framePayloadBytesRead = 0; - private ChannelBuffer maskingKey; + private boolean frameFinalFlag; + private int frameRsv; + private int frameOpcode; + private long framePayloadLength; + private ChannelBuffer framePayload = null; + private int framePayloadBytesRead = 0; + private ChannelBuffer maskingKey; - private boolean allowExtensions = false; - private boolean maskedPayload = false; - private boolean receivedClosingHandshake = false; + private boolean allowExtensions = false; + private boolean maskedPayload = false; + private boolean receivedClosingHandshake = false; - public enum State { - FRAME_START, MASKING_KEY, PAYLOAD, CORRUPT - } + public enum State { + FRAME_START, MASKING_KEY, PAYLOAD, CORRUPT + } - /** - * Constructor - * - * @param maskedPayload - * Web socket servers must set this to true processed incoming - * masked payload. Client implementations must set this to false. - * @param allowExtensions - * Flag to allow reserved extension bits to be used or not - */ - public WebSocket08FrameDecoder(boolean maskedPayload, boolean allowExtensions) { - super(State.FRAME_START); - this.maskedPayload = maskedPayload; - this.allowExtensions = allowExtensions; - } + /** + * Constructor + * + * @param maskedPayload + * Web socket servers must set this to true processed incoming + * masked payload. Client implementations must set this to false. + * @param allowExtensions + * Flag to allow reserved extension bits to be used or not + */ + public WebSocket08FrameDecoder(boolean maskedPayload, boolean allowExtensions) { + super(State.FRAME_START); + this.maskedPayload = maskedPayload; + this.allowExtensions = allowExtensions; + } - @Override - protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, State state) - throws Exception { + @Override + protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer, State state) + throws Exception { - // Discard all data received if closing handshake was received before. - if (receivedClosingHandshake) { - buffer.skipBytes(actualReadableBytes()); - return null; - } + // Discard all data received if closing handshake was received before. + if (receivedClosingHandshake) { + buffer.skipBytes(actualReadableBytes()); + return null; + } - switch (state) { - case FRAME_START: - framePayloadBytesRead = 0; - framePayloadLength = -1; - framePayload = null; + switch (state) { + case FRAME_START: + framePayloadBytesRead = 0; + framePayloadLength = -1; + framePayload = null; - // FIN, RSV, OPCODE - byte b = buffer.readByte(); - frameFinalFlag = (b & 0x80) != 0; - frameRsv = (b & 0x70) >> 4; - frameOpcode = (b & 0x0F); + // FIN, RSV, OPCODE + byte b = buffer.readByte(); + frameFinalFlag = (b & 0x80) != 0; + frameRsv = (b & 0x70) >> 4; + frameOpcode = (b & 0x0F); - if (logger.isDebugEnabled()) { - logger.debug("Decoding WebSocket Frame opCode=" + frameOpcode); - } + if (logger.isDebugEnabled()) { + logger.debug("Decoding WebSocket Frame opCode=" + frameOpcode); + } - // MASK, PAYLOAD LEN 1 - b = buffer.readByte(); - boolean frameMasked = (b & 0x80) != 0; - int framePayloadLen1 = (b & 0x7F); + // MASK, PAYLOAD LEN 1 + b = buffer.readByte(); + boolean frameMasked = (b & 0x80) != 0; + int framePayloadLen1 = (b & 0x7F); - if (frameRsv != 0 && !this.allowExtensions) { - protocolViolation(channel, "RSV != 0 and no extension negotiated, RSV:" + frameRsv); - return null; - } + if (frameRsv != 0 && !this.allowExtensions) { + protocolViolation(channel, "RSV != 0 and no extension negotiated, RSV:" + frameRsv); + return null; + } - if (this.maskedPayload && !frameMasked) { - protocolViolation(channel, "unmasked client to server frame"); - return null; - } - if (frameOpcode > 7) { // control frame (have MSB in opcode set) + if (this.maskedPayload && !frameMasked) { + protocolViolation(channel, "unmasked client to server frame"); + return null; + } + if (frameOpcode > 7) { // control frame (have MSB in opcode set) - // control frames MUST NOT be fragmented - if (!frameFinalFlag) { - protocolViolation(channel, "fragmented control frame"); - return null; - } + // control frames MUST NOT be fragmented + if (!frameFinalFlag) { + protocolViolation(channel, "fragmented control frame"); + return null; + } - // control frames MUST have payload 125 octets or less - if (framePayloadLen1 > 125) { - protocolViolation(channel, "control frame with payload length > 125 octets"); - return null; - } + // control frames MUST have payload 125 octets or less + if (framePayloadLen1 > 125) { + protocolViolation(channel, "control frame with payload length > 125 octets"); + return null; + } - // check for reserved control frame opcodes - if (!(frameOpcode == OPCODE_CLOSE || frameOpcode == OPCODE_PING || frameOpcode == OPCODE_PONG)) { - protocolViolation(channel, "control frame using reserved opcode " + frameOpcode); - return null; - } + // check for reserved control frame opcodes + if (!(frameOpcode == OPCODE_CLOSE || frameOpcode == OPCODE_PING || frameOpcode == OPCODE_PONG)) { + protocolViolation(channel, "control frame using reserved opcode " + frameOpcode); + return null; + } - // close frame : if there is a body, the first two bytes of the - // body MUST be a 2-byte unsigned integer (in network byte - // order) representing a status code - if (frameOpcode == 8 && framePayloadLen1 == 1) { - protocolViolation(channel, "received close control frame with payload len 1"); - return null; - } - } else { // data frame - // check for reserved data frame opcodes - if (!(frameOpcode == OPCODE_CONT || frameOpcode == OPCODE_TEXT || frameOpcode == OPCODE_BINARY)) { - protocolViolation(channel, "data frame using reserved opcode " + frameOpcode); - return null; - } + // close frame : if there is a body, the first two bytes of the + // body MUST be a 2-byte unsigned integer (in network byte + // order) representing a status code + if (frameOpcode == 8 && framePayloadLen1 == 1) { + protocolViolation(channel, "received close control frame with payload len 1"); + return null; + } + } else { // data frame + // check for reserved data frame opcodes + if (!(frameOpcode == OPCODE_CONT || frameOpcode == OPCODE_TEXT || frameOpcode == OPCODE_BINARY)) { + protocolViolation(channel, "data frame using reserved opcode " + frameOpcode); + return null; + } - // check opcode vs message fragmentation state 1/2 - if (fragmentedFramesCount == 0 && frameOpcode == OPCODE_CONT) { - protocolViolation(channel, "received continuation data frame outside fragmented message"); - return null; - } + // check opcode vs message fragmentation state 1/2 + if (fragmentedFramesCount == 0 && frameOpcode == OPCODE_CONT) { + protocolViolation(channel, "received continuation data frame outside fragmented message"); + return null; + } - // check opcode vs message fragmentation state 2/2 - if (fragmentedFramesCount != 0 && frameOpcode != OPCODE_CONT && frameOpcode != OPCODE_PING) { - protocolViolation(channel, "received non-continuation data frame while inside fragmented message"); - return null; - } - } + // check opcode vs message fragmentation state 2/2 + if (fragmentedFramesCount != 0 && frameOpcode != OPCODE_CONT && frameOpcode != OPCODE_PING) { + protocolViolation(channel, "received non-continuation data frame while inside fragmented message"); + return null; + } + } - // Read frame payload length - if (framePayloadLen1 == 126) { - framePayloadLength = buffer.readUnsignedShort(); - if (framePayloadLength < 126) { - protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); - return null; - } - } else if (framePayloadLen1 == 127) { - framePayloadLength = buffer.readLong(); - // TODO: check if it's bigger than 0x7FFFFFFFFFFFFFFF, Maybe - // just check if it's negative? + // Read frame payload length + if (framePayloadLen1 == 126) { + framePayloadLength = buffer.readUnsignedShort(); + if (framePayloadLength < 126) { + protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); + return null; + } + } else if (framePayloadLen1 == 127) { + framePayloadLength = buffer.readLong(); + // TODO: check if it's bigger than 0x7FFFFFFFFFFFFFFF, Maybe + // just check if it's negative? - if (framePayloadLength < 65536) { - protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); - return null; - } - } else { - framePayloadLength = framePayloadLen1; - } + if (framePayloadLength < 65536) { + protocolViolation(channel, "invalid data frame length (not using minimal length encoding)"); + return null; + } + } else { + framePayloadLength = framePayloadLen1; + } - if (logger.isDebugEnabled()) { - logger.debug("Decoding WebSocket Frame length=" + framePayloadLength); - } + if (logger.isDebugEnabled()) { + logger.debug("Decoding WebSocket Frame length=" + framePayloadLength); + } - checkpoint(State.MASKING_KEY); - case MASKING_KEY: - if (this.maskedPayload) { - maskingKey = buffer.readBytes(4); - } - checkpoint(State.PAYLOAD); - case PAYLOAD: - // Sometimes, the payload may not be delivered in 1 nice packet - // We need to accumulate the data until we have it all - int rbytes = actualReadableBytes(); - ChannelBuffer payloadBuffer = null; + checkpoint(State.MASKING_KEY); + case MASKING_KEY: + if (this.maskedPayload) { + maskingKey = buffer.readBytes(4); + } + checkpoint(State.PAYLOAD); + case PAYLOAD: + // Sometimes, the payload may not be delivered in 1 nice packet + // We need to accumulate the data until we have it all + int rbytes = actualReadableBytes(); + ChannelBuffer payloadBuffer = null; - int willHaveReadByteCount = framePayloadBytesRead + rbytes; - // logger.debug("Frame rbytes=" + rbytes + " willHaveReadByteCount=" - // + willHaveReadByteCount + " framePayloadLength=" + - // framePayloadLength); - if (willHaveReadByteCount == framePayloadLength) { - // We have all our content so proceed to process - payloadBuffer = buffer.readBytes(rbytes); - } else if (willHaveReadByteCount < framePayloadLength) { - // We don't have all our content so accumulate payload. - // Returning null means we will get called back - payloadBuffer = buffer.readBytes(rbytes); - if (framePayload == null) { - framePayload = channel.getConfig().getBufferFactory().getBuffer(toFrameLength(framePayloadLength)); - } - framePayload.writeBytes(payloadBuffer); - framePayloadBytesRead = framePayloadBytesRead + rbytes; + int willHaveReadByteCount = framePayloadBytesRead + rbytes; + // logger.debug("Frame rbytes=" + rbytes + " willHaveReadByteCount=" + // + willHaveReadByteCount + " framePayloadLength=" + + // framePayloadLength); + if (willHaveReadByteCount == framePayloadLength) { + // We have all our content so proceed to process + payloadBuffer = buffer.readBytes(rbytes); + } else if (willHaveReadByteCount < framePayloadLength) { + // We don't have all our content so accumulate payload. + // Returning null means we will get called back + payloadBuffer = buffer.readBytes(rbytes); + if (framePayload == null) { + framePayload = channel.getConfig().getBufferFactory().getBuffer(toFrameLength(framePayloadLength)); + } + framePayload.writeBytes(payloadBuffer); + framePayloadBytesRead = framePayloadBytesRead + rbytes; - // Return null to wait for more bytes to arrive - return null; - } else if (willHaveReadByteCount > framePayloadLength) { - // We have more than what we need so read up to the end of frame - // Leave the remainder in the buffer for next frame - payloadBuffer = buffer.readBytes(toFrameLength(framePayloadLength - framePayloadBytesRead)); - } + // Return null to wait for more bytes to arrive + return null; + } else if (willHaveReadByteCount > framePayloadLength) { + // We have more than what we need so read up to the end of frame + // Leave the remainder in the buffer for next frame + payloadBuffer = buffer.readBytes(toFrameLength(framePayloadLength - framePayloadBytesRead)); + } - // Now we have all the data, the next checkpoint must be the next - // frame - checkpoint(State.FRAME_START); + // Now we have all the data, the next checkpoint must be the next + // frame + checkpoint(State.FRAME_START); - // Take the data that we have in this packet - if (framePayload == null) { - framePayload = payloadBuffer; - } else { - framePayload.writeBytes(payloadBuffer); - } + // Take the data that we have in this packet + if (framePayload == null) { + framePayload = payloadBuffer; + } else { + framePayload.writeBytes(payloadBuffer); + } - // Unmask data if needed - if (this.maskedPayload) { - unmask(framePayload); - } + // Unmask data if needed + if (this.maskedPayload) { + unmask(framePayload); + } - // Processing ping/pong/close frames because they cannot be - // fragmented - if (frameOpcode == OPCODE_PING) { - return new PingWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_PONG) { - return new PongWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_CLOSE) { - this.receivedClosingHandshake = true; - return new CloseWebSocketFrame(frameFinalFlag, frameRsv); - } + // Processing ping/pong/close frames because they cannot be + // fragmented + if (frameOpcode == OPCODE_PING) { + return new PingWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_PONG) { + return new PongWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_CLOSE) { + this.receivedClosingHandshake = true; + return new CloseWebSocketFrame(frameFinalFlag, frameRsv); + } - // Processing for possible fragmented messages for text and binary - // frames - String aggregatedText = null; - if (frameFinalFlag) { - // Final frame of the sequence. Apparently ping frames are - // allowed in the middle of a fragmented message - if (frameOpcode != OPCODE_PING) { - fragmentedFramesCount = 0; + // Processing for possible fragmented messages for text and binary + // frames + String aggregatedText = null; + if (frameFinalFlag) { + // Final frame of the sequence. Apparently ping frames are + // allowed in the middle of a fragmented message + if (frameOpcode != OPCODE_PING) { + fragmentedFramesCount = 0; - // Check text for UTF8 correctness - if (frameOpcode == OPCODE_TEXT || fragmentedFramesText != null) { - // Check UTF-8 correctness for this payload - checkUTF8String(channel, framePayload.array()); + // Check text for UTF8 correctness + if (frameOpcode == OPCODE_TEXT || fragmentedFramesText != null) { + // Check UTF-8 correctness for this payload + checkUTF8String(channel, framePayload.array()); - // This does a second check to make sure UTF-8 - // correctness for entire text message - aggregatedText = fragmentedFramesText.toString(); + // This does a second check to make sure UTF-8 + // correctness for entire text message + aggregatedText = fragmentedFramesText.toString(); - fragmentedFramesText = null; - } - } - } else { - // Not final frame so we can expect more frames in the - // fragmented sequence - if (fragmentedFramesCount == 0) { - // First text or binary frame for a fragmented set - fragmentedFramesText = null; - if (frameOpcode == OPCODE_TEXT) { - checkUTF8String(channel, framePayload.array()); - } - } else { - // Subsequent frames - only check if init frame is text - if (fragmentedFramesText != null) { - checkUTF8String(channel, framePayload.array()); - } - } + fragmentedFramesText = null; + } + } + } else { + // Not final frame so we can expect more frames in the + // fragmented sequence + if (fragmentedFramesCount == 0) { + // First text or binary frame for a fragmented set + fragmentedFramesText = null; + if (frameOpcode == OPCODE_TEXT) { + checkUTF8String(channel, framePayload.array()); + } + } else { + // Subsequent frames - only check if init frame is text + if (fragmentedFramesText != null) { + checkUTF8String(channel, framePayload.array()); + } + } - // Increment counter - fragmentedFramesCount++; - } + // Increment counter + fragmentedFramesCount++; + } - // Return the frame - if (frameOpcode == OPCODE_TEXT) { - return new TextWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_BINARY) { - return new BinaryWebSocketFrame(frameFinalFlag, frameRsv, framePayload); - } else if (frameOpcode == OPCODE_CONT) { - return new ContinuationWebSocketFrame(frameFinalFlag, frameRsv, framePayload, aggregatedText); - } else { - throw new UnsupportedOperationException("Cannot decode web socket frame with opcode: " + frameOpcode); - } - case CORRUPT: - // If we don't keep reading Netty will throw an exception saying - // we can't return null if no bytes read and state not changed. - buffer.readByte(); - return null; - default: - throw new Error("Shouldn't reach here."); - } - } + // Return the frame + if (frameOpcode == OPCODE_TEXT) { + return new TextWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_BINARY) { + return new BinaryWebSocketFrame(frameFinalFlag, frameRsv, framePayload); + } else if (frameOpcode == OPCODE_CONT) { + return new ContinuationWebSocketFrame(frameFinalFlag, frameRsv, framePayload, aggregatedText); + } else { + throw new UnsupportedOperationException("Cannot decode web socket frame with opcode: " + frameOpcode); + } + case CORRUPT: + // If we don't keep reading Netty will throw an exception saying + // we can't return null if no bytes read and state not changed. + buffer.readByte(); + return null; + default: + throw new Error("Shouldn't reach here."); + } + } - private void unmask(ChannelBuffer frame) { - byte[] bytes = frame.array(); - for (int i = 0; i < bytes.length; i++) { - frame.setByte(i, frame.getByte(i) ^ maskingKey.getByte(i % 4)); - } - } + private void unmask(ChannelBuffer frame) { + byte[] bytes = frame.array(); + for (int i = 0; i < bytes.length; i++) { + frame.setByte(i, frame.getByte(i) ^ maskingKey.getByte(i % 4)); + } + } - private void protocolViolation(Channel channel, String reason) throws CorruptedFrameException { - checkpoint(State.CORRUPT); - if (channel.isConnected()) { - channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); - channel.close().awaitUninterruptibly(); - } - throw new CorruptedFrameException(reason); - } + private void protocolViolation(Channel channel, String reason) throws CorruptedFrameException { + checkpoint(State.CORRUPT); + if (channel.isConnected()) { + channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); + channel.close().awaitUninterruptibly(); + } + throw new CorruptedFrameException(reason); + } - private int toFrameLength(long l) throws TooLongFrameException { - if (l > Integer.MAX_VALUE) { - throw new TooLongFrameException("Length:" + l); - } else { - return (int) l; - } - } + private int toFrameLength(long l) throws TooLongFrameException { + if (l > Integer.MAX_VALUE) { + throw new TooLongFrameException("Length:" + l); + } else { + return (int) l; + } + } - private void checkUTF8String(Channel channel, byte[] bytes) throws CorruptedFrameException { - try { - // StringBuilder sb = new StringBuilder("UTF8 " + bytes.length + - // " bytes: "); - // for (byte b : bytes) { - // sb.append(Integer.toHexString(b)).append(" "); - // } - // logger.debug(sb.toString()); + private void checkUTF8String(Channel channel, byte[] bytes) throws CorruptedFrameException { + try { + // StringBuilder sb = new StringBuilder("UTF8 " + bytes.length + + // " bytes: "); + // for (byte b : bytes) { + // sb.append(Integer.toHexString(b)).append(" "); + // } + // logger.debug(sb.toString()); - if (fragmentedFramesText == null) { - fragmentedFramesText = new UTF8Output(bytes); - } else { - fragmentedFramesText.write(bytes); - } - } catch (UTF8Exception ex) { - protocolViolation(channel, "invalid UTF-8 bytes"); - } - } + if (fragmentedFramesText == null) { + fragmentedFramesText = new UTF8Output(bytes); + } else { + fragmentedFramesText.write(bytes); + } + } catch (UTF8Exception ex) { + protocolViolation(channel, "invalid UTF-8 bytes"); + } + } } From 6fbc168cbf0f682c722b728ef9d1d091506c909f Mon Sep 17 00:00:00 2001 From: Veebs Date: Tue, 29 Nov 2011 10:19:47 +1100 Subject: [PATCH 80/93] Update example websocket client to use V17 --- .../org/jboss/netty/example/http/websocketx/client/App.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java index 3d1c3ab8bf..a140705def 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java @@ -59,10 +59,10 @@ public class App { MyCallbackHandler callbackHandler = new MyCallbackHandler(); WebSocketClientFactory factory = new WebSocketClientFactory(); - // Connect with spec version 10 (try changing it to V00 and it will + // Connect with spec version 17 (try changing it to V10 or V00 and it will // still work ... fingers crossed ;-) WebSocketClient client = factory.newClient(new URI("ws://localhost:8080/websocket"), - WebSocketSpecificationVersion.V10, callbackHandler); + WebSocketSpecificationVersion.V17, callbackHandler); // Connect System.out.println("WebSocket Client connecting"); From f6baf157dfd49d655ba7285b788648d77d8f481b Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 30 Nov 2011 10:27:09 +0100 Subject: [PATCH 81/93] Remove "isEmpty()" check as this may be really expensive (need to traverse all elements in the queue) --- .../execution/OrderedMemoryAwareThreadPoolExecutor.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java index 185c185473..ede4134cd0 100644 --- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java @@ -311,8 +311,7 @@ public class OrderedMemoryAwareThreadPoolExecutor extends Thread thread = Thread.currentThread(); for (;;) { final Runnable task = tasks.poll(); - // this should never happen but just in case check if - // the queue was empty + // if the task is null we should exit the loop if (task == null) { break; } @@ -328,10 +327,6 @@ public class OrderedMemoryAwareThreadPoolExecutor extends onAfterExecute(task, e); } throw e; - } finally { - if (tasks.isEmpty()) { - break; - } } } } finally { From ce1e48dc746fbb16e6d5b34c18ef55f09fb89824 Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 30 Nov 2011 10:46:32 +0100 Subject: [PATCH 82/93] Remove reflection code which is not needed anymore because the next major version of netty will require java6 --- .../MemoryAwareThreadPoolExecutor.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index ad63becd3f..1135513964 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -15,7 +15,6 @@ */ package org.jboss.netty.handler.execution; -import java.lang.reflect.Method; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; import java.util.concurrent.Executors; @@ -34,8 +33,6 @@ import org.jboss.netty.channel.ChannelState; import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.channel.WriteCompletionEvent; -import org.jboss.netty.logging.InternalLogger; -import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.util.DefaultObjectSizeEstimator; import org.jboss.netty.util.ObjectSizeEstimator; import org.jboss.netty.util.internal.ConcurrentIdentityHashMap; @@ -137,9 +134,6 @@ import org.jboss.netty.util.internal.SharedResourceMisuseDetector; */ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { - private static final InternalLogger logger = - InternalLoggerFactory.getInstance(MemoryAwareThreadPoolExecutor.class); - private static final SharedResourceMisuseDetector misuseDetector = new SharedResourceMisuseDetector(MemoryAwareThreadPoolExecutor.class); @@ -234,18 +228,8 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { "maxTotalMemorySize: " + maxTotalMemorySize); } - // Call allowCoreThreadTimeOut(true) using reflection - // because it is not supported in Java 5. - try { - Method m = getClass().getMethod("allowCoreThreadTimeOut", new Class[] { boolean.class }); - m.invoke(this, Boolean.TRUE); - } catch (Throwable t) { - // Java 5 - logger.debug( - "ThreadPoolExecutor.allowCoreThreadTimeOut() is not " + - "supported in this platform."); - } - + allowCoreThreadTimeOut(true); + settings = new Settings( objectSizeEstimator, maxChannelMemorySize); From 2ab42e5bde64d9695cf5602989bcf44fe9122f0b Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 30 Nov 2011 10:47:41 +0100 Subject: [PATCH 83/93] Replace tab by spaces --- .../netty/handler/execution/MemoryAwareThreadPoolExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index 1135513964..b56969fe6e 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -520,7 +520,7 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { private int waiters; Limiter(long limit) { - this.limit = limit; + this.limit = limit; } synchronized void increase(long amount) { From da3a52778b2b19138431914f1fc53aaf0dd959dd Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 30 Nov 2011 13:38:07 +0100 Subject: [PATCH 84/93] Add FileRegionEncoder which will take care of encode the FileRegion to ChannelBuffer if necessary. See #89 --- .../http => }/ChannelFutureAggregator.java | 6 +- .../socket/http/ServerMessageSwitch.java | 1 + .../channel/socket/http/WriteFragmenter.java | 1 + .../region/ChannelWritableByteChannel.java | 83 ++++++++++++ .../handler/region/FileRegionEncoder.java | 122 ++++++++++++++++++ 5 files changed, 209 insertions(+), 4 deletions(-) rename src/main/java/org/jboss/netty/channel/{socket/http => }/ChannelFutureAggregator.java (91%) create mode 100644 src/main/java/org/jboss/netty/handler/region/ChannelWritableByteChannel.java create mode 100644 src/main/java/org/jboss/netty/handler/region/FileRegionEncoder.java diff --git a/src/main/java/org/jboss/netty/channel/socket/http/ChannelFutureAggregator.java b/src/main/java/org/jboss/netty/channel/ChannelFutureAggregator.java similarity index 91% rename from src/main/java/org/jboss/netty/channel/socket/http/ChannelFutureAggregator.java rename to src/main/java/org/jboss/netty/channel/ChannelFutureAggregator.java index 8357360719..bf5c5a3677 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/ChannelFutureAggregator.java +++ b/src/main/java/org/jboss/netty/channel/ChannelFutureAggregator.java @@ -14,13 +14,11 @@ * under the License. */ -package org.jboss.netty.channel.socket.http; +package org.jboss.netty.channel; import java.util.HashSet; import java.util.Set; -import org.jboss.netty.channel.ChannelFuture; -import org.jboss.netty.channel.ChannelFutureListener; /** * Class which is used to consolidate multiple channel futures into one, by @@ -31,7 +29,7 @@ import org.jboss.netty.channel.ChannelFutureListener; * @author Iain McGinniss (iain.mcginniss@onedrum.com) * @author OneDrum Ltd. */ -class ChannelFutureAggregator implements ChannelFutureListener { +public class ChannelFutureAggregator implements ChannelFutureListener { private final ChannelFuture aggregateFuture; diff --git a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java index c0225d0c1c..5a008e6895 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/ServerMessageSwitch.java @@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicReference; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelFutureAggregator; import org.jboss.netty.channel.ChannelFutureListener; import org.jboss.netty.channel.Channels; import org.jboss.netty.handler.codec.http.HttpResponse; diff --git a/src/main/java/org/jboss/netty/channel/socket/http/WriteFragmenter.java b/src/main/java/org/jboss/netty/channel/socket/http/WriteFragmenter.java index 94380e96cb..a7bf30520b 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/WriteFragmenter.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/WriteFragmenter.java @@ -19,6 +19,7 @@ import java.util.List; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelFutureAggregator; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.Channels; import org.jboss.netty.channel.MessageEvent; diff --git a/src/main/java/org/jboss/netty/handler/region/ChannelWritableByteChannel.java b/src/main/java/org/jboss/netty/handler/region/ChannelWritableByteChannel.java new file mode 100644 index 0000000000..8614c45922 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/region/ChannelWritableByteChannel.java @@ -0,0 +1,83 @@ +/* + * Copyright 2011 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.region; + + +import java.io.IOException; +import java.net.SocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.WritableByteChannel; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.buffer.ChannelBuffers; +import org.jboss.netty.channel.ChannelDownstreamHandler; +import org.jboss.netty.channel.ChannelFuture; +import org.jboss.netty.channel.ChannelFutureAggregator; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.channel.Channels; +import org.jboss.netty.channel.MessageEvent; + +/** + * {@link WritableByteChannel} implementation which will take care to wrap the {@link ByteBuffer} to a {@link ChannelBuffer} and forward it to the next {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} on every {@link #write(ByteBuffer)} + * operation. + * + * @author The Netty Project + * @author Norman Maurer + * + */ +public class ChannelWritableByteChannel implements WritableByteChannel { + + private boolean closed = false; + private final ChannelHandlerContext context; + private final ChannelFutureAggregator aggregator; + private final SocketAddress remote; + + + public ChannelWritableByteChannel(ChannelHandlerContext context, MessageEvent event) { + this(context, new ChannelFutureAggregator(event.getFuture()), event.getRemoteAddress()); + } + + + public ChannelWritableByteChannel(ChannelHandlerContext context, ChannelFutureAggregator aggregator, SocketAddress remote) { + this.context = context; + this.aggregator = aggregator; + this.remote = remote; + } + + @Override + public boolean isOpen() { + return !closed && context.getChannel().isOpen(); + } + + @Override + public void close() throws IOException { + closed = true; + } + + @Override + public int write(ByteBuffer src) throws IOException { + int written = src.remaining(); + + // create a new ChannelFuture and add it to the aggregator + ChannelFuture future = Channels.future(context.getChannel(), true); + aggregator.addFuture(future); + + Channels.write(context, future, ChannelBuffers.wrappedBuffer(src), remote); + return written; + } + +} diff --git a/src/main/java/org/jboss/netty/handler/region/FileRegionEncoder.java b/src/main/java/org/jboss/netty/handler/region/FileRegionEncoder.java new file mode 100644 index 0000000000..b6d3f2e827 --- /dev/null +++ b/src/main/java/org/jboss/netty/handler/region/FileRegionEncoder.java @@ -0,0 +1,122 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * Red Hat 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 org.jboss.netty.handler.region; + + +import java.nio.channels.WritableByteChannel; + +import org.jboss.netty.buffer.ChannelBuffer; +import org.jboss.netty.channel.ChannelDownstreamHandler; +import org.jboss.netty.channel.ChannelEvent; +import org.jboss.netty.channel.ChannelHandler; +import org.jboss.netty.channel.ChannelHandlerContext; +import org.jboss.netty.channel.ChannelPipeline; +import org.jboss.netty.channel.FileRegion; +import org.jboss.netty.channel.MessageEvent; +import org.jboss.netty.handler.codec.compression.ZlibDecoder; +import org.jboss.netty.handler.codec.compression.ZlibEncoder; +import org.jboss.netty.handler.ssl.SslHandler; + +/** + * {@link ChannelDownstreamHandler} implementation which encodes a {@link FileRegion} to {@link ChannelBuffer}'s if one of the given {@link ChannelHandler} was found in the {@link ChannelPipeline}. + * + * This {@link ChannelDownstreamHandler} should be used if you plan to write {@link FileRegion} objects and also have some {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} which needs to transform + * the to be written {@link ChannelBuffer} in any case. This is for example the case with {@link SslHandler} and {@link ZlibDecoder}. + * + * @author The Netty Project + * @author Norman Maurer + * + */ +public class FileRegionEncoder implements ChannelDownstreamHandler{ + + private final Class[] handlers; + + + /** + * Create a new {@link FileRegionEncoder} which checks if one of the given {@link ChannelHandler}'s is contained in the {@link ChannelPipeline} and if so convert the {@link FileRegion} to {@link ChannelBuffer}'s. + * + * If the given array is empty it will encode the {@link FileRegion} to {@link ChannelBuffer}'s in all cases. + */ + public FileRegionEncoder(Class... handlers) { + if (handlers == null) { + throw new NullPointerException("handlers"); + } + this.handlers = handlers; + } + + + /** + * Create a new {@link FileRegionEncoder} which checks for the present of {@link SslHandler} and {@link ZlibEncoder} once a {@link FileRegion} was written. If once of the two handlers is found it will encode the {@link FileRegion} to {@link ChannelBuffer}'s + */ + @SuppressWarnings("unchecked") + public FileRegionEncoder() { + this(SslHandler.class, ZlibEncoder.class); + } + + @Override + public void handleDownstream( + ChannelHandlerContext ctx, ChannelEvent evt) throws Exception { + if (!(evt instanceof MessageEvent)) { + ctx.sendDownstream(evt); + return; + } + + MessageEvent e = (MessageEvent) evt; + Object originalMessage = e.getMessage(); + if (originalMessage instanceof FileRegion) { + + if (isConvertNeeded(ctx, e)) { + FileRegion fr = (FileRegion) originalMessage; + WritableByteChannel bchannel = new ChannelWritableByteChannel(ctx, e); + + int length = 0; + long i = 0; + while ((i = fr.transferTo(bchannel, length)) > 0) { + length += i; + if (length >= fr.getCount()) { + break; + } + } + } else { + // no converting is needed so just sent the event downstream + ctx.sendDownstream(evt); + } + } else { + // no converting is needed so just sent the event downstream + ctx.sendDownstream(evt); + } + + } + + /** + * Returns true if the {@link FileRegion} does need to get converted to {@link ChannelBuffer}'s + * + */ + private boolean isConvertNeeded(ChannelHandlerContext ctx, MessageEvent evt) throws Exception{ + if (handlers.length == 0) { + return true; + } else { + for (int i = 0; i < handlers.length; i++) { + if(ctx.getPipeline().get(handlers[i]) != null) { + return true; + } + } + return false; + } + } + + +} From d2278a7d53b14680f56fbe37921c613ffeedabe1 Mon Sep 17 00:00:00 2001 From: norman Date: Wed, 30 Nov 2011 13:45:51 +0100 Subject: [PATCH 85/93] Make sure ChannelFutureAggregator is thread-safe and only hold the lock as short as possible. This also change it to lazy init the HashSet that holds the ChannelFuture's. See #90 --- .../channel/ChannelFutureAggregator.java | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/ChannelFutureAggregator.java b/src/main/java/org/jboss/netty/channel/ChannelFutureAggregator.java index bf5c5a3677..54f2801070 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelFutureAggregator.java +++ b/src/main/java/org/jboss/netty/channel/ChannelFutureAggregator.java @@ -33,20 +33,24 @@ public class ChannelFutureAggregator implements ChannelFutureListener { private final ChannelFuture aggregateFuture; - private final Set pendingFutures; + private Set pendingFutures; public ChannelFutureAggregator(ChannelFuture aggregateFuture) { this.aggregateFuture = aggregateFuture; - pendingFutures = new HashSet(); } public void addFuture(ChannelFuture future) { - pendingFutures.add(future); + synchronized(this) { + if (pendingFutures == null) { + pendingFutures = new HashSet(); + } + pendingFutures.add(future); + } future.addListener(this); } @Override - public synchronized void operationComplete(ChannelFuture future) + public void operationComplete(ChannelFuture future) throws Exception { if (future.isCancelled()) { // TODO: what should the correct behaviour be when a fragment is cancelled? @@ -54,17 +58,24 @@ public class ChannelFutureAggregator implements ChannelFutureListener { return; } - pendingFutures.remove(future); - if (!future.isSuccess()) { - aggregateFuture.setFailure(future.getCause()); - for (ChannelFuture pendingFuture: pendingFutures) { - pendingFuture.cancel(); + synchronized (this) { + if (pendingFutures == null) { + aggregateFuture.setSuccess(); + } else { + pendingFutures.remove(future); + if (!future.isSuccess()) { + aggregateFuture.setFailure(future.getCause()); + for (ChannelFuture pendingFuture: pendingFutures) { + pendingFuture.cancel(); + } + } else { + if (pendingFutures.isEmpty()) { + aggregateFuture.setSuccess(); + } + } } - return; - } - if (pendingFutures.isEmpty()) { - aggregateFuture.setSuccess(); } + } } \ No newline at end of file From 9d3828bbe91d7bc7aad6e34c719c4591593be84d Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 30 Nov 2011 20:14:57 +0100 Subject: [PATCH 86/93] Use LinkedTransferQueue for OMATPE --- .../execution/OrderedMemoryAwareThreadPoolExecutor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java index ede4134cd0..c6949eff20 100644 --- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java @@ -16,9 +16,9 @@ package org.jboss.netty.handler.execution; import java.util.IdentityHashMap; +import java.util.Queue; import java.util.Set; import java.util.WeakHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; import java.util.concurrent.ThreadFactory; @@ -31,6 +31,7 @@ import org.jboss.netty.channel.ChannelState; import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.util.ObjectSizeEstimator; import org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap; +import org.jboss.netty.util.internal.LinkedTransferQueue; /** * A {@link MemoryAwareThreadPoolExecutor} which makes sure the events from the @@ -285,7 +286,7 @@ public class OrderedMemoryAwareThreadPoolExecutor extends } private final class ChildExecutor implements Executor, Runnable { - private final ConcurrentLinkedQueue tasks = new ConcurrentLinkedQueue(); + private final Queue tasks = new LinkedTransferQueue(); private final AtomicBoolean isRunning = new AtomicBoolean(false); ChildExecutor() { From 7ddf1b1ae132fe2581ca948d2f122ee5e8096c66 Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Mon, 14 Nov 2011 19:12:19 -0500 Subject: [PATCH 87/93] Remove unnecessary 'return' statement. --- .../http/websocketx/sslserver/WebSocketSslServerSslContext.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java index 6b668e60dc..64ab6e34da 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java @@ -92,8 +92,6 @@ public class WebSocketSslServerSslContext { throw new Error("Failed to initialize the server-side SSLContext", e); } _serverContext = serverContext; - - return; } catch (Exception ex) { logger.error("Error initializing SslContextManager. " + ex.getMessage(), ex); System.exit(1); From 461837e14b59092c6cb1b746275fa5c4ace8dafa Mon Sep 17 00:00:00 2001 From: "Craig P. Motlin" Date: Mon, 14 Nov 2011 19:14:06 -0500 Subject: [PATCH 88/93] Remove unnecessary concatenation with empty strings. --- .../netty/example/http/websocket/WebSocketServerIndexPage.java | 2 +- .../http/websocketx/server/WebSocketServerIndexPage.java | 2 +- .../http/websocketx/sslserver/WebSocketSslServerIndexPage.java | 2 +- .../jboss/netty/example/localtime/LocalTimeServerHandler.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerIndexPage.java b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerIndexPage.java index 474a70d192..8ea63a4987 100644 --- a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerIndexPage.java +++ b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerIndexPage.java @@ -46,7 +46,7 @@ public class WebSocketServerIndexPage { "} else {" + NEWLINE + " alert(\"Your browser does not support Web Socket.\");" + NEWLINE + "}" + NEWLINE + - "" + NEWLINE + + NEWLINE + "function send(message) {" + NEWLINE + " if (!window.WebSocket) { return; }" + NEWLINE + " if (socket.readyState == WebSocket.OPEN) {" + NEWLINE + diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerIndexPage.java b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerIndexPage.java index 179df6b633..1bd7fb63bd 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerIndexPage.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerIndexPage.java @@ -50,7 +50,7 @@ public class WebSocketServerIndexPage { "} else {" + NEWLINE + " alert(\"Your browser does not support Web Socket.\");" + NEWLINE + "}" + NEWLINE + - "" + NEWLINE + + NEWLINE + "function send(message) {" + NEWLINE + " if (!window.WebSocket) { return; }" + NEWLINE + " if (socket.readyState == WebSocket.OPEN) {" + NEWLINE + diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java index 8fe45996f9..e3c84695ad 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java @@ -50,7 +50,7 @@ public class WebSocketSslServerIndexPage { "} else {" + NEWLINE + " alert(\"Your browser does not support Web Socket.\");" + NEWLINE + "}" + NEWLINE + - "" + NEWLINE + + NEWLINE + "function send(message) {" + NEWLINE + " if (!window.WebSocket) { return; }" + NEWLINE + " if (socket.readyState == WebSocket.OPEN) {" + NEWLINE + diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerHandler.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerHandler.java index 261d709784..c2b1c297da 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerHandler.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerHandler.java @@ -93,6 +93,6 @@ public class LocalTimeServerHandler extends SimpleChannelUpstreamHandler { } private static String toString(Continent c) { - return "" + c.name().charAt(0) + c.name().toLowerCase().substring(1); + return c.name().charAt(0) + c.name().toLowerCase().substring(1); } } From 62f28766945e5bffae9e86e89127d2baeaab5873 Mon Sep 17 00:00:00 2001 From: Cruz Bishop Date: Thu, 1 Dec 2011 17:17:19 +1000 Subject: [PATCH 89/93] Ignore "geany" files These files are generated by the IDE that I use now --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 108242bdaf..aac0dd3a6a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /*.iml /*.ipr /*.iws +/*.geany From 47af6bc9e8962c638d4aa37c41f928841731222c Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 1 Dec 2011 08:43:44 +0100 Subject: [PATCH 90/93] Encode FileRegion to ChannelBuffer's everytime the handler is called. The user should add/remove it on the fly for better performance. See #89 --- .../handler/region/FileRegionEncoder.java | 80 ++++--------------- 1 file changed, 17 insertions(+), 63 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/region/FileRegionEncoder.java b/src/main/java/org/jboss/netty/handler/region/FileRegionEncoder.java index b6d3f2e827..547b88dd6d 100644 --- a/src/main/java/org/jboss/netty/handler/region/FileRegionEncoder.java +++ b/src/main/java/org/jboss/netty/handler/region/FileRegionEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 Red Hat, Inc. + * Copyright 2011 Red Hat, Inc. * * Red Hat 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 @@ -26,46 +26,23 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.FileRegion; import org.jboss.netty.channel.MessageEvent; -import org.jboss.netty.handler.codec.compression.ZlibDecoder; -import org.jboss.netty.handler.codec.compression.ZlibEncoder; -import org.jboss.netty.handler.ssl.SslHandler; /** * {@link ChannelDownstreamHandler} implementation which encodes a {@link FileRegion} to {@link ChannelBuffer}'s if one of the given {@link ChannelHandler} was found in the {@link ChannelPipeline}. * * This {@link ChannelDownstreamHandler} should be used if you plan to write {@link FileRegion} objects and also have some {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} which needs to transform - * the to be written {@link ChannelBuffer} in any case. This is for example the case with {@link SslHandler} and {@link ZlibDecoder}. + * the to be written {@link ChannelBuffer} in any case. This could be for example {@link ChannelDownstreamHandler}'s which needs to encrypt or compress messages. + * + * Users of this {@link FileRegionEncoder} should add / remove this {@link ChannelDownstreamHandler} on the fly to get the best performance out of their system. + * * * @author The Netty Project * @author Norman Maurer * */ +@ChannelHandler.Sharable public class FileRegionEncoder implements ChannelDownstreamHandler{ - private final Class[] handlers; - - - /** - * Create a new {@link FileRegionEncoder} which checks if one of the given {@link ChannelHandler}'s is contained in the {@link ChannelPipeline} and if so convert the {@link FileRegion} to {@link ChannelBuffer}'s. - * - * If the given array is empty it will encode the {@link FileRegion} to {@link ChannelBuffer}'s in all cases. - */ - public FileRegionEncoder(Class... handlers) { - if (handlers == null) { - throw new NullPointerException("handlers"); - } - this.handlers = handlers; - } - - - /** - * Create a new {@link FileRegionEncoder} which checks for the present of {@link SslHandler} and {@link ZlibEncoder} once a {@link FileRegion} was written. If once of the two handlers is found it will encode the {@link FileRegion} to {@link ChannelBuffer}'s - */ - @SuppressWarnings("unchecked") - public FileRegionEncoder() { - this(SslHandler.class, ZlibEncoder.class); - } - @Override public void handleDownstream( ChannelHandlerContext ctx, ChannelEvent evt) throws Exception { @@ -77,46 +54,23 @@ public class FileRegionEncoder implements ChannelDownstreamHandler{ MessageEvent e = (MessageEvent) evt; Object originalMessage = e.getMessage(); if (originalMessage instanceof FileRegion) { - - if (isConvertNeeded(ctx, e)) { - FileRegion fr = (FileRegion) originalMessage; - WritableByteChannel bchannel = new ChannelWritableByteChannel(ctx, e); - - int length = 0; - long i = 0; - while ((i = fr.transferTo(bchannel, length)) > 0) { - length += i; - if (length >= fr.getCount()) { - break; - } + + FileRegion fr = (FileRegion) originalMessage; + WritableByteChannel bchannel = new ChannelWritableByteChannel(ctx, e); + + int length = 0; + long i = 0; + while ((i = fr.transferTo(bchannel, length)) > 0) { + length += i; + if (length >= fr.getCount()) { + break; } - } else { - // no converting is needed so just sent the event downstream - ctx.sendDownstream(evt); } + } else { // no converting is needed so just sent the event downstream ctx.sendDownstream(evt); } } - - /** - * Returns true if the {@link FileRegion} does need to get converted to {@link ChannelBuffer}'s - * - */ - private boolean isConvertNeeded(ChannelHandlerContext ctx, MessageEvent evt) throws Exception{ - if (handlers.length == 0) { - return true; - } else { - for (int i = 0; i < handlers.length; i++) { - if(ctx.getPipeline().get(handlers[i]) != null) { - return true; - } - } - return false; - } - } - - } From 2a0a63e1bb4627c2f503c43cf524c68565c0b205 Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 1 Dec 2011 09:39:48 +0100 Subject: [PATCH 91/93] Remove the usage of AtomicLong as this only confuse users. The Handler is not suited for re-use anyway. See #93 --- .../jboss/netty/example/discard/DiscardClientHandler.java | 7 +++---- .../jboss/netty/example/discard/DiscardServerHandler.java | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/jboss/netty/example/discard/DiscardClientHandler.java b/src/main/java/org/jboss/netty/example/discard/DiscardClientHandler.java index 9a991a8bcf..7d4611d313 100644 --- a/src/main/java/org/jboss/netty/example/discard/DiscardClientHandler.java +++ b/src/main/java/org/jboss/netty/example/discard/DiscardClientHandler.java @@ -15,7 +15,6 @@ */ package org.jboss.netty.example.discard; -import java.util.concurrent.atomic.AtomicLong; import java.util.logging.Level; import java.util.logging.Logger; @@ -44,7 +43,7 @@ public class DiscardClientHandler extends SimpleChannelUpstreamHandler { private static final Logger logger = Logger.getLogger( DiscardClientHandler.class.getName()); - private final AtomicLong transferredBytes = new AtomicLong(); + private long transferredBytes = 0; private final byte[] content; public DiscardClientHandler(int messageSize) { @@ -56,7 +55,7 @@ public class DiscardClientHandler extends SimpleChannelUpstreamHandler { } public long getTransferredBytes() { - return transferredBytes.get(); + return transferredBytes; } @Override @@ -90,7 +89,7 @@ public class DiscardClientHandler extends SimpleChannelUpstreamHandler { @Override public void writeComplete(ChannelHandlerContext ctx, WriteCompletionEvent e) { - transferredBytes.addAndGet(e.getWrittenAmount()); + transferredBytes =+e.getWrittenAmount(); } @Override diff --git a/src/main/java/org/jboss/netty/example/discard/DiscardServerHandler.java b/src/main/java/org/jboss/netty/example/discard/DiscardServerHandler.java index 67ec94682f..224b2728bd 100644 --- a/src/main/java/org/jboss/netty/example/discard/DiscardServerHandler.java +++ b/src/main/java/org/jboss/netty/example/discard/DiscardServerHandler.java @@ -15,7 +15,6 @@ */ package org.jboss.netty.example.discard; -import java.util.concurrent.atomic.AtomicLong; import java.util.logging.Level; import java.util.logging.Logger; @@ -40,10 +39,10 @@ public class DiscardServerHandler extends SimpleChannelUpstreamHandler { private static final Logger logger = Logger.getLogger( DiscardServerHandler.class.getName()); - private final AtomicLong transferredBytes = new AtomicLong(); + private long transferredBytes = 0; public long getTransferredBytes() { - return transferredBytes.get(); + return transferredBytes; } @Override @@ -59,7 +58,7 @@ public class DiscardServerHandler extends SimpleChannelUpstreamHandler { @Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) { // Discard received data silently by doing nothing. - transferredBytes.addAndGet(((ChannelBuffer) e.getMessage()).readableBytes()); + transferredBytes += (((ChannelBuffer) e.getMessage()).readableBytes()); } @Override From ec9bcbd5531775a74e114c56d4cd341195edf2c9 Mon Sep 17 00:00:00 2001 From: Cruz Bishop Date: Thu, 1 Dec 2011 21:34:25 +1000 Subject: [PATCH 92/93] Removed @version tags and did some documentation Some test classes are now documented --- .../org/jboss/netty/bootstrap/Bootstrap.java | 2 - .../netty/bootstrap/ClientBootstrap.java | 2 - .../bootstrap/ConnectionlessBootstrap.java | 2 - .../netty/bootstrap/ServerBootstrap.java | 2 - .../netty/buffer/AbstractChannelBuffer.java | 2 - .../buffer/AbstractChannelBufferFactory.java | 2 - .../buffer/BigEndianHeapChannelBuffer.java | 2 - .../buffer/ByteBufferBackedChannelBuffer.java | 3 - .../org/jboss/netty/buffer/ChannelBuffer.java | 2 - .../netty/buffer/ChannelBufferFactory.java | 1 - .../buffer/ChannelBufferIndexFinder.java | 2 - .../buffer/ChannelBufferInputStream.java | 2 - .../buffer/ChannelBufferOutputStream.java | 2 - .../jboss/netty/buffer/ChannelBuffers.java | 2 - .../netty/buffer/CompositeChannelBuffer.java | 3 - .../buffer/DirectChannelBufferFactory.java | 1 - .../netty/buffer/DuplicatedChannelBuffer.java | 3 - .../netty/buffer/DynamicChannelBuffer.java | 3 - .../jboss/netty/buffer/HeapChannelBuffer.java | 2 - .../buffer/HeapChannelBufferFactory.java | 1 - .../buffer/LittleEndianHeapChannelBuffer.java | 2 - .../netty/buffer/ReadOnlyChannelBuffer.java | 3 - .../netty/buffer/SlicedChannelBuffer.java | 3 - .../netty/buffer/TruncatedChannelBuffer.java | 3 - .../netty/buffer/WrappedChannelBuffer.java | 3 - .../jboss/netty/channel/AbstractChannel.java | 2 - .../netty/channel/AbstractChannelSink.java | 2 - .../netty/channel/AbstractServerChannel.java | 3 - .../AdaptiveReceiveBufferSizePredictor.java | 3 - ...tiveReceiveBufferSizePredictorFactory.java | 2 - .../java/org/jboss/netty/channel/Channel.java | 2 - .../jboss/netty/channel/ChannelConfig.java | 2 - .../channel/ChannelDownstreamHandler.java | 2 - .../org/jboss/netty/channel/ChannelEvent.java | 2 - .../jboss/netty/channel/ChannelException.java | 2 - .../jboss/netty/channel/ChannelFactory.java | 2 - .../jboss/netty/channel/ChannelFuture.java | 2 - .../netty/channel/ChannelFutureListener.java | 2 - .../ChannelFutureProgressListener.java | 2 - .../jboss/netty/channel/ChannelHandler.java | 3 - .../netty/channel/ChannelHandlerContext.java | 2 - .../ChannelHandlerLifeCycleException.java | 2 - .../org/jboss/netty/channel/ChannelLocal.java | 1 - .../jboss/netty/channel/ChannelPipeline.java | 2 - .../channel/ChannelPipelineException.java | 2 - .../netty/channel/ChannelPipelineFactory.java | 2 - .../org/jboss/netty/channel/ChannelSink.java | 2 - .../org/jboss/netty/channel/ChannelState.java | 2 - .../netty/channel/ChannelStateEvent.java | 2 - .../netty/channel/ChannelUpstreamHandler.java | 2 - .../org/jboss/netty/channel/Channels.java | 2 - .../netty/channel/ChildChannelStateEvent.java | 2 - .../netty/channel/CompleteChannelFuture.java | 2 - .../netty/channel/DefaultChannelConfig.java | 3 - .../netty/channel/DefaultChannelFuture.java | 2 - .../netty/channel/DefaultChannelPipeline.java | 3 - .../DefaultChildChannelStateEvent.java | 3 - .../netty/channel/DefaultExceptionEvent.java | 3 - .../channel/DefaultServerChannelConfig.java | 2 - .../channel/DefaultWriteCompletionEvent.java | 2 - .../channel/DownstreamChannelStateEvent.java | 3 - .../netty/channel/DownstreamMessageEvent.java | 3 - .../jboss/netty/channel/ExceptionEvent.java | 2 - .../netty/channel/FailedChannelFuture.java | 2 - .../org/jboss/netty/channel/FileRegion.java | 3 +- .../FixedReceiveBufferSizePredictor.java | 2 - ...ixedReceiveBufferSizePredictorFactory.java | 2 - .../channel/LifeCycleAwareChannelHandler.java | 1 - .../org/jboss/netty/channel/MessageEvent.java | 2 - .../channel/ReceiveBufferSizePredictor.java | 3 - .../ReceiveBufferSizePredictorFactory.java | 2 - .../jboss/netty/channel/ServerChannel.java | 1 - .../netty/channel/ServerChannelFactory.java | 2 - .../SimpleChannelDownstreamHandler.java | 2 - .../netty/channel/SimpleChannelHandler.java | 2 - .../channel/SimpleChannelUpstreamHandler.java | 2 - .../netty/channel/StaticChannelPipeline.java | 3 - .../netty/channel/SucceededChannelFuture.java | 2 - .../channel/UpstreamChannelStateEvent.java | 3 - .../netty/channel/UpstreamMessageEvent.java | 3 - .../netty/channel/WriteCompletionEvent.java | 2 - .../netty/channel/group/ChannelGroup.java | 1 - .../channel/group/ChannelGroupFuture.java | 1 - .../group/ChannelGroupFutureListener.java | 2 - .../netty/channel/group/CombinedIterator.java | 1 - .../channel/group/DefaultChannelGroup.java | 1 - .../group/DefaultChannelGroupFuture.java | 2 - .../channel/local/DefaultLocalChannel.java | 1 - .../DefaultLocalClientChannelFactory.java | 1 - .../local/DefaultLocalServerChannel.java | 1 - .../DefaultLocalServerChannelFactory.java | 1 - .../netty/channel/local/LocalAddress.java | 1 - .../netty/channel/local/LocalChannel.java | 1 - .../channel/local/LocalChannelRegistry.java | 1 - .../local/LocalClientChannelFactory.java | 1 - .../channel/local/LocalClientChannelSink.java | 1 - .../channel/local/LocalServerChannel.java | 1 - .../local/LocalServerChannelFactory.java | 1 - .../channel/local/LocalServerChannelSink.java | 1 - .../socket/ClientSocketChannelFactory.java | 2 - .../netty/channel/socket/DatagramChannel.java | 2 - .../channel/socket/DatagramChannelConfig.java | 2 - .../socket/DatagramChannelFactory.java | 2 - .../socket/DefaultDatagramChannelConfig.java | 2 - .../DefaultServerSocketChannelConfig.java | 2 - .../socket/DefaultSocketChannelConfig.java | 3 - .../channel/socket/ServerSocketChannel.java | 2 - .../socket/ServerSocketChannelConfig.java | 2 - .../socket/ServerSocketChannelFactory.java | 2 - .../netty/channel/socket/SocketChannel.java | 2 - .../channel/socket/SocketChannelConfig.java | 2 - .../nio/DefaultNioDatagramChannelConfig.java | 3 - .../nio/DefaultNioSocketChannelConfig.java | 3 - .../socket/nio/NioAcceptedSocketChannel.java | 3 - .../socket/nio/NioClientSocketChannel.java | 3 - .../nio/NioClientSocketChannelFactory.java | 2 - .../nio/NioClientSocketPipelineSink.java | 3 - .../socket/nio/NioDatagramChannel.java | 2 - .../socket/nio/NioDatagramChannelConfig.java | 2 - .../socket/nio/NioDatagramChannelFactory.java | 2 - .../socket/nio/NioDatagramPipelineSink.java | 2 - .../channel/socket/nio/NioDatagramWorker.java | 2 - .../socket/nio/NioProviderMetadata.java | 3 - .../socket/nio/NioServerSocketChannel.java | 3 - .../nio/NioServerSocketChannelFactory.java | 2 - .../nio/NioServerSocketPipelineSink.java | 3 - .../channel/socket/nio/NioSocketChannel.java | 3 - .../socket/nio/NioSocketChannelConfig.java | 2 - .../netty/channel/socket/nio/NioWorker.java | 3 - .../channel/socket/nio/SelectorUtil.java | 1 - .../socket/nio/SocketReceiveBufferPool.java | 1 - .../socket/nio/SocketSendBufferPool.java | 1 - .../socket/oio/OioAcceptedSocketChannel.java | 3 - .../socket/oio/OioClientSocketChannel.java | 3 - .../oio/OioClientSocketChannelFactory.java | 2 - .../oio/OioClientSocketPipelineSink.java | 3 - .../socket/oio/OioDatagramChannel.java | 3 - .../socket/oio/OioDatagramChannelFactory.java | 2 - .../socket/oio/OioDatagramPipelineSink.java | 3 - .../channel/socket/oio/OioDatagramWorker.java | 3 - .../socket/oio/OioServerSocketChannel.java | 3 - .../oio/OioServerSocketChannelFactory.java | 2 - .../oio/OioServerSocketPipelineSink.java | 3 - .../channel/socket/oio/OioSocketChannel.java | 3 - .../netty/channel/socket/oio/OioWorker.java | 3 - .../NettyLoggerConfigurator.java | 1 - .../container/osgi/NettyBundleActivator.java | 1 - .../spring/NettyLoggerConfigurator.java | 1 - .../netty/example/discard/DiscardClient.java | 2 - .../example/discard/DiscardClientHandler.java | 2 - .../netty/example/discard/DiscardServer.java | 2 - .../example/discard/DiscardServerHandler.java | 2 - .../jboss/netty/example/echo/EchoClient.java | 3 - .../netty/example/echo/EchoClientHandler.java | 2 - .../jboss/netty/example/echo/EchoServer.java | 3 - .../netty/example/echo/EchoServerHandler.java | 2 - .../example/factorial/BigIntegerDecoder.java | 2 - .../example/factorial/FactorialClient.java | 2 - .../factorial/FactorialClientHandler.java | 2 - .../FactorialClientPipelineFactory.java | 2 - .../example/factorial/FactorialServer.java | 2 - .../factorial/FactorialServerHandler.java | 2 - .../FactorialServerPipelineFactory.java | 2 - .../example/factorial/NumberEncoder.java | 2 - .../netty/example/http/snoop/HttpClient.java | 2 - .../http/snoop/HttpClientPipelineFactory.java | 2 - .../http/snoop/HttpRequestHandler.java | 2 - .../http/snoop/HttpResponseHandler.java | 2 - .../netty/example/http/snoop/HttpServer.java | 2 - .../http/snoop/HttpServerPipelineFactory.java | 2 - .../netty/example/http/upload/HttpClient.java | 2 - .../upload/HttpClientPipelineFactory.java | 2 - .../http/upload/HttpRequestHandler.java | 3 - .../http/upload/HttpResponseHandler.java | 2 - .../netty/example/http/upload/HttpServer.java | 2 - .../upload/HttpServerPipelineFactory.java | 2 - .../http/websocket/WebSocketServer.java | 2 - .../websocket/WebSocketServerHandler.java | 2 - .../websocket/WebSocketServerIndexPage.java | 2 - .../WebSocketServerPipelineFactory.java | 2 - .../websocketx/autobahn/WebSocketServer.java | 2 - .../autobahn/WebSocketServerHandler.java | 2 - .../WebSocketServerPipelineFactory.java | 2 - .../example/http/websocketx/client/App.java | 2 - .../websocketx/server/WebSocketServer.java | 2 - .../server/WebSocketServerHandler.java | 2 - .../server/WebSocketServerIndexPage.java | 2 - .../WebSocketServerPipelineFactory.java | 2 - .../sslserver/WebSocketSslServer.java | 2 - .../sslserver/WebSocketSslServerHandler.java | 2 - .../WebSocketSslServerIndexPage.java | 2 - .../WebSocketSslServerPipelineFactory.java | 2 - .../WebSocketSslServerSslContext.java | 2 - .../netty/example/local/LocalExample.java | 1 - .../local/LocalExampleMultthreaded.java | 1 - .../local/LocalServerPipelineFactory.java | 1 - .../example/localtime/LocalTimeClient.java | 2 - .../localtime/LocalTimeClientHandler.java | 2 - .../LocalTimeClientPipelineFactory.java | 1 - .../example/localtime/LocalTimeServer.java | 2 - .../localtime/LocalTimeServerHandler.java | 2 - .../LocalTimeServerPipelineFactory.java | 1 - .../example/objectecho/ObjectEchoClient.java | 2 - .../objectecho/ObjectEchoClientHandler.java | 2 - .../example/objectecho/ObjectEchoServer.java | 2 - .../objectecho/ObjectEchoServerHandler.java | 2 - .../PortUnificationServer.java | 2 - .../PortUnificationServerHandler.java | 2 - .../netty/example/proxy/HexDumpProxy.java | 1 - .../proxy/HexDumpProxyInboundHandler.java | 1 - .../proxy/HexDumpProxyPipelineFactory.java | 1 - .../example/qotm/QuoteOfTheMomentClient.java | 1 - .../qotm/QuoteOfTheMomentClientHandler.java | 1 - .../example/qotm/QuoteOfTheMomentServer.java | 1 - .../qotm/QuoteOfTheMomentServerHandler.java | 1 - .../example/securechat/SecureChatClient.java | 3 - .../securechat/SecureChatClientHandler.java | 2 - .../SecureChatClientPipelineFactory.java | 3 - .../securechat/SecureChatKeyStore.java | 2 - .../example/securechat/SecureChatServer.java | 2 - .../securechat/SecureChatServerHandler.java | 3 - .../SecureChatServerPipelineFactory.java | 3 - .../SecureChatSslContextFactory.java | 2 - .../SecureChatTrustManagerFactory.java | 2 - .../netty/example/telnet/TelnetClient.java | 2 - .../example/telnet/TelnetClientHandler.java | 2 - .../telnet/TelnetClientPipelineFactory.java | 3 - .../netty/example/telnet/TelnetServer.java | 2 - .../example/telnet/TelnetServerHandler.java | 2 - .../telnet/TelnetServerPipelineFactory.java | 3 - .../netty/example/uptime/UptimeClient.java | 2 - .../example/uptime/UptimeClientHandler.java | 2 - .../netty/handler/codec/base64/Base64.java | 1 - .../handler/codec/base64/Base64Decoder.java | 1 - .../handler/codec/base64/Base64Dialect.java | 1 - .../handler/codec/base64/Base64Encoder.java | 1 - .../handler/codec/bytes/ByteArrayDecoder.java | 2 - .../handler/codec/bytes/ByteArrayEncoder.java | 2 - .../compression/CompressionException.java | 1 - .../codec/compression/ZlibDecoder.java | 1 - .../codec/compression/ZlibEncoder.java | 1 - .../handler/codec/compression/ZlibUtil.java | 1 - .../codec/compression/ZlibWrapper.java | 1 - .../codec/embedder/AbstractCodecEmbedder.java | 1 - .../handler/codec/embedder/CodecEmbedder.java | 1 - .../embedder/CodecEmbedderException.java | 1 - .../codec/embedder/DecoderEmbedder.java | 1 - .../codec/embedder/EmbeddedChannel.java | 1 - .../embedder/EmbeddedChannelFactory.java | 1 - .../codec/embedder/EmbeddedSocketAddress.java | 1 - .../codec/embedder/EncoderEmbedder.java | 1 - .../codec/frame/CorruptedFrameException.java | 2 - .../frame/DelimiterBasedFrameDecoder.java | 2 - .../netty/handler/codec/frame/Delimiters.java | 2 - .../codec/frame/FixedLengthFrameDecoder.java | 2 - .../handler/codec/frame/FrameDecoder.java | 2 - .../frame/LengthFieldBasedFrameDecoder.java | 2 - .../codec/frame/LengthFieldPrepender.java | 1 - .../codec/frame/TooLongFrameException.java | 2 - .../codec/http/CaseIgnoringComparator.java | 1 - .../netty/handler/codec/http/Cookie.java | 1 - .../handler/codec/http/CookieDecoder.java | 1 - .../handler/codec/http/CookieEncoder.java | 1 - .../handler/codec/http/CookieHeaderNames.java | 1 - .../handler/codec/http/DefaultCookie.java | 1 - .../handler/codec/http/DefaultHttpChunk.java | 1 - .../codec/http/DefaultHttpChunkTrailer.java | 1 - .../codec/http/DefaultHttpMessage.java | 1 - .../codec/http/DefaultHttpRequest.java | 1 - .../codec/http/DefaultHttpResponse.java | 1 - .../netty/handler/codec/http/HttpChunk.java | 1 - .../codec/http/HttpChunkAggregator.java | 1 - .../handler/codec/http/HttpChunkTrailer.java | 1 - .../handler/codec/http/HttpClientCodec.java | 1 - .../handler/codec/http/HttpCodecUtil.java | 1 - .../codec/http/HttpContentCompressor.java | 1 - .../codec/http/HttpContentDecoder.java | 1 - .../codec/http/HttpContentDecompressor.java | 1 - .../codec/http/HttpContentEncoder.java | 1 - .../codec/http/HttpHeaderDateFormat.java | 1 - .../netty/handler/codec/http/HttpHeaders.java | 3 - .../netty/handler/codec/http/HttpMessage.java | 1 - .../codec/http/HttpMessageDecoder.java | 2 - .../codec/http/HttpMessageEncoder.java | 1 - .../netty/handler/codec/http/HttpMethod.java | 1 - .../netty/handler/codec/http/HttpRequest.java | 1 - .../codec/http/HttpRequestDecoder.java | 1 - .../codec/http/HttpRequestEncoder.java | 1 - .../handler/codec/http/HttpResponse.java | 1 - .../codec/http/HttpResponseDecoder.java | 1 - .../codec/http/HttpResponseEncoder.java | 1 - .../codec/http/HttpResponseStatus.java | 1 - .../handler/codec/http/HttpServerCodec.java | 1 - .../netty/handler/codec/http/HttpVersion.java | 1 - .../codec/http/QueryStringDecoder.java | 1 - .../codec/http/QueryStringEncoder.java | 1 - .../http/websocket/DefaultWebSocketFrame.java | 1 - .../codec/http/websocket/WebSocketFrame.java | 1 - .../http/websocket/WebSocketFrameDecoder.java | 1 - .../http/websocket/WebSocketFrameEncoder.java | 1 - .../websocketx/WebSocket00FrameDecoder.java | 1 - .../websocketx/WebSocket00FrameEncoder.java | 1 - .../handler/codec/oneone/OneToOneDecoder.java | 2 - .../handler/codec/oneone/OneToOneEncoder.java | 2 - .../codec/protobuf/ProtobufDecoder.java | 2 - .../codec/protobuf/ProtobufEncoder.java | 2 - .../ProtobufVarint32FrameDecoder.java | 2 - .../ProtobufVarint32LengthFieldPrepender.java | 1 - .../handler/codec/replay/ReplayError.java | 3 - .../codec/replay/ReplayingDecoder.java | 2 - .../codec/replay/ReplayingDecoderBuffer.java | 3 - .../UnreplayableOperationException.java | 1 - .../replay/UnsafeDynamicChannelBuffer.java | 3 - .../netty/handler/codec/replay/VoidEnum.java | 3 - .../netty/handler/codec/rtsp/RtspHeaders.java | 3 - .../codec/rtsp/RtspMessageDecoder.java | 1 - .../codec/rtsp/RtspMessageEncoder.java | 1 - .../netty/handler/codec/rtsp/RtspMethods.java | 1 - .../codec/rtsp/RtspRequestDecoder.java | 1 - .../codec/rtsp/RtspRequestEncoder.java | 1 - .../codec/rtsp/RtspResponseDecoder.java | 1 - .../codec/rtsp/RtspResponseEncoder.java | 1 - .../codec/rtsp/RtspResponseStatuses.java | 1 - .../handler/codec/rtsp/RtspVersions.java | 1 - .../CompactObjectInputStream.java | 3 - .../CompactObjectOutputStream.java | 3 - .../CompatibleObjectDecoder.java | 2 - .../CompatibleObjectDecoderState.java | 3 - .../CompatibleObjectEncoder.java | 2 - .../codec/serialization/ObjectDecoder.java | 2 - .../ObjectDecoderInputStream.java | 3 - .../codec/serialization/ObjectEncoder.java | 2 - .../ObjectEncoderOutputStream.java | 3 - .../serialization/SwitchableInputStream.java | 3 - .../handler/codec/string/StringDecoder.java | 2 - .../handler/codec/string/StringEncoder.java | 2 - .../execution/ChannelEventRunnable.java | 3 - .../handler/execution/ExecutionHandler.java | 2 - .../MemoryAwareThreadPoolExecutor.java | 2 - .../OrderedMemoryAwareThreadPoolExecutor.java | 2 - .../netty/handler/logging/LoggingHandler.java | 1 - .../handler/queue/BlockingReadHandler.java | 1 - .../queue/BlockingReadTimeoutException.java | 1 - .../handler/queue/BufferedWriteHandler.java | 1 - .../netty/handler/ssl/ImmediateExecutor.java | 3 - .../netty/handler/ssl/SslBufferPool.java | 2 - .../jboss/netty/handler/ssl/SslHandler.java | 2 - .../netty/handler/stream/ChunkedFile.java | 1 - .../netty/handler/stream/ChunkedInput.java | 1 - .../netty/handler/stream/ChunkedNioFile.java | 1 - .../handler/stream/ChunkedNioStream.java | 1 - .../netty/handler/stream/ChunkedStream.java | 1 - .../handler/stream/ChunkedWriteHandler.java | 1 - .../timeout/DefaultIdleStateEvent.java | 1 - .../netty/handler/timeout/IdleState.java | 1 - .../timeout/IdleStateAwareChannelHandler.java | 1 - .../IdleStateAwareChannelUpstreamHandler.java | 1 - .../netty/handler/timeout/IdleStateEvent.java | 1 - .../handler/timeout/IdleStateHandler.java | 1 - .../handler/timeout/ReadTimeoutException.java | 1 - .../handler/timeout/ReadTimeoutHandler.java | 1 - .../handler/timeout/TimeoutException.java | 1 - .../timeout/WriteTimeoutException.java | 1 - .../handler/timeout/WriteTimeoutHandler.java | 2 - .../AbstractTrafficShapingHandler.java | 1 - .../traffic/GlobalTrafficShapingHandler.java | 1 - .../netty/handler/traffic/TrafficCounter.java | 1 - .../netty/logging/AbstractInternalLogger.java | 1 - .../jboss/netty/logging/CommonsLogger.java | 3 - .../netty/logging/CommonsLoggerFactory.java | 3 - .../jboss/netty/logging/InternalLogLevel.java | 1 - .../jboss/netty/logging/InternalLogger.java | 2 - .../netty/logging/InternalLoggerFactory.java | 2 - .../org/jboss/netty/logging/JBossLogger.java | 3 - .../netty/logging/JBossLoggerFactory.java | 3 - .../org/jboss/netty/logging/JdkLogger.java | 3 - .../jboss/netty/logging/JdkLoggerFactory.java | 3 - .../org/jboss/netty/logging/Log4JLogger.java | 3 - .../netty/logging/Log4JLoggerFactory.java | 2 - .../org/jboss/netty/logging/OsgiLogger.java | 3 - .../netty/logging/OsgiLoggerFactory.java | 3 - .../org/jboss/netty/logging/Slf4JLogger.java | 3 - .../netty/logging/Slf4JLoggerFactory.java | 3 - .../org/jboss/netty/util/CharsetUtil.java | 1 - .../java/org/jboss/netty/util/DebugUtil.java | 2 - .../util/DefaultObjectSizeEstimator.java | 3 - .../netty/util/EstimatableObjectWrapper.java | 1 - .../util/ExternalResourceReleasable.java | 1 - .../netty/util/ExternalResourceUtil.java | 1 - .../jboss/netty/util/HashedWheelTimer.java | 1 - .../org/jboss/netty/util/MapBackedSet.java | 2 - .../jboss/netty/util/ObjectSizeEstimator.java | 2 - .../java/org/jboss/netty/util/Timeout.java | 1 - src/main/java/org/jboss/netty/util/Timer.java | 1 - .../java/org/jboss/netty/util/TimerTask.java | 1 - .../netty/util/VirtualExecutorService.java | 1 - .../util/internal/AtomicFieldUpdaterUtil.java | 1 - .../util/internal/ConcurrentHashMap.java | 1 - .../internal/ConcurrentIdentityHashMap.java | 1 - .../ConcurrentIdentityWeakKeyHashMap.java | 1 - .../internal/ConcurrentWeakKeyHashMap.java | 1 - .../netty/util/internal/ConversionUtil.java | 3 - .../util/internal/DeadLockProofWorker.java | 1 - .../netty/util/internal/ExecutorUtil.java | 1 - .../util/internal/LinkedTransferQueue.java | 1 - .../netty/util/internal/NonReentrantLock.java | 1 - .../netty/util/internal/ReusableIterator.java | 1 - .../SharedResourceMisuseDetector.java | 1 - .../util/internal/StackTraceSimplifier.java | 3 - .../jboss/netty/util/internal/StringUtil.java | 1 - .../util/internal/SystemPropertyUtil.java | 3 - .../util/internal/ThreadLocalBoolean.java | 1 - .../util/internal/UnterminatableExecutor.java | 1 - .../AbstractSocketClientBootstrapTest.java | 5 +- .../AbstractSocketServerBootstrapTest.java | 5 +- .../bootstrap/BootstrapOrderedMapTest.java | 5 +- .../jboss/netty/bootstrap/BootstrapTest.java | 86 ++++++++++++++++++- .../NioSocketClientBootstrapTest.java | 10 ++- .../NioSocketServerBootstrapTest.java | 10 ++- .../OioSocketClientBootstrapTest.java | 10 ++- .../OioSocketServerBootstrapTest.java | 10 ++- .../buffer/AbstractChannelBufferTest.java | 3 +- .../AbstractCompositeChannelBufferTest.java | 2 +- .../BigEndianCompositeChannelBufferTest.java | 3 +- .../BigEndianDirectChannelBufferTest.java | 3 +- .../BigEndianHeapChannelBufferTest.java | 3 +- ...ByteBufferBackedHeapChannelBufferTest.java | 3 +- .../buffer/ChannelBufferIndexFinderTest.java | 5 +- .../netty/buffer/ChannelBufferStreamTest.java | 5 +- .../netty/buffer/ChannelBuffersTest.java | 5 +- .../buffer/DuplicateChannelBufferTest.java | 3 +- .../buffer/DynamicChannelBufferTest.java | 3 +- ...ittleEndianCompositeChannelBufferTest.java | 3 +- .../LittleEndianDirectChannelBufferTest.java | 3 +- .../LittleEndianHeapChannelBufferTest.java | 5 +- .../buffer/ReadOnlyChannelBufferTest.java | 5 +- .../netty/buffer/SlicedChannelBufferTest.java | 3 +- .../buffer/TruncatedChannelBufferTest.java | 3 +- .../channel/CompleteChannelFutureTest.java | 3 - .../channel/FailedChannelFutureTest.java | 3 - .../channel/StaticChannelPipelineTest.java | 1 - .../channel/SucceededChannelFutureTest.java | 3 - .../socket/AbstractSocketEchoTest.java | 3 - .../NioClientSocketShutdownTimeTest.java | 3 - .../channel/socket/NioNioSocketEchoTest.java | 3 - .../channel/socket/NioOioSocketEchoTest.java | 3 - .../NioServerSocketShutdownTimeTest.java | 3 - .../channel/socket/OioNioSocketEchoTest.java | 3 - .../channel/socket/OioOioSocketEchoTest.java | 3 - ...eptedServerChannelRequestDispatchTest.java | 2 + .../socket/http/FakeChannelConfig.java | 2 + .../channel/socket/http/FakeChannelSink.java | 2 + .../http/FakeClientSocketChannelFactory.java | 2 + .../socket/http/FakeServerSocketChannel.java | 2 + .../http/FakeServerSocketChannelConfig.java | 2 + .../http/FakeServerSocketChannelFactory.java | 2 + .../socket/http/FakeSocketChannel.java | 2 + .../HttpTunnelAcceptedChannelSinkTest.java | 2 + .../HttpTunnelClientChannelConfigTest.java | 2 + .../http/HttpTunnelClientChannelTest.java | 2 + .../http/HttpTunnelClientPollHandlerTest.java | 2 + .../http/HttpTunnelClientSendHandlerTest.java | 2 + .../HttpTunnelServerChannelFactoryTest.java | 2 + .../http/HttpTunnelServerChannelSinkTest.java | 2 + .../http/HttpTunnelServerChannelTest.java | 2 + .../socket/http/HttpTunnelSoakTester.java | 2 + .../channel/socket/http/HttpTunnelTest.java | 2 + .../socket/http/MockChannelStateListener.java | 2 + .../channel/socket/http/NettyTestUtils.java | 2 + .../socket/http/NettyTestUtilsTest.java | 2 + .../socket/http/NullChannelHandler.java | 2 + .../socket/http/SaturationManagerTest.java | 5 ++ .../socket/http/ServerMessageSwitchTest.java | 2 + .../socket/http/UpstreamEventCatcher.java | 2 + .../socket/http/WriteFragmenterTest.java | 2 + .../socket/http/WriteSplitterTest.java | 2 + .../socket/nio/NioDatagramChannelTest.java | 3 +- .../channel/socket/nio/SimpleHandler.java | 8 +- .../netty/channel/socket/nio/UdpClient.java | 38 +++++++- .../codec/bytes/ByteArrayDecoderTest.java | 1 - .../codec/bytes/ByteArrayEncoderTest.java | 1 - .../AbstractSocketFixedLengthEchoTest.java | 3 - .../NioNioSocketFixedLengthEchoTest.java | 3 - .../NioOioSocketFixedLengthEchoTest.java | 3 - .../OioNioSocketFixedLengthEchoTest.java | 3 - .../OioOioSocketFixedLengthEchoTest.java | 3 - .../handler/codec/http/CookieDecoderTest.java | 1 - .../handler/codec/http/CookieEncoderTest.java | 1 - .../codec/http/DefaultHttpMessageTest.java | 1 - .../codec/http/QueryStringDecoderTest.java | 1 - .../ProtobufVarint32FrameDecoderTest.java | 1 - ...tobufVarint32LengthFieldPrependerTest.java | 1 - .../codec/replay/ReplayingDecoderTest.java | 1 - ...tSocketCompatibleObjectStreamEchoTest.java | 3 - .../AbstractSocketObjectStreamEchoTest.java | 3 - ...oSocketCompatibleObjectStreamEchoTest.java | 3 - .../NioNioSocketObjectStreamEchoTest.java | 3 - ...oSocketCompatibleObjectStreamEchoTest.java | 3 - .../NioOioSocketObjectStreamEchoTest.java | 3 - ...oSocketCompatibleObjectStreamEchoTest.java | 3 - .../OioNioSocketObjectStreamEchoTest.java | 3 - ...oSocketCompatibleObjectStreamEchoTest.java | 3 - .../OioOioSocketObjectStreamEchoTest.java | 3 - .../SwitchableInputStreamTest.java | 3 - .../string/AbstractSocketStringEchoTest.java | 3 - .../string/NioNioSocketStringEchoTest.java | 3 - .../string/NioOioSocketStringEchoTest.java | 3 - .../string/OioNioSocketStringEchoTest.java | 3 - .../string/OioOioSocketStringEchoTest.java | 3 - .../ssl/AbstractSocketSslEchoTest.java | 3 - .../handler/ssl/ImmediateExecutorTest.java | 3 - .../handler/ssl/NioNioSocketSslEchoTest.java | 3 - .../handler/ssl/NioOioSocketSslEchoTest.java | 3 - .../handler/ssl/OioNioSocketSslEchoTest.java | 3 - .../handler/ssl/OioOioSocketSslEchoTest.java | 3 - .../logging/CommonsLoggerFactoryTest.java | 3 - .../netty/logging/CommonsLoggerTest.java | 3 - .../logging/InternalLoggerFactoryTest.java | 3 - .../netty/logging/JBossLoggerFactoryTest.java | 3 - .../jboss/netty/logging/JBossLoggerTest.java | 3 - .../netty/logging/JdkLoggerFactoryTest.java | 3 - .../jboss/netty/logging/JdkLoggerTest.java | 3 - .../netty/logging/Log4JLoggerFactoryTest.java | 3 - .../jboss/netty/logging/Log4JLoggerTest.java | 3 - .../netty/logging/Slf4JLoggerFactoryTest.java | 3 - .../jboss/netty/logging/Slf4JLoggerTest.java | 3 - .../org/jboss/netty/util/DebugUtilTest.java | 3 - .../org/jboss/netty/util/DummyHandler.java | 2 - .../jboss/netty/util/MapBackedSetTest.java | 3 - .../java/org/jboss/netty/util/TestUtil.java | 1 - .../util/internal/ConversionUtilTest.java | 3 - .../internal/StackTraceSimplifierTest.java | 3 - .../netty/util/internal/StringUtilTest.java | 2 - 533 files changed, 243 insertions(+), 984 deletions(-) diff --git a/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java b/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java index 33d8380e87..ef7644cd03 100644 --- a/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/Bootstrap.java @@ -43,8 +43,6 @@ import org.jboss.netty.util.ExternalResourceReleasable; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.uses org.jboss.netty.channel.ChannelFactory */ public class Bootstrap implements ExternalResourceReleasable { diff --git a/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java index 7656230f78..a9e7cdbd0e 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ClientBootstrap.java @@ -106,8 +106,6 @@ import org.jboss.netty.channel.Channels; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class ClientBootstrap extends Bootstrap { diff --git a/src/main/java/org/jboss/netty/bootstrap/ConnectionlessBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ConnectionlessBootstrap.java index 094fc68142..421c882edd 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ConnectionlessBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ConnectionlessBootstrap.java @@ -115,8 +115,6 @@ import org.jboss.netty.channel.Channels; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class ConnectionlessBootstrap extends Bootstrap { diff --git a/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java b/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java index e4a4feb1d1..d784ad3986 100644 --- a/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java +++ b/src/main/java/org/jboss/netty/bootstrap/ServerBootstrap.java @@ -156,8 +156,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class ServerBootstrap extends Bootstrap { diff --git a/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java index 7e213513be..874d305159 100644 --- a/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/AbstractChannelBuffer.java @@ -29,8 +29,6 @@ import java.nio.charset.Charset; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public abstract class AbstractChannelBuffer implements ChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/AbstractChannelBufferFactory.java b/src/main/java/org/jboss/netty/buffer/AbstractChannelBufferFactory.java index 29ec759dcd..1bfcf1833b 100644 --- a/src/main/java/org/jboss/netty/buffer/AbstractChannelBufferFactory.java +++ b/src/main/java/org/jboss/netty/buffer/AbstractChannelBufferFactory.java @@ -22,8 +22,6 @@ import java.nio.ByteOrder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public abstract class AbstractChannelBufferFactory implements ChannelBufferFactory { diff --git a/src/main/java/org/jboss/netty/buffer/BigEndianHeapChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/BigEndianHeapChannelBuffer.java index aac2bb0c10..b4be739fb8 100644 --- a/src/main/java/org/jboss/netty/buffer/BigEndianHeapChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/BigEndianHeapChannelBuffer.java @@ -25,8 +25,6 @@ import java.nio.ByteOrder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/ByteBufferBackedChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/ByteBufferBackedChannelBuffer.java index afdcd13ec0..29c7d27538 100644 --- a/src/main/java/org/jboss/netty/buffer/ByteBufferBackedChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/ByteBufferBackedChannelBuffer.java @@ -31,9 +31,6 @@ import java.nio.channels.ScatteringByteChannel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java index 9482bad8ff..fa6ff19f8c 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBuffer.java @@ -232,8 +232,6 @@ import java.nio.charset.UnsupportedCharsetException; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public interface ChannelBuffer extends Comparable { diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBufferFactory.java b/src/main/java/org/jboss/netty/buffer/ChannelBufferFactory.java index 77462dc6ee..e5ed6c4c2d 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBufferFactory.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBufferFactory.java @@ -23,7 +23,6 @@ import java.nio.ByteOrder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface ChannelBufferFactory { diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBufferIndexFinder.java b/src/main/java/org/jboss/netty/buffer/ChannelBufferIndexFinder.java index 35c478aeb8..1fa9e8e901 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBufferIndexFinder.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBufferIndexFinder.java @@ -28,8 +28,6 @@ package org.jboss.netty.buffer; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.uses org.jboss.netty.buffer.ChannelBuffer */ public interface ChannelBufferIndexFinder { diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBufferInputStream.java b/src/main/java/org/jboss/netty/buffer/ChannelBufferInputStream.java index a040a97f0c..49031da4ce 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBufferInputStream.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBufferInputStream.java @@ -35,8 +35,6 @@ import java.io.InputStream; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @see ChannelBufferOutputStream * @apiviz.uses org.jboss.netty.buffer.ChannelBuffer */ diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBufferOutputStream.java b/src/main/java/org/jboss/netty/buffer/ChannelBufferOutputStream.java index 776e826bf5..1486f3ca31 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBufferOutputStream.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBufferOutputStream.java @@ -34,8 +34,6 @@ import java.io.OutputStream; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @see ChannelBufferInputStream * @apiviz.uses org.jboss.netty.buffer.ChannelBuffer */ diff --git a/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java b/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java index 673e1b3fbd..51e96142a4 100644 --- a/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java +++ b/src/main/java/org/jboss/netty/buffer/ChannelBuffers.java @@ -85,8 +85,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.has org.jboss.netty.buffer.ChannelBuffer oneway - - creates */ diff --git a/src/main/java/org/jboss/netty/buffer/CompositeChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/CompositeChannelBuffer.java index 6beb5b72be..f4f425b45d 100644 --- a/src/main/java/org/jboss/netty/buffer/CompositeChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/CompositeChannelBuffer.java @@ -35,9 +35,6 @@ import java.util.List; * @author The Netty Project * @author Trustin Lee * @author Frederic Bregier (fredbregier@free.fr) - * - * @version $Rev$, $Date$ - * */ public class CompositeChannelBuffer extends AbstractChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/DirectChannelBufferFactory.java b/src/main/java/org/jboss/netty/buffer/DirectChannelBufferFactory.java index e518f48c1f..f77d9aa5c5 100644 --- a/src/main/java/org/jboss/netty/buffer/DirectChannelBufferFactory.java +++ b/src/main/java/org/jboss/netty/buffer/DirectChannelBufferFactory.java @@ -32,7 +32,6 @@ import java.nio.ByteOrder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DirectChannelBufferFactory extends AbstractChannelBufferFactory { diff --git a/src/main/java/org/jboss/netty/buffer/DuplicatedChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/DuplicatedChannelBuffer.java index a7d24d8c3e..2713a1c5f8 100644 --- a/src/main/java/org/jboss/netty/buffer/DuplicatedChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/DuplicatedChannelBuffer.java @@ -31,9 +31,6 @@ import java.nio.channels.ScatteringByteChannel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DuplicatedChannelBuffer extends AbstractChannelBuffer implements WrappedChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java index 5942d22b9a..713ec01f8a 100644 --- a/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/DynamicChannelBuffer.java @@ -31,9 +31,6 @@ import java.nio.channels.ScatteringByteChannel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DynamicChannelBuffer extends AbstractChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/HeapChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/HeapChannelBuffer.java index f8d51d5b89..f73c0acab1 100644 --- a/src/main/java/org/jboss/netty/buffer/HeapChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/HeapChannelBuffer.java @@ -28,8 +28,6 @@ import java.nio.channels.ScatteringByteChannel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public abstract class HeapChannelBuffer extends AbstractChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/HeapChannelBufferFactory.java b/src/main/java/org/jboss/netty/buffer/HeapChannelBufferFactory.java index 7296f8b943..5ea10ec3e4 100644 --- a/src/main/java/org/jboss/netty/buffer/HeapChannelBufferFactory.java +++ b/src/main/java/org/jboss/netty/buffer/HeapChannelBufferFactory.java @@ -26,7 +26,6 @@ import java.nio.ByteOrder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HeapChannelBufferFactory extends AbstractChannelBufferFactory { diff --git a/src/main/java/org/jboss/netty/buffer/LittleEndianHeapChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/LittleEndianHeapChannelBuffer.java index 08727694a5..4adc3098e8 100644 --- a/src/main/java/org/jboss/netty/buffer/LittleEndianHeapChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/LittleEndianHeapChannelBuffer.java @@ -25,8 +25,6 @@ import java.nio.ByteOrder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class LittleEndianHeapChannelBuffer extends HeapChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/ReadOnlyChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/ReadOnlyChannelBuffer.java index c4556c9803..c88ed8152d 100644 --- a/src/main/java/org/jboss/netty/buffer/ReadOnlyChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/ReadOnlyChannelBuffer.java @@ -31,9 +31,6 @@ import java.nio.channels.ScatteringByteChannel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ReadOnlyChannelBuffer extends AbstractChannelBuffer implements WrappedChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/SlicedChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/SlicedChannelBuffer.java index d91982b248..88778a352c 100644 --- a/src/main/java/org/jboss/netty/buffer/SlicedChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/SlicedChannelBuffer.java @@ -32,9 +32,6 @@ import java.nio.channels.ScatteringByteChannel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class SlicedChannelBuffer extends AbstractChannelBuffer implements WrappedChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/TruncatedChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/TruncatedChannelBuffer.java index 27fccb43d6..410790dde1 100644 --- a/src/main/java/org/jboss/netty/buffer/TruncatedChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/TruncatedChannelBuffer.java @@ -32,9 +32,6 @@ import java.nio.channels.ScatteringByteChannel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class TruncatedChannelBuffer extends AbstractChannelBuffer implements WrappedChannelBuffer { diff --git a/src/main/java/org/jboss/netty/buffer/WrappedChannelBuffer.java b/src/main/java/org/jboss/netty/buffer/WrappedChannelBuffer.java index 412a97279e..dc9acb3eeb 100644 --- a/src/main/java/org/jboss/netty/buffer/WrappedChannelBuffer.java +++ b/src/main/java/org/jboss/netty/buffer/WrappedChannelBuffer.java @@ -21,9 +21,6 @@ package org.jboss.netty.buffer; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public interface WrappedChannelBuffer extends ChannelBuffer { /** diff --git a/src/main/java/org/jboss/netty/channel/AbstractChannel.java b/src/main/java/org/jboss/netty/channel/AbstractChannel.java index 6dcc128a92..862884df3c 100644 --- a/src/main/java/org/jboss/netty/channel/AbstractChannel.java +++ b/src/main/java/org/jboss/netty/channel/AbstractChannel.java @@ -26,8 +26,6 @@ import org.jboss.netty.util.internal.ConcurrentHashMap; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * */ public abstract class AbstractChannel implements Channel { diff --git a/src/main/java/org/jboss/netty/channel/AbstractChannelSink.java b/src/main/java/org/jboss/netty/channel/AbstractChannelSink.java index 2ff487379a..8d972167d9 100644 --- a/src/main/java/org/jboss/netty/channel/AbstractChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/AbstractChannelSink.java @@ -22,8 +22,6 @@ import static org.jboss.netty.channel.Channels.*; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public abstract class AbstractChannelSink implements ChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/AbstractServerChannel.java b/src/main/java/org/jboss/netty/channel/AbstractServerChannel.java index bc9a7e0c15..1df129fceb 100644 --- a/src/main/java/org/jboss/netty/channel/AbstractServerChannel.java +++ b/src/main/java/org/jboss/netty/channel/AbstractServerChannel.java @@ -32,9 +32,6 @@ import java.net.SocketAddress; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractServerChannel extends AbstractChannel implements ServerChannel { diff --git a/src/main/java/org/jboss/netty/channel/AdaptiveReceiveBufferSizePredictor.java b/src/main/java/org/jboss/netty/channel/AdaptiveReceiveBufferSizePredictor.java index 140e6351f6..119a102ee7 100644 --- a/src/main/java/org/jboss/netty/channel/AdaptiveReceiveBufferSizePredictor.java +++ b/src/main/java/org/jboss/netty/channel/AdaptiveReceiveBufferSizePredictor.java @@ -30,9 +30,6 @@ import java.util.List; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class AdaptiveReceiveBufferSizePredictor implements ReceiveBufferSizePredictor { diff --git a/src/main/java/org/jboss/netty/channel/AdaptiveReceiveBufferSizePredictorFactory.java b/src/main/java/org/jboss/netty/channel/AdaptiveReceiveBufferSizePredictorFactory.java index 053a36139c..e3d573465f 100644 --- a/src/main/java/org/jboss/netty/channel/AdaptiveReceiveBufferSizePredictorFactory.java +++ b/src/main/java/org/jboss/netty/channel/AdaptiveReceiveBufferSizePredictorFactory.java @@ -22,8 +22,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class AdaptiveReceiveBufferSizePredictorFactory implements ReceiveBufferSizePredictorFactory { diff --git a/src/main/java/org/jboss/netty/channel/Channel.java b/src/main/java/org/jboss/netty/channel/Channel.java index 6925c18156..c0e6e51597 100644 --- a/src/main/java/org/jboss/netty/channel/Channel.java +++ b/src/main/java/org/jboss/netty/channel/Channel.java @@ -103,8 +103,6 @@ import org.jboss.netty.channel.socket.nio.NioSocketChannelConfig; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.composedOf org.jboss.netty.channel.ChannelConfig * @apiviz.composedOf org.jboss.netty.channel.ChannelPipeline diff --git a/src/main/java/org/jboss/netty/channel/ChannelConfig.java b/src/main/java/org/jboss/netty/channel/ChannelConfig.java index ced56cc03d..4237f61646 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/ChannelConfig.java @@ -63,8 +63,6 @@ import org.jboss.netty.channel.socket.nio.NioSocketChannelConfig; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.channel.ChannelPipelineFactory * @apiviz.composedOf org.jboss.netty.channel.ReceiveBufferSizePredictor * diff --git a/src/main/java/org/jboss/netty/channel/ChannelDownstreamHandler.java b/src/main/java/org/jboss/netty/channel/ChannelDownstreamHandler.java index 9b32984e8e..877dd0d60d 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelDownstreamHandler.java +++ b/src/main/java/org/jboss/netty/channel/ChannelDownstreamHandler.java @@ -71,8 +71,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.exclude ^org\.jboss\.netty\.handler\..*$ */ public interface ChannelDownstreamHandler extends ChannelHandler { diff --git a/src/main/java/org/jboss/netty/channel/ChannelEvent.java b/src/main/java/org/jboss/netty/channel/ChannelEvent.java index 2ab0b0b851..d16e091dbd 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelEvent.java +++ b/src/main/java/org/jboss/netty/channel/ChannelEvent.java @@ -181,8 +181,6 @@ import org.jboss.netty.channel.socket.ServerSocketChannel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.composedOf org.jboss.netty.channel.ChannelFuture */ diff --git a/src/main/java/org/jboss/netty/channel/ChannelException.java b/src/main/java/org/jboss/netty/channel/ChannelException.java index 1ad66dc68f..a9d30d7a21 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelException.java +++ b/src/main/java/org/jboss/netty/channel/ChannelException.java @@ -21,8 +21,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.hidden */ public class ChannelException extends RuntimeException { diff --git a/src/main/java/org/jboss/netty/channel/ChannelFactory.java b/src/main/java/org/jboss/netty/channel/ChannelFactory.java index bc4a0db737..e9492d36fc 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/ChannelFactory.java @@ -50,8 +50,6 @@ import org.jboss.netty.util.ExternalResourceReleasable; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.has org.jboss.netty.channel.Channel oneway - - creates * diff --git a/src/main/java/org/jboss/netty/channel/ChannelFuture.java b/src/main/java/org/jboss/netty/channel/ChannelFuture.java index 79d993d4e2..b326c5be61 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelFuture.java +++ b/src/main/java/org/jboss/netty/channel/ChannelFuture.java @@ -167,8 +167,6 @@ import org.jboss.netty.handler.execution.ExecutionHandler; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.owns org.jboss.netty.channel.ChannelFutureListener - - notifies */ diff --git a/src/main/java/org/jboss/netty/channel/ChannelFutureListener.java b/src/main/java/org/jboss/netty/channel/ChannelFutureListener.java index 55d2379882..cc2fc73916 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelFutureListener.java +++ b/src/main/java/org/jboss/netty/channel/ChannelFutureListener.java @@ -32,8 +32,6 @@ import java.util.EventListener; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface ChannelFutureListener extends EventListener { diff --git a/src/main/java/org/jboss/netty/channel/ChannelFutureProgressListener.java b/src/main/java/org/jboss/netty/channel/ChannelFutureProgressListener.java index 5082cfa058..cb142ce4f6 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelFutureProgressListener.java +++ b/src/main/java/org/jboss/netty/channel/ChannelFutureProgressListener.java @@ -38,8 +38,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $ */ public interface ChannelFutureProgressListener extends ChannelFutureListener { diff --git a/src/main/java/org/jboss/netty/channel/ChannelHandler.java b/src/main/java/org/jboss/netty/channel/ChannelHandler.java index 9c17a23ad7..4dd5b32bf7 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelHandler.java +++ b/src/main/java/org/jboss/netty/channel/ChannelHandler.java @@ -206,8 +206,6 @@ import org.jboss.netty.channel.group.ChannelGroup; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.exclude ^org\.jboss\.netty\.handler\..*$ */ @@ -227,7 +225,6 @@ public interface ChannelHandler { * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ @Inherited @Documented diff --git a/src/main/java/org/jboss/netty/channel/ChannelHandlerContext.java b/src/main/java/org/jboss/netty/channel/ChannelHandlerContext.java index b269d33cfa..148593a1d9 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelHandlerContext.java +++ b/src/main/java/org/jboss/netty/channel/ChannelHandlerContext.java @@ -120,8 +120,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.owns org.jboss.netty.channel.ChannelHandler */ public interface ChannelHandlerContext { diff --git a/src/main/java/org/jboss/netty/channel/ChannelHandlerLifeCycleException.java b/src/main/java/org/jboss/netty/channel/ChannelHandlerLifeCycleException.java index a94017b2dc..dd9f2e05d8 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelHandlerLifeCycleException.java +++ b/src/main/java/org/jboss/netty/channel/ChannelHandlerLifeCycleException.java @@ -23,8 +23,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.hidden */ public class ChannelHandlerLifeCycleException extends RuntimeException { diff --git a/src/main/java/org/jboss/netty/channel/ChannelLocal.java b/src/main/java/org/jboss/netty/channel/ChannelLocal.java index cbba433044..928d4fcdf3 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelLocal.java +++ b/src/main/java/org/jboss/netty/channel/ChannelLocal.java @@ -31,7 +31,6 @@ import org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.stereotype utility */ diff --git a/src/main/java/org/jboss/netty/channel/ChannelPipeline.java b/src/main/java/org/jboss/netty/channel/ChannelPipeline.java index fa1eda1988..d87b1e3b74 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/ChannelPipeline.java @@ -204,8 +204,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.composedOf org.jboss.netty.channel.ChannelHandlerContext * @apiviz.owns org.jboss.netty.channel.ChannelHandler diff --git a/src/main/java/org/jboss/netty/channel/ChannelPipelineException.java b/src/main/java/org/jboss/netty/channel/ChannelPipelineException.java index 4750298132..cd21bb30db 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelPipelineException.java +++ b/src/main/java/org/jboss/netty/channel/ChannelPipelineException.java @@ -23,8 +23,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.hidden */ public class ChannelPipelineException extends ChannelException { diff --git a/src/main/java/org/jboss/netty/channel/ChannelPipelineFactory.java b/src/main/java/org/jboss/netty/channel/ChannelPipelineFactory.java index 6317782624..d5e0e9cbdf 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelPipelineFactory.java +++ b/src/main/java/org/jboss/netty/channel/ChannelPipelineFactory.java @@ -35,8 +35,6 @@ import org.jboss.netty.bootstrap.ConnectionlessBootstrap; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.channel.ChannelPipeline oneway - - creates */ public interface ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/channel/ChannelSink.java b/src/main/java/org/jboss/netty/channel/ChannelSink.java index d1799e5ac5..4f0918abfc 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/ChannelSink.java @@ -26,8 +26,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.uses org.jboss.netty.channel.ChannelPipeline - - sends events upstream */ public interface ChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/ChannelState.java b/src/main/java/org/jboss/netty/channel/ChannelState.java index 44f01939c5..d4a14d2ef6 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelState.java +++ b/src/main/java/org/jboss/netty/channel/ChannelState.java @@ -76,8 +76,6 @@ import java.net.SocketAddress; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public enum ChannelState { /** diff --git a/src/main/java/org/jboss/netty/channel/ChannelStateEvent.java b/src/main/java/org/jboss/netty/channel/ChannelStateEvent.java index 906206f1c5..2a80b911ee 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelStateEvent.java +++ b/src/main/java/org/jboss/netty/channel/ChannelStateEvent.java @@ -27,8 +27,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.channel.ChannelState */ public interface ChannelStateEvent extends ChannelEvent { diff --git a/src/main/java/org/jboss/netty/channel/ChannelUpstreamHandler.java b/src/main/java/org/jboss/netty/channel/ChannelUpstreamHandler.java index e8d7d32431..87f4376df3 100644 --- a/src/main/java/org/jboss/netty/channel/ChannelUpstreamHandler.java +++ b/src/main/java/org/jboss/netty/channel/ChannelUpstreamHandler.java @@ -87,8 +87,6 @@ import org.jboss.netty.handler.execution.ExecutionHandler; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.exclude ^org\.jboss\.netty\.handler\..*$ */ public interface ChannelUpstreamHandler extends ChannelHandler { diff --git a/src/main/java/org/jboss/netty/channel/Channels.java b/src/main/java/org/jboss/netty/channel/Channels.java index a537b2c2c9..31ea56c374 100644 --- a/src/main/java/org/jboss/netty/channel/Channels.java +++ b/src/main/java/org/jboss/netty/channel/Channels.java @@ -50,8 +50,6 @@ import org.jboss.netty.util.internal.ConversionUtil; * @author Trustin Lee * * @apiviz.landmark - * - * @version $Rev$, $Date$ */ public class Channels { diff --git a/src/main/java/org/jboss/netty/channel/ChildChannelStateEvent.java b/src/main/java/org/jboss/netty/channel/ChildChannelStateEvent.java index 07772cc8d3..1b90150e65 100644 --- a/src/main/java/org/jboss/netty/channel/ChildChannelStateEvent.java +++ b/src/main/java/org/jboss/netty/channel/ChildChannelStateEvent.java @@ -23,8 +23,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface ChildChannelStateEvent extends ChannelEvent { diff --git a/src/main/java/org/jboss/netty/channel/CompleteChannelFuture.java b/src/main/java/org/jboss/netty/channel/CompleteChannelFuture.java index c063be9230..7d580ebf14 100644 --- a/src/main/java/org/jboss/netty/channel/CompleteChannelFuture.java +++ b/src/main/java/org/jboss/netty/channel/CompleteChannelFuture.java @@ -26,8 +26,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public abstract class CompleteChannelFuture implements ChannelFuture { diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelConfig.java b/src/main/java/org/jboss/netty/channel/DefaultChannelConfig.java index 266d052644..05533468de 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelConfig.java @@ -28,9 +28,6 @@ import org.jboss.netty.util.internal.ConversionUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DefaultChannelConfig implements ChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelFuture.java b/src/main/java/org/jboss/netty/channel/DefaultChannelFuture.java index 9d80a09388..9bae244483 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelFuture.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelFuture.java @@ -34,8 +34,6 @@ import org.jboss.netty.util.internal.DeadLockProofWorker; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DefaultChannelFuture implements ChannelFuture { diff --git a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java index 16529ea47b..6a74051839 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChannelPipeline.java @@ -32,9 +32,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DefaultChannelPipeline implements ChannelPipeline { diff --git a/src/main/java/org/jboss/netty/channel/DefaultChildChannelStateEvent.java b/src/main/java/org/jboss/netty/channel/DefaultChildChannelStateEvent.java index aa2e166003..ea6749e30e 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultChildChannelStateEvent.java +++ b/src/main/java/org/jboss/netty/channel/DefaultChildChannelStateEvent.java @@ -22,9 +22,6 @@ import static org.jboss.netty.channel.Channels.*; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DefaultChildChannelStateEvent implements ChildChannelStateEvent { diff --git a/src/main/java/org/jboss/netty/channel/DefaultExceptionEvent.java b/src/main/java/org/jboss/netty/channel/DefaultExceptionEvent.java index aa93c9a48e..003d84c443 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultExceptionEvent.java +++ b/src/main/java/org/jboss/netty/channel/DefaultExceptionEvent.java @@ -24,9 +24,6 @@ import org.jboss.netty.util.internal.StackTraceSimplifier; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DefaultExceptionEvent implements ExceptionEvent { diff --git a/src/main/java/org/jboss/netty/channel/DefaultServerChannelConfig.java b/src/main/java/org/jboss/netty/channel/DefaultServerChannelConfig.java index 21478afbe1..e7b6b140dc 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultServerChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/DefaultServerChannelConfig.java @@ -27,8 +27,6 @@ import org.jboss.netty.channel.socket.ServerSocketChannelConfig; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DefaultServerChannelConfig implements ChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/DefaultWriteCompletionEvent.java b/src/main/java/org/jboss/netty/channel/DefaultWriteCompletionEvent.java index 0809da673d..b9700b05ac 100644 --- a/src/main/java/org/jboss/netty/channel/DefaultWriteCompletionEvent.java +++ b/src/main/java/org/jboss/netty/channel/DefaultWriteCompletionEvent.java @@ -22,8 +22,6 @@ import static org.jboss.netty.channel.Channels.*; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DefaultWriteCompletionEvent implements WriteCompletionEvent { diff --git a/src/main/java/org/jboss/netty/channel/DownstreamChannelStateEvent.java b/src/main/java/org/jboss/netty/channel/DownstreamChannelStateEvent.java index 76683b9b19..6485b93372 100644 --- a/src/main/java/org/jboss/netty/channel/DownstreamChannelStateEvent.java +++ b/src/main/java/org/jboss/netty/channel/DownstreamChannelStateEvent.java @@ -20,9 +20,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DownstreamChannelStateEvent implements ChannelStateEvent { diff --git a/src/main/java/org/jboss/netty/channel/DownstreamMessageEvent.java b/src/main/java/org/jboss/netty/channel/DownstreamMessageEvent.java index a46cb441ff..9badd152b7 100644 --- a/src/main/java/org/jboss/netty/channel/DownstreamMessageEvent.java +++ b/src/main/java/org/jboss/netty/channel/DownstreamMessageEvent.java @@ -24,9 +24,6 @@ import org.jboss.netty.util.internal.StringUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DownstreamMessageEvent implements MessageEvent { diff --git a/src/main/java/org/jboss/netty/channel/ExceptionEvent.java b/src/main/java/org/jboss/netty/channel/ExceptionEvent.java index 230d6fde33..1df615e9aa 100644 --- a/src/main/java/org/jboss/netty/channel/ExceptionEvent.java +++ b/src/main/java/org/jboss/netty/channel/ExceptionEvent.java @@ -24,8 +24,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface ExceptionEvent extends ChannelEvent { diff --git a/src/main/java/org/jboss/netty/channel/FailedChannelFuture.java b/src/main/java/org/jboss/netty/channel/FailedChannelFuture.java index 1482d44598..de438918c3 100644 --- a/src/main/java/org/jboss/netty/channel/FailedChannelFuture.java +++ b/src/main/java/org/jboss/netty/channel/FailedChannelFuture.java @@ -22,8 +22,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class FailedChannelFuture extends CompleteChannelFuture { diff --git a/src/main/java/org/jboss/netty/channel/FileRegion.java b/src/main/java/org/jboss/netty/channel/FileRegion.java index 0780fb7a0d..fef19021a9 100644 --- a/src/main/java/org/jboss/netty/channel/FileRegion.java +++ b/src/main/java/org/jboss/netty/channel/FileRegion.java @@ -56,7 +56,6 @@ import org.jboss.netty.util.ExternalResourceReleasable; * * @author The Netty Project * @author Trustin Lee - * @version $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $ */ public interface FileRegion extends ExternalResourceReleasable { @@ -90,4 +89,4 @@ public interface FileRegion extends ExternalResourceReleasable { * byte of the region transferred. */ long transferTo(WritableByteChannel target, long position) throws IOException; -} \ No newline at end of file +} diff --git a/src/main/java/org/jboss/netty/channel/FixedReceiveBufferSizePredictor.java b/src/main/java/org/jboss/netty/channel/FixedReceiveBufferSizePredictor.java index 2b04200df2..138c44d444 100644 --- a/src/main/java/org/jboss/netty/channel/FixedReceiveBufferSizePredictor.java +++ b/src/main/java/org/jboss/netty/channel/FixedReceiveBufferSizePredictor.java @@ -22,8 +22,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class FixedReceiveBufferSizePredictor implements ReceiveBufferSizePredictor { diff --git a/src/main/java/org/jboss/netty/channel/FixedReceiveBufferSizePredictorFactory.java b/src/main/java/org/jboss/netty/channel/FixedReceiveBufferSizePredictorFactory.java index 5658d68999..559f329c34 100644 --- a/src/main/java/org/jboss/netty/channel/FixedReceiveBufferSizePredictorFactory.java +++ b/src/main/java/org/jboss/netty/channel/FixedReceiveBufferSizePredictorFactory.java @@ -22,8 +22,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class FixedReceiveBufferSizePredictorFactory implements ReceiveBufferSizePredictorFactory { diff --git a/src/main/java/org/jboss/netty/channel/LifeCycleAwareChannelHandler.java b/src/main/java/org/jboss/netty/channel/LifeCycleAwareChannelHandler.java index 2ad34c4f46..61b337602c 100644 --- a/src/main/java/org/jboss/netty/channel/LifeCycleAwareChannelHandler.java +++ b/src/main/java/org/jboss/netty/channel/LifeCycleAwareChannelHandler.java @@ -30,7 +30,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface LifeCycleAwareChannelHandler extends ChannelHandler { void beforeAdd(ChannelHandlerContext ctx) throws Exception; diff --git a/src/main/java/org/jboss/netty/channel/MessageEvent.java b/src/main/java/org/jboss/netty/channel/MessageEvent.java index d530096b49..37ca4efcc1 100644 --- a/src/main/java/org/jboss/netty/channel/MessageEvent.java +++ b/src/main/java/org/jboss/netty/channel/MessageEvent.java @@ -27,8 +27,6 @@ import java.net.SocketAddress; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface MessageEvent extends ChannelEvent { diff --git a/src/main/java/org/jboss/netty/channel/ReceiveBufferSizePredictor.java b/src/main/java/org/jboss/netty/channel/ReceiveBufferSizePredictor.java index 578bd2585d..2997c168d2 100644 --- a/src/main/java/org/jboss/netty/channel/ReceiveBufferSizePredictor.java +++ b/src/main/java/org/jboss/netty/channel/ReceiveBufferSizePredictor.java @@ -32,9 +32,6 @@ import org.jboss.netty.buffer.ChannelBuffer; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public interface ReceiveBufferSizePredictor { diff --git a/src/main/java/org/jboss/netty/channel/ReceiveBufferSizePredictorFactory.java b/src/main/java/org/jboss/netty/channel/ReceiveBufferSizePredictorFactory.java index e3e76d8520..c1e209fb93 100644 --- a/src/main/java/org/jboss/netty/channel/ReceiveBufferSizePredictorFactory.java +++ b/src/main/java/org/jboss/netty/channel/ReceiveBufferSizePredictorFactory.java @@ -21,8 +21,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.channel.ReceiveBufferSizePredictor oneway - - creates */ public interface ReceiveBufferSizePredictorFactory { diff --git a/src/main/java/org/jboss/netty/channel/ServerChannel.java b/src/main/java/org/jboss/netty/channel/ServerChannel.java index ed333b6c71..a59d9678f1 100644 --- a/src/main/java/org/jboss/netty/channel/ServerChannel.java +++ b/src/main/java/org/jboss/netty/channel/ServerChannel.java @@ -24,7 +24,6 @@ import org.jboss.netty.channel.socket.ServerSocketChannel; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface ServerChannel extends Channel { // This is a tag interface. diff --git a/src/main/java/org/jboss/netty/channel/ServerChannelFactory.java b/src/main/java/org/jboss/netty/channel/ServerChannelFactory.java index bc80e76fcc..e61a1cfaa6 100644 --- a/src/main/java/org/jboss/netty/channel/ServerChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/ServerChannelFactory.java @@ -21,8 +21,6 @@ package org.jboss.netty.channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.channel.ServerChannel oneway - - creates */ public interface ServerChannelFactory extends ChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java index 56ec90cda2..4b9f95b245 100644 --- a/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java +++ b/src/main/java/org/jboss/netty/channel/SimpleChannelDownstreamHandler.java @@ -52,8 +52,6 @@ import java.net.SocketAddress; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SimpleChannelDownstreamHandler implements ChannelDownstreamHandler { diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java index a269780604..08b0ed66ca 100644 --- a/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java +++ b/src/main/java/org/jboss/netty/channel/SimpleChannelHandler.java @@ -73,8 +73,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SimpleChannelHandler implements ChannelUpstreamHandler, ChannelDownstreamHandler { diff --git a/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java b/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java index fe061e3fa8..160581e90a 100644 --- a/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java +++ b/src/main/java/org/jboss/netty/channel/SimpleChannelUpstreamHandler.java @@ -53,8 +53,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SimpleChannelUpstreamHandler implements ChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/channel/StaticChannelPipeline.java b/src/main/java/org/jboss/netty/channel/StaticChannelPipeline.java index 5f76d99bea..071b24eb3a 100644 --- a/src/main/java/org/jboss/netty/channel/StaticChannelPipeline.java +++ b/src/main/java/org/jboss/netty/channel/StaticChannelPipeline.java @@ -33,9 +33,6 @@ import org.jboss.netty.util.internal.ConversionUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class StaticChannelPipeline implements ChannelPipeline { diff --git a/src/main/java/org/jboss/netty/channel/SucceededChannelFuture.java b/src/main/java/org/jboss/netty/channel/SucceededChannelFuture.java index 8c60702489..d3605df9f4 100644 --- a/src/main/java/org/jboss/netty/channel/SucceededChannelFuture.java +++ b/src/main/java/org/jboss/netty/channel/SucceededChannelFuture.java @@ -22,8 +22,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SucceededChannelFuture extends CompleteChannelFuture { diff --git a/src/main/java/org/jboss/netty/channel/UpstreamChannelStateEvent.java b/src/main/java/org/jboss/netty/channel/UpstreamChannelStateEvent.java index cef3eeccc5..e52c2894b7 100644 --- a/src/main/java/org/jboss/netty/channel/UpstreamChannelStateEvent.java +++ b/src/main/java/org/jboss/netty/channel/UpstreamChannelStateEvent.java @@ -22,9 +22,6 @@ import static org.jboss.netty.channel.Channels.*; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class UpstreamChannelStateEvent implements ChannelStateEvent { diff --git a/src/main/java/org/jboss/netty/channel/UpstreamMessageEvent.java b/src/main/java/org/jboss/netty/channel/UpstreamMessageEvent.java index d588828b7d..3531f7c043 100644 --- a/src/main/java/org/jboss/netty/channel/UpstreamMessageEvent.java +++ b/src/main/java/org/jboss/netty/channel/UpstreamMessageEvent.java @@ -26,9 +26,6 @@ import org.jboss.netty.util.internal.StringUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class UpstreamMessageEvent implements MessageEvent { diff --git a/src/main/java/org/jboss/netty/channel/WriteCompletionEvent.java b/src/main/java/org/jboss/netty/channel/WriteCompletionEvent.java index 6a80d54d5f..f25a27c64a 100644 --- a/src/main/java/org/jboss/netty/channel/WriteCompletionEvent.java +++ b/src/main/java/org/jboss/netty/channel/WriteCompletionEvent.java @@ -24,8 +24,6 @@ package org.jboss.netty.channel; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface WriteCompletionEvent extends ChannelEvent { /** diff --git a/src/main/java/org/jboss/netty/channel/group/ChannelGroup.java b/src/main/java/org/jboss/netty/channel/group/ChannelGroup.java index 7a33a7d5a3..7577c2c297 100644 --- a/src/main/java/org/jboss/netty/channel/group/ChannelGroup.java +++ b/src/main/java/org/jboss/netty/channel/group/ChannelGroup.java @@ -90,7 +90,6 @@ import org.jboss.netty.util.CharsetUtil; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.has org.jboss.netty.channel.group.ChannelGroupFuture oneway - - returns diff --git a/src/main/java/org/jboss/netty/channel/group/ChannelGroupFuture.java b/src/main/java/org/jboss/netty/channel/group/ChannelGroupFuture.java index 9237290d5d..b73aaee994 100644 --- a/src/main/java/org/jboss/netty/channel/group/ChannelGroupFuture.java +++ b/src/main/java/org/jboss/netty/channel/group/ChannelGroupFuture.java @@ -110,7 +110,6 @@ import org.jboss.netty.handler.execution.ExecutionHandler; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.owns org.jboss.netty.channel.group.ChannelGroupFutureListener - - notifies */ diff --git a/src/main/java/org/jboss/netty/channel/group/ChannelGroupFutureListener.java b/src/main/java/org/jboss/netty/channel/group/ChannelGroupFutureListener.java index 6318f9d581..dfd73c7aa3 100644 --- a/src/main/java/org/jboss/netty/channel/group/ChannelGroupFutureListener.java +++ b/src/main/java/org/jboss/netty/channel/group/ChannelGroupFutureListener.java @@ -25,8 +25,6 @@ import java.util.EventListener; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface ChannelGroupFutureListener extends EventListener { diff --git a/src/main/java/org/jboss/netty/channel/group/CombinedIterator.java b/src/main/java/org/jboss/netty/channel/group/CombinedIterator.java index 0feb943ecf..9a93febf56 100644 --- a/src/main/java/org/jboss/netty/channel/group/CombinedIterator.java +++ b/src/main/java/org/jboss/netty/channel/group/CombinedIterator.java @@ -21,7 +21,6 @@ import java.util.NoSuchElementException; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ final class CombinedIterator implements Iterator { diff --git a/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroup.java b/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroup.java index 115f141936..e648a25215 100644 --- a/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroup.java +++ b/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroup.java @@ -37,7 +37,6 @@ import org.jboss.netty.util.internal.ConcurrentHashMap; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroupFuture.java b/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroupFuture.java index 124783646a..f965de26ce 100644 --- a/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroupFuture.java +++ b/src/main/java/org/jboss/netty/channel/group/DefaultChannelGroupFuture.java @@ -38,8 +38,6 @@ import org.jboss.netty.util.internal.DeadLockProofWorker; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DefaultChannelGroupFuture implements ChannelGroupFuture { diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java index 2e941fba8d..81c6355668 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java @@ -39,7 +39,6 @@ import org.jboss.netty.util.internal.ThreadLocalBoolean; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ final class DefaultLocalChannel extends AbstractChannel implements LocalChannel { diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalClientChannelFactory.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalClientChannelFactory.java index aebf823ad1..091cca8436 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalClientChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalClientChannelFactory.java @@ -24,7 +24,6 @@ import org.jboss.netty.channel.ChannelSink; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannel.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannel.java index b187147fa1..a1f67143fd 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannel.java @@ -30,7 +30,6 @@ import org.jboss.netty.channel.DefaultServerChannelConfig; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ final class DefaultLocalServerChannel extends AbstractServerChannel implements LocalServerChannel { diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java index 34f465c272..e74741dc4b 100644 --- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalServerChannelFactory.java @@ -24,7 +24,6 @@ import org.jboss.netty.channel.ChannelSink; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/channel/local/LocalAddress.java b/src/main/java/org/jboss/netty/channel/local/LocalAddress.java index 06cf91b03c..bd7cfa7d70 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalAddress.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalAddress.java @@ -31,7 +31,6 @@ import java.net.SocketAddress; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/channel/local/LocalChannel.java b/src/main/java/org/jboss/netty/channel/local/LocalChannel.java index 28fb5ada28..72ec25f268 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalChannel.java @@ -23,7 +23,6 @@ import org.jboss.netty.channel.Channel; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface LocalChannel extends Channel { @Override diff --git a/src/main/java/org/jboss/netty/channel/local/LocalChannelRegistry.java b/src/main/java/org/jboss/netty/channel/local/LocalChannelRegistry.java index 9a63764d7b..dc22676e92 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalChannelRegistry.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalChannelRegistry.java @@ -23,7 +23,6 @@ import org.jboss.netty.util.internal.ConcurrentHashMap; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ final class LocalChannelRegistry { diff --git a/src/main/java/org/jboss/netty/channel/local/LocalClientChannelFactory.java b/src/main/java/org/jboss/netty/channel/local/LocalClientChannelFactory.java index e5311d7fbe..ab59a7a3fc 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalClientChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalClientChannelFactory.java @@ -23,7 +23,6 @@ import org.jboss.netty.channel.ChannelPipeline; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface LocalClientChannelFactory extends ChannelFactory { @Override diff --git a/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java b/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java index 2fecaeafc2..bc2b66e84c 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalClientChannelSink.java @@ -36,7 +36,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ final class LocalClientChannelSink extends AbstractChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/local/LocalServerChannel.java b/src/main/java/org/jboss/netty/channel/local/LocalServerChannel.java index d449c424a3..438805650a 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalServerChannel.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalServerChannel.java @@ -23,7 +23,6 @@ import org.jboss.netty.channel.ServerChannel; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface LocalServerChannel extends ServerChannel { @Override diff --git a/src/main/java/org/jboss/netty/channel/local/LocalServerChannelFactory.java b/src/main/java/org/jboss/netty/channel/local/LocalServerChannelFactory.java index 87092efd4e..62216af917 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalServerChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalServerChannelFactory.java @@ -23,7 +23,6 @@ import org.jboss.netty.channel.ServerChannelFactory; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface LocalServerChannelFactory extends ServerChannelFactory { @Override diff --git a/src/main/java/org/jboss/netty/channel/local/LocalServerChannelSink.java b/src/main/java/org/jboss/netty/channel/local/LocalServerChannelSink.java index 00e6eb1a7c..65ee5c9081 100644 --- a/src/main/java/org/jboss/netty/channel/local/LocalServerChannelSink.java +++ b/src/main/java/org/jboss/netty/channel/local/LocalServerChannelSink.java @@ -31,7 +31,6 @@ import org.jboss.netty.channel.MessageEvent; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ final class LocalServerChannelSink extends AbstractChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/socket/ClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/ClientSocketChannelFactory.java index 8872e0039f..743deef98e 100644 --- a/src/main/java/org/jboss/netty/channel/socket/ClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/ClientSocketChannelFactory.java @@ -24,8 +24,6 @@ import org.jboss.netty.channel.ChannelPipeline; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.channel.socket.SocketChannel oneway - - creates */ public interface ClientSocketChannelFactory extends ChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/DatagramChannel.java b/src/main/java/org/jboss/netty/channel/socket/DatagramChannel.java index 54406446fd..9155535e33 100644 --- a/src/main/java/org/jboss/netty/channel/socket/DatagramChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/DatagramChannel.java @@ -27,8 +27,6 @@ import org.jboss.netty.channel.Channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.composedOf org.jboss.netty.channel.socket.DatagramChannelConfig */ diff --git a/src/main/java/org/jboss/netty/channel/socket/DatagramChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/DatagramChannelConfig.java index 6629872a41..a05e647f2e 100644 --- a/src/main/java/org/jboss/netty/channel/socket/DatagramChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/DatagramChannelConfig.java @@ -63,8 +63,6 @@ import org.jboss.netty.channel.ReceiveBufferSizePredictorFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface DatagramChannelConfig extends ChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/DatagramChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/DatagramChannelFactory.java index 37bb2ee1ce..aee3b27214 100644 --- a/src/main/java/org/jboss/netty/channel/socket/DatagramChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/DatagramChannelFactory.java @@ -24,8 +24,6 @@ import org.jboss.netty.channel.ChannelPipeline; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.channel.socket.DatagramChannel oneway - - creates */ public interface DatagramChannelFactory extends ChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/DefaultDatagramChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/DefaultDatagramChannelConfig.java index ce8e2359da..ab579eec2c 100644 --- a/src/main/java/org/jboss/netty/channel/socket/DefaultDatagramChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/DefaultDatagramChannelConfig.java @@ -35,8 +35,6 @@ import org.jboss.netty.util.internal.ConversionUtil; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * */ public class DefaultDatagramChannelConfig extends DefaultChannelConfig implements DatagramChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/DefaultServerSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/DefaultServerSocketChannelConfig.java index 32af3c578c..7fe0310b6a 100644 --- a/src/main/java/org/jboss/netty/channel/socket/DefaultServerSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/DefaultServerSocketChannelConfig.java @@ -27,8 +27,6 @@ import org.jboss.netty.util.internal.ConversionUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DefaultServerSocketChannelConfig extends DefaultServerChannelConfig implements ServerSocketChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/DefaultSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/DefaultSocketChannelConfig.java index 3984048c5f..d492216b56 100644 --- a/src/main/java/org/jboss/netty/channel/socket/DefaultSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/DefaultSocketChannelConfig.java @@ -27,9 +27,6 @@ import org.jboss.netty.util.internal.ConversionUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DefaultSocketChannelConfig extends DefaultChannelConfig implements SocketChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannel.java index 9b781f6903..804f19462a 100644 --- a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannel.java @@ -25,8 +25,6 @@ import org.jboss.netty.channel.ServerChannel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.composedOf org.jboss.netty.channel.socket.ServerSocketChannelConfig */ diff --git a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java index 61c4704acd..46439d80a0 100644 --- a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelConfig.java @@ -42,8 +42,6 @@ import org.jboss.netty.channel.ChannelConfig; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface ServerSocketChannelConfig extends ChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelFactory.java index 261593c1e1..1f602a6e5f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/ServerSocketChannelFactory.java @@ -25,8 +25,6 @@ import org.jboss.netty.channel.ServerChannelFactory; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.channel.socket.ServerSocketChannel oneway - - creates */ public interface ServerSocketChannelFactory extends ServerChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/SocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/SocketChannel.java index 2fd0b6ae38..59713baf15 100644 --- a/src/main/java/org/jboss/netty/channel/socket/SocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/SocketChannel.java @@ -26,8 +26,6 @@ import org.jboss.netty.channel.Channel; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.composedOf org.jboss.netty.channel.socket.SocketChannelConfig */ diff --git a/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java index ca427976f9..31cf40249f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/SocketChannelConfig.java @@ -49,8 +49,6 @@ import org.jboss.netty.channel.ChannelConfig; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface SocketChannelConfig extends ChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/DefaultNioDatagramChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/nio/DefaultNioDatagramChannelConfig.java index 3f97677e25..29264a98ae 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/DefaultNioDatagramChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/DefaultNioDatagramChannelConfig.java @@ -29,9 +29,6 @@ import org.jboss.netty.util.internal.ConversionUtil; * @author The Netty Project * @author Trustin Lee * @author Daniel Bevenius (dbevenius@jboss.com) - * - * @version $Rev$, $Date$ - * */ class DefaultNioDatagramChannelConfig extends DefaultDatagramChannelConfig implements NioDatagramChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/DefaultNioSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/nio/DefaultNioSocketChannelConfig.java index 1414df687b..862c6d3aab 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/DefaultNioSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/DefaultNioSocketChannelConfig.java @@ -32,9 +32,6 @@ import org.jboss.netty.util.internal.ConversionUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class DefaultNioSocketChannelConfig extends DefaultSocketChannelConfig implements NioSocketChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java index 1e2f3fb992..1219cf3248 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioAcceptedSocketChannel.java @@ -28,9 +28,6 @@ import org.jboss.netty.channel.ChannelSink; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ final class NioAcceptedSocketChannel extends NioSocketChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java index f4687050ff..7eb2150369 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannel.java @@ -32,9 +32,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ final class NioClientSocketChannel extends NioSocketChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java index 3711be7c81..e4674e5282 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketChannelFactory.java @@ -79,8 +79,6 @@ import org.jboss.netty.util.internal.ExecutorUtil; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class NioClientSocketChannelFactory implements ClientSocketChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java index c009b11efd..f7c2d3862f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java @@ -49,9 +49,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class NioClientSocketPipelineSink extends AbstractChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java index b8b7cecf64..0403766d54 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannel.java @@ -47,8 +47,6 @@ import org.jboss.netty.util.internal.ThreadLocalBoolean; * @author The Netty Project * @author Trustin Lee * @author Daniel Bevenius (dbevenius@jboss.com) - * - * @version $Rev$, $Date$ */ class NioDatagramChannel extends AbstractChannel implements org.jboss.netty.channel.socket.DatagramChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelConfig.java index 3acebc9fec..5f3aef53ea 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelConfig.java @@ -47,8 +47,6 @@ import org.jboss.netty.channel.socket.DatagramChannelConfig; * @author The Netty Project * @author Trustin Lee * @author Daniel Bevenius (dbevenius@jboss.com) - * - * @version $Rev$, $Date$ */ public interface NioDatagramChannelConfig extends DatagramChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelFactory.java index 201f8a75c4..43b3478e78 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelFactory.java @@ -76,8 +76,6 @@ import org.jboss.netty.util.internal.ExecutorUtil; * @author Trustin Lee * @author Daniel Bevenius (dbevenius@jboss.com) * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class NioDatagramChannelFactory implements DatagramChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java index e9f0fee171..b2c26cb57e 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramPipelineSink.java @@ -38,8 +38,6 @@ import org.jboss.netty.channel.MessageEvent; * @author The Netty Project * @author Trustin Lee * @author Daniel Bevenius (dbevenius@jboss.com) - * - * @version $Rev$, $Date$ */ class NioDatagramPipelineSink extends AbstractChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java index 86b6a0e405..5839cfe2ab 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioDatagramWorker.java @@ -54,8 +54,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; * @author The Netty Project * @author Trustin Lee * @author Daniel Bevenius (dbevenius@jboss.com) - * - * @version $Rev$, $Date$ */ class NioDatagramWorker implements Runnable { /** diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java index e1c966ee77..e433b6f6c2 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioProviderMetadata.java @@ -39,9 +39,6 @@ import org.jboss.netty.util.internal.SystemPropertyUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class NioProviderMetadata { static final InternalLogger logger = diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java index c3296f7db1..cb479e6235 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannel.java @@ -38,9 +38,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class NioServerSocketChannel extends AbstractServerChannel implements org.jboss.netty.channel.socket.ServerSocketChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java index 161b5b96b0..2262925e9f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.java @@ -83,8 +83,6 @@ import org.jboss.netty.util.internal.ExecutorUtil; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class NioServerSocketChannelFactory implements ServerSocketChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java index a8076b39a2..57ee0eaba4 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioServerSocketPipelineSink.java @@ -45,9 +45,6 @@ import org.jboss.netty.util.internal.DeadLockProofWorker; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class NioServerSocketPipelineSink extends AbstractChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java index f4142815ba..37d6af9e53 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannel.java @@ -39,9 +39,6 @@ import org.jboss.netty.util.internal.ThreadLocalBoolean; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class NioSocketChannel extends AbstractChannel implements org.jboss.netty.channel.socket.SocketChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java index 35ffccc8ed..c4dbd36514 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioSocketChannelConfig.java @@ -54,8 +54,6 @@ import org.jboss.netty.channel.socket.SocketChannelConfig; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface NioSocketChannelConfig extends SocketChannelConfig { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java index 39cedc3691..3e7a2fa2a0 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/NioWorker.java @@ -53,9 +53,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class NioWorker implements Runnable { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SelectorUtil.java b/src/main/java/org/jboss/netty/channel/socket/nio/SelectorUtil.java index 6271eaa36e..db47890522 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SelectorUtil.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SelectorUtil.java @@ -25,7 +25,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ final class SelectorUtil { private static final InternalLogger logger = diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java index c0922ef314..55809f0794 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketReceiveBufferPool.java @@ -21,7 +21,6 @@ import java.nio.ByteBuffer; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ final class SocketReceiveBufferPool { diff --git a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java index 54e10cc0ff..43400c395a 100644 --- a/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java +++ b/src/main/java/org/jboss/netty/channel/socket/nio/SocketSendBufferPool.java @@ -28,7 +28,6 @@ import org.jboss.netty.channel.FileRegion; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev: 2174 $, $Date: 2010-02-19 09:57:23 +0900 (Fri, 19 Feb 2010) $ */ final class SocketSendBufferPool { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java index 4fd1da8729..869f539fdb 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioAcceptedSocketChannel.java @@ -32,9 +32,6 @@ import org.jboss.netty.channel.ChannelSink; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OioAcceptedSocketChannel extends OioSocketChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannel.java index d8465e7e1e..ca67b9bbca 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannel.java @@ -29,9 +29,6 @@ import org.jboss.netty.channel.ChannelSink; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OioClientSocketChannel extends OioSocketChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java index 48f006ecb6..0c67de1011 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketChannelFactory.java @@ -72,8 +72,6 @@ import org.jboss.netty.util.internal.ExecutorUtil; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class OioClientSocketChannelFactory implements ClientSocketChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketPipelineSink.java index 86cd7e17c1..a6844aac22 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioClientSocketPipelineSink.java @@ -35,9 +35,6 @@ import org.jboss.netty.util.internal.DeadLockProofWorker; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OioClientSocketPipelineSink extends AbstractChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java index 889bb035a4..9b26401c51 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannel.java @@ -39,9 +39,6 @@ import org.jboss.netty.channel.socket.DefaultDatagramChannelConfig; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ final class OioDatagramChannel extends AbstractChannel implements DatagramChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java index 886b5ca50d..f3c2602a23 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramChannelFactory.java @@ -71,8 +71,6 @@ import org.jboss.netty.util.internal.ExecutorUtil; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class OioDatagramChannelFactory implements DatagramChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramPipelineSink.java index df4767c031..36362b0c73 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramPipelineSink.java @@ -34,9 +34,6 @@ import org.jboss.netty.util.internal.DeadLockProofWorker; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OioDatagramPipelineSink extends AbstractChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java index 76b49dbe5a..c3c1ebe381 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioDatagramWorker.java @@ -32,9 +32,6 @@ import org.jboss.netty.channel.ReceiveBufferSizePredictor; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OioDatagramWorker implements Runnable { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java index fdea2d3956..c4a73e156f 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannel.java @@ -38,9 +38,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OioServerSocketChannel extends AbstractServerChannel implements ServerSocketChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java index 1b448750ba..21188a41fe 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketChannelFactory.java @@ -84,8 +84,6 @@ import org.jboss.netty.util.internal.ExecutorUtil; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class OioServerSocketChannelFactory implements ServerSocketChannelFactory { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java index f829f8a824..75661106a8 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioServerSocketPipelineSink.java @@ -40,9 +40,6 @@ import org.jboss.netty.util.internal.DeadLockProofWorker; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OioServerSocketPipelineSink extends AbstractChannelSink { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioSocketChannel.java index 2720e23b0a..5ab1c3a9a4 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioSocketChannel.java @@ -35,9 +35,6 @@ import org.jboss.netty.channel.socket.SocketChannelConfig; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ abstract class OioSocketChannel extends AbstractChannel implements SocketChannel { diff --git a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java index 69814d0a48..737e256e20 100644 --- a/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/oio/OioWorker.java @@ -34,9 +34,6 @@ import org.jboss.netty.channel.FileRegion; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OioWorker implements Runnable { diff --git a/src/main/java/org/jboss/netty/container/microcontainer/NettyLoggerConfigurator.java b/src/main/java/org/jboss/netty/container/microcontainer/NettyLoggerConfigurator.java index 705c5c9b75..3e1c505c05 100644 --- a/src/main/java/org/jboss/netty/container/microcontainer/NettyLoggerConfigurator.java +++ b/src/main/java/org/jboss/netty/container/microcontainer/NettyLoggerConfigurator.java @@ -23,7 +23,6 @@ import org.jboss.netty.logging.JBossLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class NettyLoggerConfigurator { public NettyLoggerConfigurator() { diff --git a/src/main/java/org/jboss/netty/container/osgi/NettyBundleActivator.java b/src/main/java/org/jboss/netty/container/osgi/NettyBundleActivator.java index 8d527635de..f05e5970c3 100644 --- a/src/main/java/org/jboss/netty/container/osgi/NettyBundleActivator.java +++ b/src/main/java/org/jboss/netty/container/osgi/NettyBundleActivator.java @@ -25,7 +25,6 @@ import org.osgi.framework.BundleContext; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class NettyBundleActivator implements BundleActivator { diff --git a/src/main/java/org/jboss/netty/container/spring/NettyLoggerConfigurator.java b/src/main/java/org/jboss/netty/container/spring/NettyLoggerConfigurator.java index c00036b719..7123089927 100644 --- a/src/main/java/org/jboss/netty/container/spring/NettyLoggerConfigurator.java +++ b/src/main/java/org/jboss/netty/container/spring/NettyLoggerConfigurator.java @@ -23,7 +23,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class NettyLoggerConfigurator { public NettyLoggerConfigurator() { diff --git a/src/main/java/org/jboss/netty/example/discard/DiscardClient.java b/src/main/java/org/jboss/netty/example/discard/DiscardClient.java index 1d6f51b0d9..f221c2c875 100644 --- a/src/main/java/org/jboss/netty/example/discard/DiscardClient.java +++ b/src/main/java/org/jboss/netty/example/discard/DiscardClient.java @@ -30,8 +30,6 @@ import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DiscardClient { diff --git a/src/main/java/org/jboss/netty/example/discard/DiscardClientHandler.java b/src/main/java/org/jboss/netty/example/discard/DiscardClientHandler.java index 9a991a8bcf..da90026a1d 100644 --- a/src/main/java/org/jboss/netty/example/discard/DiscardClientHandler.java +++ b/src/main/java/org/jboss/netty/example/discard/DiscardClientHandler.java @@ -36,8 +36,6 @@ import org.jboss.netty.channel.WriteCompletionEvent; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DiscardClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/discard/DiscardServer.java b/src/main/java/org/jboss/netty/example/discard/DiscardServer.java index a26aec3dda..e1783e372a 100644 --- a/src/main/java/org/jboss/netty/example/discard/DiscardServer.java +++ b/src/main/java/org/jboss/netty/example/discard/DiscardServer.java @@ -29,8 +29,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DiscardServer { diff --git a/src/main/java/org/jboss/netty/example/discard/DiscardServerHandler.java b/src/main/java/org/jboss/netty/example/discard/DiscardServerHandler.java index 67ec94682f..b106e82c41 100644 --- a/src/main/java/org/jboss/netty/example/discard/DiscardServerHandler.java +++ b/src/main/java/org/jboss/netty/example/discard/DiscardServerHandler.java @@ -32,8 +32,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DiscardServerHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/echo/EchoClient.java b/src/main/java/org/jboss/netty/example/echo/EchoClient.java index 4b5a6d7bec..46ee47485e 100644 --- a/src/main/java/org/jboss/netty/example/echo/EchoClient.java +++ b/src/main/java/org/jboss/netty/example/echo/EchoClient.java @@ -33,9 +33,6 @@ import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class EchoClient { diff --git a/src/main/java/org/jboss/netty/example/echo/EchoClientHandler.java b/src/main/java/org/jboss/netty/example/echo/EchoClientHandler.java index ebd60eb35c..3c3d5a0765 100644 --- a/src/main/java/org/jboss/netty/example/echo/EchoClientHandler.java +++ b/src/main/java/org/jboss/netty/example/echo/EchoClientHandler.java @@ -34,8 +34,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class EchoClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/echo/EchoServer.java b/src/main/java/org/jboss/netty/example/echo/EchoServer.java index f45f42e2db..65bf9064d8 100644 --- a/src/main/java/org/jboss/netty/example/echo/EchoServer.java +++ b/src/main/java/org/jboss/netty/example/echo/EchoServer.java @@ -29,9 +29,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class EchoServer { diff --git a/src/main/java/org/jboss/netty/example/echo/EchoServerHandler.java b/src/main/java/org/jboss/netty/example/echo/EchoServerHandler.java index 1a815bb1ae..f2e6018494 100644 --- a/src/main/java/org/jboss/netty/example/echo/EchoServerHandler.java +++ b/src/main/java/org/jboss/netty/example/echo/EchoServerHandler.java @@ -30,8 +30,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class EchoServerHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/factorial/BigIntegerDecoder.java b/src/main/java/org/jboss/netty/example/factorial/BigIntegerDecoder.java index ba49034396..0660f1a5b7 100644 --- a/src/main/java/org/jboss/netty/example/factorial/BigIntegerDecoder.java +++ b/src/main/java/org/jboss/netty/example/factorial/BigIntegerDecoder.java @@ -31,8 +31,6 @@ import org.jboss.netty.handler.codec.frame.FrameDecoder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class BigIntegerDecoder extends FrameDecoder { diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialClient.java b/src/main/java/org/jboss/netty/example/factorial/FactorialClient.java index 1033de1734..05c8d4f413 100644 --- a/src/main/java/org/jboss/netty/example/factorial/FactorialClient.java +++ b/src/main/java/org/jboss/netty/example/factorial/FactorialClient.java @@ -29,8 +29,6 @@ import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class FactorialClient { diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialClientHandler.java b/src/main/java/org/jboss/netty/example/factorial/FactorialClientHandler.java index fc4bc7daad..417be9803c 100644 --- a/src/main/java/org/jboss/netty/example/factorial/FactorialClientHandler.java +++ b/src/main/java/org/jboss/netty/example/factorial/FactorialClientHandler.java @@ -40,8 +40,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class FactorialClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialClientPipelineFactory.java b/src/main/java/org/jboss/netty/example/factorial/FactorialClientPipelineFactory.java index a1df58bc56..735e7a03c6 100644 --- a/src/main/java/org/jboss/netty/example/factorial/FactorialClientPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/factorial/FactorialClientPipelineFactory.java @@ -28,8 +28,6 @@ import org.jboss.netty.handler.codec.compression.ZlibWrapper; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class FactorialClientPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialServer.java b/src/main/java/org/jboss/netty/example/factorial/FactorialServer.java index 84b002c0c5..66817a6780 100644 --- a/src/main/java/org/jboss/netty/example/factorial/FactorialServer.java +++ b/src/main/java/org/jboss/netty/example/factorial/FactorialServer.java @@ -27,8 +27,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class FactorialServer { diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialServerHandler.java b/src/main/java/org/jboss/netty/example/factorial/FactorialServerHandler.java index 404b60a4d3..aeec139c13 100644 --- a/src/main/java/org/jboss/netty/example/factorial/FactorialServerHandler.java +++ b/src/main/java/org/jboss/netty/example/factorial/FactorialServerHandler.java @@ -36,8 +36,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class FactorialServerHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/factorial/FactorialServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/factorial/FactorialServerPipelineFactory.java index 8f27842f22..4eba5a537b 100644 --- a/src/main/java/org/jboss/netty/example/factorial/FactorialServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/factorial/FactorialServerPipelineFactory.java @@ -29,8 +29,6 @@ import org.jboss.netty.handler.codec.compression.ZlibWrapper; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * */ public class FactorialServerPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/factorial/NumberEncoder.java b/src/main/java/org/jboss/netty/example/factorial/NumberEncoder.java index d9c6445b4d..ce02300069 100644 --- a/src/main/java/org/jboss/netty/example/factorial/NumberEncoder.java +++ b/src/main/java/org/jboss/netty/example/factorial/NumberEncoder.java @@ -31,8 +31,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * */ public class NumberEncoder extends OneToOneEncoder { diff --git a/src/main/java/org/jboss/netty/example/http/snoop/HttpClient.java b/src/main/java/org/jboss/netty/example/http/snoop/HttpClient.java index 7b120d3ab3..16949489de 100644 --- a/src/main/java/org/jboss/netty/example/http/snoop/HttpClient.java +++ b/src/main/java/org/jboss/netty/example/http/snoop/HttpClient.java @@ -37,8 +37,6 @@ import org.jboss.netty.handler.codec.http.HttpVersion; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class HttpClient { diff --git a/src/main/java/org/jboss/netty/example/http/snoop/HttpClientPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/snoop/HttpClientPipelineFactory.java index 8902dbcbad..d5af1bcee7 100644 --- a/src/main/java/org/jboss/netty/example/http/snoop/HttpClientPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/http/snoop/HttpClientPipelineFactory.java @@ -32,8 +32,6 @@ import org.jboss.netty.logging.InternalLogLevel; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class HttpClientPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/http/snoop/HttpRequestHandler.java b/src/main/java/org/jboss/netty/example/http/snoop/HttpRequestHandler.java index 6c6eb6023f..ad677e7f87 100644 --- a/src/main/java/org/jboss/netty/example/http/snoop/HttpRequestHandler.java +++ b/src/main/java/org/jboss/netty/example/http/snoop/HttpRequestHandler.java @@ -48,8 +48,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class HttpRequestHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/http/snoop/HttpResponseHandler.java b/src/main/java/org/jboss/netty/example/http/snoop/HttpResponseHandler.java index c5fbb95819..14ea9e3a23 100644 --- a/src/main/java/org/jboss/netty/example/http/snoop/HttpResponseHandler.java +++ b/src/main/java/org/jboss/netty/example/http/snoop/HttpResponseHandler.java @@ -27,8 +27,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class HttpResponseHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/http/snoop/HttpServer.java b/src/main/java/org/jboss/netty/example/http/snoop/HttpServer.java index 85d2282540..24c819e064 100644 --- a/src/main/java/org/jboss/netty/example/http/snoop/HttpServer.java +++ b/src/main/java/org/jboss/netty/example/http/snoop/HttpServer.java @@ -28,8 +28,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class HttpServer { public static void main(String[] args) { diff --git a/src/main/java/org/jboss/netty/example/http/snoop/HttpServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/snoop/HttpServerPipelineFactory.java index 8960be7046..3415979f82 100644 --- a/src/main/java/org/jboss/netty/example/http/snoop/HttpServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/http/snoop/HttpServerPipelineFactory.java @@ -29,8 +29,6 @@ import org.jboss.netty.logging.InternalLogLevel; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class HttpServerPipelineFactory implements ChannelPipelineFactory { @Override diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpClient.java b/src/main/java/org/jboss/netty/example/http/upload/HttpClient.java index 2a5b248cd9..290e2679fb 100644 --- a/src/main/java/org/jboss/netty/example/http/upload/HttpClient.java +++ b/src/main/java/org/jboss/netty/example/http/upload/HttpClient.java @@ -47,8 +47,6 @@ import org.jboss.netty.handler.codec.http.HttpPostRequestEncoder.ErrorDataEncode * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee * @author Frederic Bregier - * - * @version $Rev$, $Date$ */ public class HttpClient { diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpClientPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/upload/HttpClientPipelineFactory.java index 3b54aaabe1..2116053d6b 100644 --- a/src/main/java/org/jboss/netty/example/http/upload/HttpClientPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/http/upload/HttpClientPipelineFactory.java @@ -32,8 +32,6 @@ import org.jboss.netty.handler.stream.ChunkedWriteHandler; * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee * @author Frederic Bregier - * - * @version $Rev$, $Date$ */ public class HttpClientPipelineFactory implements ChannelPipelineFactory { private final boolean ssl; diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpRequestHandler.java b/src/main/java/org/jboss/netty/example/http/upload/HttpRequestHandler.java index dfe3d4425f..468087cf2a 100644 --- a/src/main/java/org/jboss/netty/example/http/upload/HttpRequestHandler.java +++ b/src/main/java/org/jboss/netty/example/http/upload/HttpRequestHandler.java @@ -65,9 +65,6 @@ import org.jboss.netty.util.CharsetUtil; * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee * @author Frederic Bregier - * - * @version $Rev$, $Date: 2009-10-25 01:26:23 +0200 (dim., 25 oct. 2009) - * $ */ public class HttpRequestHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpResponseHandler.java b/src/main/java/org/jboss/netty/example/http/upload/HttpResponseHandler.java index f687b6b5e2..23fed8779a 100644 --- a/src/main/java/org/jboss/netty/example/http/upload/HttpResponseHandler.java +++ b/src/main/java/org/jboss/netty/example/http/upload/HttpResponseHandler.java @@ -29,8 +29,6 @@ import org.jboss.netty.util.CharsetUtil; * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee * @author Frederic Bregier - * - * @version $Rev$, $Date$ */ public class HttpResponseHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpServer.java b/src/main/java/org/jboss/netty/example/http/upload/HttpServer.java index edbdb8508f..9c575abd76 100644 --- a/src/main/java/org/jboss/netty/example/http/upload/HttpServer.java +++ b/src/main/java/org/jboss/netty/example/http/upload/HttpServer.java @@ -26,8 +26,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee * @author Frederic Bregier - * - * @version $Rev$, $Date$ */ public class HttpServer { public static void main(String[] args) { diff --git a/src/main/java/org/jboss/netty/example/http/upload/HttpServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/upload/HttpServerPipelineFactory.java index e283f490ac..be210f3175 100644 --- a/src/main/java/org/jboss/netty/example/http/upload/HttpServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/http/upload/HttpServerPipelineFactory.java @@ -28,8 +28,6 @@ import org.jboss.netty.handler.codec.http.HttpResponseEncoder; * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee * @author Frederic Bregier - * - * @version $Rev$, $Date$ */ public class HttpServerPipelineFactory implements ChannelPipelineFactory { @Override diff --git a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServer.java b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServer.java index 5355909903..4d65a4f964 100644 --- a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServer.java +++ b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServer.java @@ -31,8 +31,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class WebSocketServer { public static void main(String[] args) { diff --git a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerHandler.java b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerHandler.java index 5996b75d77..714a1aa6b1 100644 --- a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerHandler.java +++ b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerHandler.java @@ -49,8 +49,6 @@ import org.jboss.netty.util.CharsetUtil; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class WebSocketServerHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerIndexPage.java b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerIndexPage.java index 8ea63a4987..ba37c4e506 100644 --- a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerIndexPage.java +++ b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerIndexPage.java @@ -25,8 +25,6 @@ import org.jboss.netty.util.CharsetUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class WebSocketServerIndexPage { diff --git a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerPipelineFactory.java index d32d3494e6..b180008aae 100644 --- a/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/http/websocket/WebSocketServerPipelineFactory.java @@ -26,8 +26,6 @@ import org.jboss.netty.handler.codec.http.HttpResponseEncoder; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class WebSocketServerPipelineFactory implements ChannelPipelineFactory { @Override diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServer.java b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServer.java index 67cb476e98..30610be285 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServer.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServer.java @@ -31,8 +31,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketServer { public static void main(String[] args) { diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerHandler.java b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerHandler.java index 2714ab01a7..b51517760f 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerHandler.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerHandler.java @@ -50,8 +50,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketServerHandler extends SimpleChannelUpstreamHandler { private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandler.class); diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerPipelineFactory.java index e7bfd52999..e1bdd1c959 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/autobahn/WebSocketServerPipelineFactory.java @@ -27,8 +27,6 @@ import org.jboss.netty.handler.codec.http.HttpResponseEncoder; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketServerPipelineFactory implements ChannelPipelineFactory { @Override diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java b/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java index a140705def..ba8ea8681a 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/client/App.java @@ -34,8 +34,6 @@ import org.jboss.netty.handler.codec.http.websocketx.WebSocketSpecificationVersi * A HTTP client demo app * * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class App { diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServer.java b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServer.java index 37869480db..c32c710e04 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServer.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServer.java @@ -49,8 +49,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketServer { public static void main(String[] args) { diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerHandler.java b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerHandler.java index 2fd373bdc7..98aff22afb 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerHandler.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerHandler.java @@ -50,8 +50,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketServerHandler extends SimpleChannelUpstreamHandler { private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandler.class); diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerIndexPage.java b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerIndexPage.java index 1bd7fb63bd..2b0db7b3c3 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerIndexPage.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerIndexPage.java @@ -26,8 +26,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketServerIndexPage { diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerPipelineFactory.java index 49167bae22..ae9d62af6b 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/server/WebSocketServerPipelineFactory.java @@ -27,8 +27,6 @@ import org.jboss.netty.handler.codec.http.HttpResponseEncoder; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketServerPipelineFactory implements ChannelPipelineFactory { @Override diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java index 9915e7c35e..a6642c4754 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServer.java @@ -49,8 +49,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketSslServer { public static void main(String[] args) { diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java index 9b3875b1da..ac17f32a0e 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerHandler.java @@ -50,8 +50,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketSslServerHandler extends SimpleChannelUpstreamHandler { private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketSslServerHandler.class); diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java index e3c84695ad..bfc4099099 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerIndexPage.java @@ -26,8 +26,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketSslServerIndexPage { diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerPipelineFactory.java index 6b3e2bf9ed..00f89ad0ab 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerPipelineFactory.java @@ -30,8 +30,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketSslServerPipelineFactory implements ChannelPipelineFactory { @Override diff --git a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java index 64ab6e34da..e7f8588ce8 100644 --- a/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java +++ b/src/main/java/org/jboss/netty/example/http/websocketx/sslserver/WebSocketSslServerSslContext.java @@ -31,8 +31,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * @author The Netty Project * @author Trustin Lee * @author Vibul Imtarnasan - * - * @version $Rev$, $Date$ */ public class WebSocketSslServerSslContext { diff --git a/src/main/java/org/jboss/netty/example/local/LocalExample.java b/src/main/java/org/jboss/netty/example/local/LocalExample.java index 41a67458ed..5044064f17 100644 --- a/src/main/java/org/jboss/netty/example/local/LocalExample.java +++ b/src/main/java/org/jboss/netty/example/local/LocalExample.java @@ -36,7 +36,6 @@ import org.jboss.netty.logging.InternalLogLevel; /** * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) - * @version $Rev$, $Date$ */ public class LocalExample { public static void main(String[] args) throws Exception { diff --git a/src/main/java/org/jboss/netty/example/local/LocalExampleMultthreaded.java b/src/main/java/org/jboss/netty/example/local/LocalExampleMultthreaded.java index 29736cba26..27669d9376 100644 --- a/src/main/java/org/jboss/netty/example/local/LocalExampleMultthreaded.java +++ b/src/main/java/org/jboss/netty/example/local/LocalExampleMultthreaded.java @@ -36,7 +36,6 @@ import org.jboss.netty.logging.InternalLogLevel; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Frederic Bregier (fredbregier@free.fr) - * @version $Rev$, $Date$ */ public class LocalExampleMultthreaded { diff --git a/src/main/java/org/jboss/netty/example/local/LocalServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/local/LocalServerPipelineFactory.java index 3e2ff9463e..80e65dc76f 100644 --- a/src/main/java/org/jboss/netty/example/local/LocalServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/local/LocalServerPipelineFactory.java @@ -33,7 +33,6 @@ import org.jboss.netty.handler.execution.ExecutionHandler; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Frederic Bregier (fredbregier@free.fr) - * @version $Rev$, $Date$ */ public class LocalServerPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeClient.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeClient.java index f1a9846887..f9f20e6baf 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeClient.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeClient.java @@ -33,8 +33,6 @@ import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class LocalTimeClient { diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeClientHandler.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeClientHandler.java index e2e7109685..7cbf79b566 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeClientHandler.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeClientHandler.java @@ -40,8 +40,6 @@ import org.jboss.netty.example.localtime.LocalTimeProtocol.Locations; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class LocalTimeClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeClientPipelineFactory.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeClientPipelineFactory.java index 1733ce32d9..11caacc5f9 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeClientPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeClientPipelineFactory.java @@ -27,7 +27,6 @@ import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepend /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class LocalTimeClientPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeServer.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeServer.java index 4e56d837b6..85b9ed8567 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeServer.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeServer.java @@ -27,8 +27,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class LocalTimeServer { diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerHandler.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerHandler.java index c2b1c297da..99a6e2f251 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerHandler.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerHandler.java @@ -38,8 +38,6 @@ import org.jboss.netty.example.localtime.LocalTimeProtocol.Locations; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class LocalTimeServerHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerPipelineFactory.java index dcb9cdb7fc..d177d83c7d 100644 --- a/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/localtime/LocalTimeServerPipelineFactory.java @@ -27,7 +27,6 @@ import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepend /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class LocalTimeServerPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoClient.java b/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoClient.java index aa3ceca0dd..bdc75a63af 100644 --- a/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoClient.java +++ b/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoClient.java @@ -32,8 +32,6 @@ import org.jboss.netty.handler.codec.serialization.ObjectEncoder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class ObjectEchoClient { diff --git a/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoClientHandler.java b/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoClientHandler.java index 385964c167..e16803fd75 100644 --- a/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoClientHandler.java +++ b/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoClientHandler.java @@ -36,8 +36,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class ObjectEchoClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoServer.java b/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoServer.java index 4b3ef60d91..bd49afedc5 100644 --- a/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoServer.java +++ b/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoServer.java @@ -32,8 +32,6 @@ import org.jboss.netty.handler.codec.serialization.ObjectEncoder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class ObjectEchoServer { diff --git a/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoServerHandler.java b/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoServerHandler.java index 307adbd782..1dad91d69d 100644 --- a/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoServerHandler.java +++ b/src/main/java/org/jboss/netty/example/objectecho/ObjectEchoServerHandler.java @@ -33,8 +33,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class ObjectEchoServerHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/portunification/PortUnificationServer.java b/src/main/java/org/jboss/netty/example/portunification/PortUnificationServer.java index 6e1dafbc71..2b189cf04f 100644 --- a/src/main/java/org/jboss/netty/example/portunification/PortUnificationServer.java +++ b/src/main/java/org/jboss/netty/example/portunification/PortUnificationServer.java @@ -33,8 +33,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class PortUnificationServer { diff --git a/src/main/java/org/jboss/netty/example/portunification/PortUnificationServerHandler.java b/src/main/java/org/jboss/netty/example/portunification/PortUnificationServerHandler.java index 2974acce58..7e8463f828 100644 --- a/src/main/java/org/jboss/netty/example/portunification/PortUnificationServerHandler.java +++ b/src/main/java/org/jboss/netty/example/portunification/PortUnificationServerHandler.java @@ -41,8 +41,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class PortUnificationServerHandler extends FrameDecoder { diff --git a/src/main/java/org/jboss/netty/example/proxy/HexDumpProxy.java b/src/main/java/org/jboss/netty/example/proxy/HexDumpProxy.java index ebdf68d4fa..91bda5f7f7 100644 --- a/src/main/java/org/jboss/netty/example/proxy/HexDumpProxy.java +++ b/src/main/java/org/jboss/netty/example/proxy/HexDumpProxy.java @@ -27,7 +27,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HexDumpProxy { diff --git a/src/main/java/org/jboss/netty/example/proxy/HexDumpProxyInboundHandler.java b/src/main/java/org/jboss/netty/example/proxy/HexDumpProxyInboundHandler.java index e7f1a83318..35a869b56b 100644 --- a/src/main/java/org/jboss/netty/example/proxy/HexDumpProxyInboundHandler.java +++ b/src/main/java/org/jboss/netty/example/proxy/HexDumpProxyInboundHandler.java @@ -33,7 +33,6 @@ import org.jboss.netty.channel.socket.ClientSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HexDumpProxyInboundHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/proxy/HexDumpProxyPipelineFactory.java b/src/main/java/org/jboss/netty/example/proxy/HexDumpProxyPipelineFactory.java index 71a1c769bf..1bb2685fc5 100644 --- a/src/main/java/org/jboss/netty/example/proxy/HexDumpProxyPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/proxy/HexDumpProxyPipelineFactory.java @@ -24,7 +24,6 @@ import org.jboss.netty.channel.socket.ClientSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HexDumpProxyPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentClient.java b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentClient.java index 5775cb9ac5..f725dfc29f 100644 --- a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentClient.java +++ b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentClient.java @@ -38,7 +38,6 @@ import org.jboss.netty.util.CharsetUtil; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class QuoteOfTheMomentClient { diff --git a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentClientHandler.java b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentClientHandler.java index cab0c2652f..078cd3381b 100644 --- a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentClientHandler.java +++ b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentClientHandler.java @@ -23,7 +23,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class QuoteOfTheMomentClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServer.java b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServer.java index dc5a205956..914cbfb2c3 100644 --- a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServer.java +++ b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServer.java @@ -37,7 +37,6 @@ import org.jboss.netty.util.CharsetUtil; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class QuoteOfTheMomentServer { diff --git a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java index 43bebf29a4..0f9f933f9f 100644 --- a/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java +++ b/src/main/java/org/jboss/netty/example/qotm/QuoteOfTheMomentServerHandler.java @@ -25,7 +25,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class QuoteOfTheMomentServerHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatClient.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatClient.java index 72e9bb516d..46a6b4a76c 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatClient.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatClient.java @@ -31,9 +31,6 @@ import org.jboss.netty.example.telnet.TelnetClient; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class SecureChatClient { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatClientHandler.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatClientHandler.java index f9537ae258..98019baac3 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatClientHandler.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatClientHandler.java @@ -31,8 +31,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SecureChatClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatClientPipelineFactory.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatClientPipelineFactory.java index bc876d2524..efa90c918d 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatClientPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatClientPipelineFactory.java @@ -32,9 +32,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class SecureChatClientPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatKeyStore.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatKeyStore.java index 48efac7311..59ab55a320 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatKeyStore.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatKeyStore.java @@ -32,8 +32,6 @@ import java.io.InputStream; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SecureChatKeyStore { private static final short[] DATA = { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatServer.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatServer.java index b64cc116c2..aa7e8c6e86 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatServer.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatServer.java @@ -27,8 +27,6 @@ import org.jboss.netty.example.telnet.TelnetServer; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SecureChatServer { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatServerHandler.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatServerHandler.java index 876d88933f..32118d1e32 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatServerHandler.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatServerHandler.java @@ -37,8 +37,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SecureChatServerHandler extends SimpleChannelUpstreamHandler { @@ -113,7 +111,6 @@ public class SecureChatServerHandler extends SimpleChannelUpstreamHandler { /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ private static final class Greeter implements ChannelFutureListener { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatServerPipelineFactory.java index b4f6961e6f..5ebef06c2e 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatServerPipelineFactory.java @@ -32,9 +32,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class SecureChatServerPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatSslContextFactory.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatSslContextFactory.java index 490a20f6ef..4ac6ccf07b 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatSslContextFactory.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatSslContextFactory.java @@ -51,8 +51,6 @@ import org.jboss.netty.handler.ssl.SslHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SecureChatSslContextFactory { diff --git a/src/main/java/org/jboss/netty/example/securechat/SecureChatTrustManagerFactory.java b/src/main/java/org/jboss/netty/example/securechat/SecureChatTrustManagerFactory.java index d898703d8d..d534427e40 100644 --- a/src/main/java/org/jboss/netty/example/securechat/SecureChatTrustManagerFactory.java +++ b/src/main/java/org/jboss/netty/example/securechat/SecureChatTrustManagerFactory.java @@ -32,8 +32,6 @@ import javax.net.ssl.X509TrustManager; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SecureChatTrustManagerFactory extends TrustManagerFactorySpi { diff --git a/src/main/java/org/jboss/netty/example/telnet/TelnetClient.java b/src/main/java/org/jboss/netty/example/telnet/TelnetClient.java index abcbfeeef1..b24de1e1b0 100644 --- a/src/main/java/org/jboss/netty/example/telnet/TelnetClient.java +++ b/src/main/java/org/jboss/netty/example/telnet/TelnetClient.java @@ -30,8 +30,6 @@ import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class TelnetClient { diff --git a/src/main/java/org/jboss/netty/example/telnet/TelnetClientHandler.java b/src/main/java/org/jboss/netty/example/telnet/TelnetClientHandler.java index d5ee47fccb..31277b2ece 100644 --- a/src/main/java/org/jboss/netty/example/telnet/TelnetClientHandler.java +++ b/src/main/java/org/jboss/netty/example/telnet/TelnetClientHandler.java @@ -30,8 +30,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class TelnetClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/telnet/TelnetClientPipelineFactory.java b/src/main/java/org/jboss/netty/example/telnet/TelnetClientPipelineFactory.java index 6a71227d47..3de45bd9a7 100644 --- a/src/main/java/org/jboss/netty/example/telnet/TelnetClientPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/telnet/TelnetClientPipelineFactory.java @@ -29,9 +29,6 @@ import org.jboss.netty.handler.codec.string.StringEncoder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class TelnetClientPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/telnet/TelnetServer.java b/src/main/java/org/jboss/netty/example/telnet/TelnetServer.java index bc6fd06c1f..178caf6a09 100644 --- a/src/main/java/org/jboss/netty/example/telnet/TelnetServer.java +++ b/src/main/java/org/jboss/netty/example/telnet/TelnetServer.java @@ -26,8 +26,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class TelnetServer { diff --git a/src/main/java/org/jboss/netty/example/telnet/TelnetServerHandler.java b/src/main/java/org/jboss/netty/example/telnet/TelnetServerHandler.java index 17ab96909b..89198cd0b6 100644 --- a/src/main/java/org/jboss/netty/example/telnet/TelnetServerHandler.java +++ b/src/main/java/org/jboss/netty/example/telnet/TelnetServerHandler.java @@ -34,8 +34,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class TelnetServerHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/example/telnet/TelnetServerPipelineFactory.java b/src/main/java/org/jboss/netty/example/telnet/TelnetServerPipelineFactory.java index 196be77773..453c063fcd 100644 --- a/src/main/java/org/jboss/netty/example/telnet/TelnetServerPipelineFactory.java +++ b/src/main/java/org/jboss/netty/example/telnet/TelnetServerPipelineFactory.java @@ -29,9 +29,6 @@ import org.jboss.netty.handler.codec.string.StringEncoder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class TelnetServerPipelineFactory implements ChannelPipelineFactory { diff --git a/src/main/java/org/jboss/netty/example/uptime/UptimeClient.java b/src/main/java/org/jboss/netty/example/uptime/UptimeClient.java index 05c0faeec0..12289aec8a 100644 --- a/src/main/java/org/jboss/netty/example/uptime/UptimeClient.java +++ b/src/main/java/org/jboss/netty/example/uptime/UptimeClient.java @@ -36,8 +36,6 @@ import org.jboss.netty.util.Timer; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class UptimeClient { diff --git a/src/main/java/org/jboss/netty/example/uptime/UptimeClientHandler.java b/src/main/java/org/jboss/netty/example/uptime/UptimeClientHandler.java index 6fe49f5363..b96e11ae38 100644 --- a/src/main/java/org/jboss/netty/example/uptime/UptimeClientHandler.java +++ b/src/main/java/org/jboss/netty/example/uptime/UptimeClientHandler.java @@ -35,8 +35,6 @@ import org.jboss.netty.util.TimerTask; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class UptimeClientHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/handler/codec/base64/Base64.java b/src/main/java/org/jboss/netty/handler/codec/base64/Base64.java index 05f6d691c6..8aae3bfd06 100644 --- a/src/main/java/org/jboss/netty/handler/codec/base64/Base64.java +++ b/src/main/java/org/jboss/netty/handler/codec/base64/Base64.java @@ -33,7 +33,6 @@ import org.jboss.netty.buffer.HeapChannelBufferFactory; * @author The Netty Project * @author Robert Harder (rob@iharder.net) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.uses org.jboss.netty.handler.codec.base64.Base64Dialect diff --git a/src/main/java/org/jboss/netty/handler/codec/base64/Base64Decoder.java b/src/main/java/org/jboss/netty/handler/codec/base64/Base64Decoder.java index e719ac11d0..8f01e2416b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/base64/Base64Decoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/base64/Base64Decoder.java @@ -46,7 +46,6 @@ import org.jboss.netty.util.CharsetUtil; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.uses org.jboss.netty.handler.codec.base64.Base64 diff --git a/src/main/java/org/jboss/netty/handler/codec/base64/Base64Dialect.java b/src/main/java/org/jboss/netty/handler/codec/base64/Base64Dialect.java index c49cea6593..2a97205cc2 100644 --- a/src/main/java/org/jboss/netty/handler/codec/base64/Base64Dialect.java +++ b/src/main/java/org/jboss/netty/handler/codec/base64/Base64Dialect.java @@ -28,7 +28,6 @@ package org.jboss.netty.handler.codec.base64; * @author The Netty Project * @author Robert Harder (rob@iharder.net) * @author Trustin Lee - * @version $Rev$, $Date$ */ public enum Base64Dialect { /** diff --git a/src/main/java/org/jboss/netty/handler/codec/base64/Base64Encoder.java b/src/main/java/org/jboss/netty/handler/codec/base64/Base64Encoder.java index e619b82717..605e0df1b8 100644 --- a/src/main/java/org/jboss/netty/handler/codec/base64/Base64Encoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/base64/Base64Encoder.java @@ -40,7 +40,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.uses org.jboss.netty.handler.codec.base64.Base64 diff --git a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java index d23e6f7057..1c257908bf 100644 --- a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoder.java @@ -51,8 +51,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneDecoder; * * @author The Netty Project * @author Tomasz Blachowicz (tblachowicz@gmail.com) - * - * @version $Rev$, $Date$ */ public class ByteArrayDecoder extends OneToOneDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java index 80cde19306..9188cb59ac 100644 --- a/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoder.java @@ -53,8 +53,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * * @author The Netty Project * @author Tomasz Blachowicz (tblachowicz@gmail.com) - * - * @version $Rev$, $Date$ */ public class ByteArrayEncoder extends OneToOneEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/compression/CompressionException.java b/src/main/java/org/jboss/netty/handler/codec/compression/CompressionException.java index a939cccd5a..fdb200b109 100644 --- a/src/main/java/org/jboss/netty/handler/codec/compression/CompressionException.java +++ b/src/main/java/org/jboss/netty/handler/codec/compression/CompressionException.java @@ -23,7 +23,6 @@ import java.io.IOException; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class CompressionException extends RuntimeException { diff --git a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibDecoder.java b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibDecoder.java index 8dc7eb94c5..fe36a2a846 100644 --- a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibDecoder.java @@ -29,7 +29,6 @@ import org.jboss.netty.util.internal.jzlib.ZStream; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.has org.jboss.netty.handler.codec.compression.ZlibWrapper diff --git a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibEncoder.java b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibEncoder.java index c4da15c4d8..03af8f1808 100644 --- a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibEncoder.java @@ -37,7 +37,6 @@ import org.jboss.netty.util.internal.jzlib.ZStream; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.has org.jboss.netty.handler.codec.compression.ZlibWrapper diff --git a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibUtil.java b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibUtil.java index 2f7c17a92e..d0ad7e2117 100644 --- a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibUtil.java +++ b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibUtil.java @@ -23,7 +23,6 @@ import org.jboss.netty.util.internal.jzlib.ZStream; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ final class ZlibUtil { diff --git a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibWrapper.java b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibWrapper.java index 3c38383fd9..37f8bd630d 100644 --- a/src/main/java/org/jboss/netty/handler/codec/compression/ZlibWrapper.java +++ b/src/main/java/org/jboss/netty/handler/codec/compression/ZlibWrapper.java @@ -21,7 +21,6 @@ package org.jboss.netty.handler.codec.compression; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public enum ZlibWrapper { /** diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/AbstractCodecEmbedder.java b/src/main/java/org/jboss/netty/handler/codec/embedder/AbstractCodecEmbedder.java index fd5b6d83aa..8c56208198 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/AbstractCodecEmbedder.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/AbstractCodecEmbedder.java @@ -40,7 +40,6 @@ import org.jboss.netty.channel.MessageEvent; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ abstract class AbstractCodecEmbedder implements CodecEmbedder { diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedder.java b/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedder.java index 40afab6c64..1cec8adaf5 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedder.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedder.java @@ -26,7 +26,6 @@ import org.jboss.netty.channel.ChannelPipeline; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface CodecEmbedder { /** diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedderException.java b/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedderException.java index 7c82ad99ac..367ed7ef78 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedderException.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/CodecEmbedderException.java @@ -21,7 +21,6 @@ package org.jboss.netty.handler.codec.embedder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.exclude */ diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/DecoderEmbedder.java b/src/main/java/org/jboss/netty/handler/codec/embedder/DecoderEmbedder.java index 37935c8a0a..23e3ea2496 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/DecoderEmbedder.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/DecoderEmbedder.java @@ -45,7 +45,6 @@ import org.jboss.netty.handler.codec.string.StringDecoder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @see EncoderEmbedder diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannel.java b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannel.java index be9dce2136..c5f2019ed9 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannel.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannel.java @@ -29,7 +29,6 @@ import org.jboss.netty.channel.DefaultChannelConfig; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ class EmbeddedChannel extends AbstractChannel { diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannelFactory.java b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannelFactory.java index ab0c2c3a9d..b4b3b0d831 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannelFactory.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedChannelFactory.java @@ -22,7 +22,6 @@ import org.jboss.netty.channel.ChannelPipeline; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ class EmbeddedChannelFactory implements ChannelFactory { diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedSocketAddress.java b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedSocketAddress.java index e8a949b508..abc647a82c 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedSocketAddress.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/EmbeddedSocketAddress.java @@ -20,7 +20,6 @@ import java.net.SocketAddress; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ class EmbeddedSocketAddress extends SocketAddress { private static final long serialVersionUID = 1400788804624980619L; diff --git a/src/main/java/org/jboss/netty/handler/codec/embedder/EncoderEmbedder.java b/src/main/java/org/jboss/netty/handler/codec/embedder/EncoderEmbedder.java index bd603b3a40..da3cc83c26 100644 --- a/src/main/java/org/jboss/netty/handler/codec/embedder/EncoderEmbedder.java +++ b/src/main/java/org/jboss/netty/handler/codec/embedder/EncoderEmbedder.java @@ -45,7 +45,6 @@ import org.jboss.netty.util.CharsetUtil; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @see DecoderEmbedder diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/CorruptedFrameException.java b/src/main/java/org/jboss/netty/handler/codec/frame/CorruptedFrameException.java index 6be6cf415e..99fbd1fcc1 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/CorruptedFrameException.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/CorruptedFrameException.java @@ -22,8 +22,6 @@ package org.jboss.netty.handler.codec.frame; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.hidden */ public class CorruptedFrameException extends Exception { diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java index 03ce644b61..4bb88a1433 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/DelimiterBasedFrameDecoder.java @@ -58,8 +58,6 @@ import org.jboss.netty.channel.Channels; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.uses org.jboss.netty.handler.codec.frame.Delimiters - - useful */ public class DelimiterBasedFrameDecoder extends FrameDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/Delimiters.java b/src/main/java/org/jboss/netty/handler/codec/frame/Delimiters.java index dd0d00d520..57bfe37daf 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/Delimiters.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/Delimiters.java @@ -24,8 +24,6 @@ import org.jboss.netty.buffer.ChannelBuffers; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * */ public class Delimiters { diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/FixedLengthFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/FixedLengthFrameDecoder.java index da89f11d41..98a3774eff 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/FixedLengthFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/FixedLengthFrameDecoder.java @@ -37,8 +37,6 @@ import org.jboss.netty.channel.ChannelHandlerContext; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ */ public class FixedLengthFrameDecoder extends FrameDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java index a3e173d168..300b6fb510 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java @@ -175,8 +175,6 @@ import org.jboss.netty.handler.codec.replay.ReplayingDecoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.landmark */ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java index 4a6c3b6fca..55851e7672 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java @@ -183,8 +183,6 @@ import org.jboss.netty.handler.codec.serialization.ObjectDecoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @see LengthFieldPrepender */ public class LengthFieldBasedFrameDecoder extends FrameDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldPrepender.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldPrepender.java index a0856a2958..6ae8d57730 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldPrepender.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldPrepender.java @@ -56,7 +56,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ @Sharable public class LengthFieldPrepender extends OneToOneEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/TooLongFrameException.java b/src/main/java/org/jboss/netty/handler/codec/frame/TooLongFrameException.java index 2714685dfb..58d09a0df9 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/TooLongFrameException.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/TooLongFrameException.java @@ -22,8 +22,6 @@ package org.jboss.netty.handler.codec.frame; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.hidden */ public class TooLongFrameException extends Exception { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CaseIgnoringComparator.java b/src/main/java/org/jboss/netty/handler/codec/http/CaseIgnoringComparator.java index 378dba00d5..ae0ab368b7 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CaseIgnoringComparator.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CaseIgnoringComparator.java @@ -22,7 +22,6 @@ import java.util.Comparator; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ final class CaseIgnoringComparator implements Comparator, Serializable { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/Cookie.java b/src/main/java/org/jboss/netty/handler/codec/http/Cookie.java index 1c5ebd49c6..34e0f54b3b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/Cookie.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/Cookie.java @@ -23,7 +23,6 @@ import java.util.Set; * @author The Netty Project * @author Trustin Lee * @author Andy Taylor (andy.taylor@jboss.org) - * @version $Rev$, $Date$ */ public interface Cookie extends Comparable { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java index 3397b28e6a..9db44ff538 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CookieDecoder.java @@ -37,7 +37,6 @@ import java.util.regex.Pattern; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * @see CookieEncoder * * @apiviz.stereotype utility diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CookieEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/CookieEncoder.java index 6a5da2236e..c51fdf157e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CookieEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CookieEncoder.java @@ -45,7 +45,6 @@ import java.util.TreeSet; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * @see CookieDecoder * * @apiviz.stereotype utility diff --git a/src/main/java/org/jboss/netty/handler/codec/http/CookieHeaderNames.java b/src/main/java/org/jboss/netty/handler/codec/http/CookieHeaderNames.java index 5380061ac7..9eb07d0d10 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/CookieHeaderNames.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/CookieHeaderNames.java @@ -19,7 +19,6 @@ package org.jboss.netty.handler.codec.http; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ final class CookieHeaderNames { static final String PATH = "Path"; diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java index d938b21069..52d0f31bc2 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultCookie.java @@ -27,7 +27,6 @@ import java.util.TreeSet; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultCookie implements Cookie { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpChunk.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpChunk.java index f6c898bd4b..a678a45eb2 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpChunk.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpChunk.java @@ -22,7 +22,6 @@ import org.jboss.netty.buffer.ChannelBuffer; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultHttpChunk implements HttpChunk { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpChunkTrailer.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpChunkTrailer.java index c387081839..d9394f19d8 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpChunkTrailer.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpChunkTrailer.java @@ -27,7 +27,6 @@ import org.jboss.netty.buffer.ChannelBuffers; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultHttpChunkTrailer implements HttpChunkTrailer { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java index 611e0ec9f2..77e5930736 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java @@ -29,7 +29,6 @@ import org.jboss.netty.util.internal.StringUtil; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultHttpMessage implements HttpMessage { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpRequest.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpRequest.java index 63d084f27d..597d2d4681 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpRequest.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpRequest.java @@ -23,7 +23,6 @@ import org.jboss.netty.util.internal.StringUtil; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultHttpRequest extends DefaultHttpMessage implements HttpRequest { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpResponse.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpResponse.java index 9f4ddb2d81..0f2a37b0b7 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpResponse.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpResponse.java @@ -23,7 +23,6 @@ import org.jboss.netty.util.internal.StringUtil; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultHttpResponse extends DefaultHttpMessage implements HttpResponse { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpChunk.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpChunk.java index 736099c067..2219725579 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpChunk.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpChunk.java @@ -34,7 +34,6 @@ import org.jboss.netty.channel.ChannelPipeline; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpChunkAggregator.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpChunkAggregator.java index cce7359159..af5a518e8f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpChunkAggregator.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpChunkAggregator.java @@ -50,7 +50,6 @@ import org.jboss.netty.util.CharsetUtil; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.has org.jboss.netty.handler.codec.http.HttpChunk oneway - - filters out diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpChunkTrailer.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpChunkTrailer.java index 103aa7626c..5d4cfa66d7 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpChunkTrailer.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpChunkTrailer.java @@ -24,7 +24,6 @@ import java.util.Set; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface HttpChunkTrailer extends HttpChunk { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java index 15803c2e7e..656d5365d2 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java @@ -36,7 +36,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @see HttpServerCodec * diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java index ae178e6cc8..9b881aa618 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpCodecUtil.java @@ -23,7 +23,6 @@ import org.jboss.netty.util.CharsetUtil; /** * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) - * @version $Rev$, $Date$ */ class HttpCodecUtil { //space ' ' diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentCompressor.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentCompressor.java index 313d38b7ce..4050d3f21b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentCompressor.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentCompressor.java @@ -29,7 +29,6 @@ import org.jboss.netty.handler.codec.embedder.EncoderEmbedder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HttpContentCompressor extends HttpContentEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecoder.java index 569cc2ecbe..15e8dec26b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecoder.java @@ -44,7 +44,6 @@ import org.jboss.netty.handler.codec.embedder.DecoderEmbedder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public abstract class HttpContentDecoder extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecompressor.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecompressor.java index 88e38c68a3..372f57bfec 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecompressor.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentDecompressor.java @@ -27,7 +27,6 @@ import org.jboss.netty.handler.codec.embedder.DecoderEmbedder; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HttpContentDecompressor extends HttpContentDecoder { @Override diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentEncoder.java index a3ff8c662f..b471cdc948 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpContentEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpContentEncoder.java @@ -50,7 +50,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public abstract class HttpContentEncoder extends SimpleChannelHandler { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaderDateFormat.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaderDateFormat.java index 3a90733f31..d22a086277 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaderDateFormat.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaderDateFormat.java @@ -34,7 +34,6 @@ import java.util.TimeZone; * @author The Netty Project * @author Trustin Lee * @author Rogiel Josias Sulzbach - * @version $Rev$, $Date$ */ final class HttpHeaderDateFormat extends SimpleDateFormat { private static final long serialVersionUID = -925286159755905325L; diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java index 3181c89131..8d6f8082b6 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpHeaders.java @@ -31,7 +31,6 @@ import java.util.TreeSet; * * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.stereotype static @@ -43,7 +42,6 @@ public class HttpHeaders { * * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) - * @version $Rev$, $Date$ * * @apiviz.stereotype static */ @@ -318,7 +316,6 @@ public class HttpHeaders { * * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) - * @version $Rev$, $Date$ * * @apiviz.stereotype static */ diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java index ea0820bedb..653c4160e4 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessage.java @@ -31,7 +31,6 @@ import org.jboss.netty.buffer.ChannelBuffers; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @see HttpHeaders * diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java index 87cff2b2c0..dc49176f65 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java @@ -100,7 +100,6 @@ import org.jboss.netty.handler.codec.replay.ReplayingDecoder; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ @@ -120,7 +119,6 @@ public abstract class HttpMessageDecoder extends ReplayingDecoderThe Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.exclude */ diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageEncoder.java index 4c88f1bf84..494530e54f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageEncoder.java @@ -44,7 +44,6 @@ import org.jboss.netty.util.CharsetUtil; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMethod.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMethod.java index 7fd6d4f6da..0f9e70c389 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMethod.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMethod.java @@ -25,7 +25,6 @@ import java.util.Map; * * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) - * @version $Rev$, $Date$ * * @apiviz.exclude */ diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequest.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequest.java index c906d986b6..212622ff7e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequest.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequest.java @@ -28,7 +28,6 @@ package org.jboss.netty.handler.codec.http; * * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) - * @version $Rev$, $Date$ * * @see HttpResponse * @see CookieEncoder diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestDecoder.java index 94ba63bdd1..ce7a68f157 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestDecoder.java @@ -55,7 +55,6 @@ import org.jboss.netty.handler.codec.frame.TooLongFrameException; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HttpRequestDecoder extends HttpMessageDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestEncoder.java index 31f6bab2f3..4e9001bfcc 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpRequestEncoder.java @@ -26,7 +26,6 @@ import org.jboss.netty.buffer.ChannelBuffer; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HttpRequestEncoder extends HttpMessageEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponse.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponse.java index 3b81c20db2..7d8e7b39d0 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponse.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponse.java @@ -27,7 +27,6 @@ package org.jboss.netty.handler.codec.http; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @see HttpRequest * @see CookieEncoder diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseDecoder.java index ff6acc8b9b..1870124c1a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseDecoder.java @@ -84,7 +84,6 @@ import org.jboss.netty.handler.codec.frame.TooLongFrameException; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HttpResponseDecoder extends HttpMessageDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseEncoder.java index ce5ec9a0fc..0caeea2968 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseEncoder.java @@ -26,7 +26,6 @@ import org.jboss.netty.buffer.ChannelBuffer; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HttpResponseEncoder extends HttpMessageEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseStatus.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseStatus.java index b0d54d40ce..480f1eaa25 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseStatus.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpResponseStatus.java @@ -23,7 +23,6 @@ package org.jboss.netty.handler.codec.http; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.exclude */ diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpServerCodec.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpServerCodec.java index 5e524a1f74..d2696bf051 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpServerCodec.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpServerCodec.java @@ -26,7 +26,6 @@ import org.jboss.netty.channel.ChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @see HttpClientCodec * diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpVersion.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpVersion.java index b7e9c2e21d..70c73f8c93 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpVersion.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpVersion.java @@ -26,7 +26,6 @@ import java.util.regex.Pattern; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.exclude */ diff --git a/src/main/java/org/jboss/netty/handler/codec/http/QueryStringDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/QueryStringDecoder.java index 94d2715923..bc99e4ff15 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/QueryStringDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/QueryStringDecoder.java @@ -41,7 +41,6 @@ import org.jboss.netty.util.CharsetUtil; * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee * @author Benoit Sigoure - * @version $Rev$, $Date$ * * @see QueryStringEncoder * diff --git a/src/main/java/org/jboss/netty/handler/codec/http/QueryStringEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/QueryStringEncoder.java index b4106be62b..8f465abbc2 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/QueryStringEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/QueryStringEncoder.java @@ -37,7 +37,6 @@ import java.util.List; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @see QueryStringDecoder * diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocket/DefaultWebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocket/DefaultWebSocketFrame.java index a083473438..ccfb3a1e02 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocket/DefaultWebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocket/DefaultWebSocketFrame.java @@ -24,7 +24,6 @@ import org.jboss.netty.util.CharsetUtil; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultWebSocketFrame implements WebSocketFrame { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrame.java b/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrame.java index 0dc823e591..227f5ff253 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrame.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrame.java @@ -23,7 +23,6 @@ import org.jboss.netty.buffer.ChannelBuffers; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface WebSocketFrame { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrameDecoder.java index 4d221b27ff..e4cb535100 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrameDecoder.java @@ -32,7 +32,6 @@ import org.jboss.netty.handler.codec.replay.VoidEnum; * @author The Netty Project * @author Mike Heath (mheath@apache.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.uses org.jboss.netty.handler.codec.http.websocket.WebSocketFrame diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrameEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrameEncoder.java index 6e872c7147..ace12939da 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrameEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocket/WebSocketFrameEncoder.java @@ -31,7 +31,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * @author The Netty Project * @author Mike Heath (mheath@apache.org) * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.uses org.jboss.netty.handler.codec.http.websocket.WebSocketFrame diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameDecoder.java index c577a38d9a..8e3e215486 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameDecoder.java @@ -32,7 +32,6 @@ import org.jboss.netty.handler.codec.replay.VoidEnum; * @author The Netty Project * @author Mike Heath (mheath@apache.org) * @author Trustin Lee - * @version $Rev: 2342 $, $Date: 2010-07-07 14:07:39 +0900 (Wed, 07 Jul 2010) $ * * @apiviz.landmark * @apiviz.uses org.jboss.netty.handler.codec.http.websocket.WebSocketFrame diff --git a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java index fd0463a36e..8735911d48 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/websocketx/WebSocket00FrameEncoder.java @@ -31,7 +31,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * @author The Netty Project * @author Mike Heath (mheath@apache.org) * @author Trustin Lee - * @version $Rev: 2362 $, $Date: 2010-09-09 19:59:22 +0900 (Thu, 09 Sep 2010) $ * * @apiviz.landmark * @apiviz.uses org.jboss.netty.handler.codec.http.websocket.WebSocketFrame diff --git a/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneDecoder.java b/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneDecoder.java index e75a2e40bc..2c464b239e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneDecoder.java @@ -47,8 +47,6 @@ import org.jboss.netty.handler.codec.frame.FrameDecoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.landmark */ public abstract class OneToOneDecoder implements ChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneEncoder.java b/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneEncoder.java index f99d47ba45..8651094ac5 100644 --- a/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/oneone/OneToOneEncoder.java @@ -44,8 +44,6 @@ import org.jboss.netty.handler.codec.frame.Delimiters; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.landmark */ public abstract class OneToOneEncoder implements ChannelDownstreamHandler { diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufDecoder.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufDecoder.java index 0e87a3cf4c..900918882c 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufDecoder.java @@ -65,8 +65,6 @@ import com.google.protobuf.MessageLite; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.landmark */ @Sharable diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java index 8b7ec49287..8568ca5261 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java @@ -61,8 +61,6 @@ import com.google.protobuf.MessageLite; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.landmark */ @Sharable diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java index 4befc0d812..ff531137f3 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoder.java @@ -41,8 +41,6 @@ import com.google.protobuf.CodedInputStream; * @author The Netty Project * @author Tomasz Blachowicz (tblachowicz@gmail.com) * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class ProtobufVarint32FrameDecoder extends FrameDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java index b5d3129fe2..dfcdbb1bcf 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java @@ -43,7 +43,6 @@ import com.google.protobuf.CodedOutputStream; * @author The Netty Project * @author Tomasz Blachowicz (tblachowicz@gmail.com) * @author Trustin Lee - * @version $Rev$, $Date$ */ @Sharable public class ProtobufVarint32LengthFieldPrepender extends OneToOneEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayError.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayError.java index f902d37073..80b7d69a2b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayError.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayError.java @@ -19,9 +19,6 @@ package org.jboss.netty.handler.codec.replay; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class ReplayError extends Error { diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java index 9b85c8b985..9bacb4578a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoder.java @@ -283,8 +283,6 @@ import org.jboss.netty.handler.codec.frame.FrameDecoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @param * the state type; use {@link VoidEnum} if state management is unused * diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java index 7d61665e3f..79e5b090c9 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderBuffer.java @@ -32,9 +32,6 @@ import org.jboss.netty.buffer.ChannelBuffers; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class ReplayingDecoderBuffer implements ChannelBuffer { diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/UnreplayableOperationException.java b/src/main/java/org/jboss/netty/handler/codec/replay/UnreplayableOperationException.java index ba547feb6b..832d439a68 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/UnreplayableOperationException.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/UnreplayableOperationException.java @@ -24,7 +24,6 @@ import org.jboss.netty.buffer.ChannelBuffer; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class UnreplayableOperationException extends UnsupportedOperationException { diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/UnsafeDynamicChannelBuffer.java b/src/main/java/org/jboss/netty/handler/codec/replay/UnsafeDynamicChannelBuffer.java index 6eba2c0f47..b0ad1bba11 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/UnsafeDynamicChannelBuffer.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/UnsafeDynamicChannelBuffer.java @@ -21,9 +21,6 @@ import org.jboss.netty.buffer.DynamicChannelBuffer; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class UnsafeDynamicChannelBuffer extends DynamicChannelBuffer { diff --git a/src/main/java/org/jboss/netty/handler/codec/replay/VoidEnum.java b/src/main/java/org/jboss/netty/handler/codec/replay/VoidEnum.java index e66d90bc1f..3f6a388a66 100644 --- a/src/main/java/org/jboss/netty/handler/codec/replay/VoidEnum.java +++ b/src/main/java/org/jboss/netty/handler/codec/replay/VoidEnum.java @@ -22,9 +22,6 @@ package org.jboss.netty.handler.codec.replay; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public enum VoidEnum { // No state is defined. diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspHeaders.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspHeaders.java index 206bd36821..26b9b9a7c9 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspHeaders.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspHeaders.java @@ -24,7 +24,6 @@ import org.jboss.netty.handler.codec.http.HttpHeaders; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.exclude * @apiviz.stereotype static @@ -37,7 +36,6 @@ public final class RtspHeaders { * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ */ public static final class Names { /** @@ -226,7 +224,6 @@ public final class RtspHeaders { * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public static final class Values { /** diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageDecoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageDecoder.java index 7cd028a86d..1a67ebe9b7 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageDecoder.java @@ -55,7 +55,6 @@ import org.jboss.netty.handler.codec.http.HttpMessageDecoder; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java index f9f0020a45..72a657360a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMessageEncoder.java @@ -29,7 +29,6 @@ import org.jboss.netty.handler.codec.http.HttpMessageEncoder; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMethods.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMethods.java index 3395c87076..ded116b930 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMethods.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspMethods.java @@ -26,7 +26,6 @@ import org.jboss.netty.handler.codec.http.HttpMethod; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.exclude */ diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestDecoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestDecoder.java index 1fae71db12..08b10f0d96 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestDecoder.java @@ -51,7 +51,6 @@ import org.jboss.netty.handler.codec.http.HttpRequest; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ */ public class RtspRequestDecoder extends RtspMessageDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestEncoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestEncoder.java index 75a37e40cc..86f7db810f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspRequestEncoder.java @@ -26,7 +26,6 @@ import org.jboss.netty.handler.codec.http.HttpRequest; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ */ public class RtspRequestEncoder extends RtspMessageEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseDecoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseDecoder.java index 423dd687bb..02b2e39943 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseDecoder.java @@ -52,7 +52,6 @@ import org.jboss.netty.handler.codec.http.HttpResponseStatus; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ */ public class RtspResponseDecoder extends RtspMessageDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseEncoder.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseEncoder.java index 7b5c8b3ec3..5f0751428e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseEncoder.java @@ -26,7 +26,6 @@ import org.jboss.netty.handler.codec.http.HttpResponse; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ */ public class RtspResponseEncoder extends RtspMessageEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseStatuses.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseStatuses.java index 208b0c6c57..6c4e364d30 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseStatuses.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspResponseStatuses.java @@ -23,7 +23,6 @@ import org.jboss.netty.handler.codec.http.HttpResponseStatus; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.exclude */ diff --git a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspVersions.java b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspVersions.java index 2e0180d4e0..5af416f64e 100644 --- a/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspVersions.java +++ b/src/main/java/org/jboss/netty/handler/codec/rtsp/RtspVersions.java @@ -23,7 +23,6 @@ import org.jboss.netty.handler.codec.http.HttpVersion; * @author The Netty Project * @author Amit Bhayani * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.exclude */ diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java index 2ced2188d4..f48f25f764 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java @@ -25,9 +25,6 @@ import java.io.StreamCorruptedException; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class CompactObjectInputStream extends ObjectInputStream { diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectOutputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectOutputStream.java index 534699143a..c808717abe 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectOutputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectOutputStream.java @@ -23,9 +23,6 @@ import java.io.OutputStream; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class CompactObjectOutputStream extends ObjectOutputStream { diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoder.java index d29585e577..d124fdfb1f 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoder.java @@ -52,8 +52,6 @@ import org.jboss.netty.handler.codec.replay.ReplayingDecoder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ @Deprecated public class CompatibleObjectDecoder extends ReplayingDecoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoderState.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoderState.java index 555515fd3e..e45fa9f409 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoderState.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectDecoderState.java @@ -18,9 +18,6 @@ package org.jboss.netty.handler.codec.serialization; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ enum CompatibleObjectDecoderState { READ_HEADER, diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectEncoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectEncoder.java index f2399281b1..54915bca01 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompatibleObjectEncoder.java @@ -37,8 +37,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ */ public class CompatibleObjectEncoder extends OneToOneEncoder { diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java index 6f73987fe3..663624cf21 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoder.java @@ -36,8 +36,6 @@ import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.has org.jboss.netty.handler.codec.serialization.ObjectDecoderInputStream - - - compatible with */ diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java index 234035bd74..dfd210dbee 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectDecoderInputStream.java @@ -27,9 +27,6 @@ import java.io.StreamCorruptedException; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ObjectDecoderInputStream extends InputStream implements ObjectInput { diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoder.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoder.java index 4f24179753..c490fbcc5a 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoder.java @@ -38,8 +38,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.landmark * @apiviz.has org.jboss.netty.handler.codec.serialization.ObjectEncoderOutputStream - - - compatible with */ diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoderOutputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoderOutputStream.java index 803b1bc778..b4d896ecdb 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoderOutputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/ObjectEncoderOutputStream.java @@ -31,9 +31,6 @@ import org.jboss.netty.buffer.ChannelBuffers; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ObjectEncoderOutputStream extends OutputStream implements ObjectOutput { diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/SwitchableInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/SwitchableInputStream.java index 890ddbeed0..3a795f95dd 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/SwitchableInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/SwitchableInputStream.java @@ -24,9 +24,6 @@ import java.io.InputStream; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ final class SwitchableInputStream extends FilterInputStream { diff --git a/src/main/java/org/jboss/netty/handler/codec/string/StringDecoder.java b/src/main/java/org/jboss/netty/handler/codec/string/StringDecoder.java index f2f67f903c..db5e4f80e3 100644 --- a/src/main/java/org/jboss/netty/handler/codec/string/StringDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/string/StringDecoder.java @@ -56,8 +56,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneDecoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.landmark */ @Sharable diff --git a/src/main/java/org/jboss/netty/handler/codec/string/StringEncoder.java b/src/main/java/org/jboss/netty/handler/codec/string/StringEncoder.java index 7d29d2b4dc..f9c7f05767 100644 --- a/src/main/java/org/jboss/netty/handler/codec/string/StringEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/string/StringEncoder.java @@ -54,8 +54,6 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; * @author The Netty Project * @author Trustin Lee * - * @version $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $ - * * @apiviz.landmark */ @Sharable diff --git a/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnable.java b/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnable.java index b33677b3df..e81aea2cfc 100644 --- a/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnable.java +++ b/src/main/java/org/jboss/netty/handler/execution/ChannelEventRunnable.java @@ -28,9 +28,6 @@ import org.jboss.netty.util.EstimatableObjectWrapper; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ChannelEventRunnable implements Runnable, EstimatableObjectWrapper { diff --git a/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java b/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java index 16b63c8fe2..7af50ecfd6 100644 --- a/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java +++ b/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java @@ -105,8 +105,6 @@ import org.jboss.netty.util.internal.ExecutorUtil; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.has java.util.concurrent.ThreadPoolExecutor */ diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index b56969fe6e..83672b58e7 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -127,8 +127,6 @@ import org.jboss.netty.util.internal.SharedResourceMisuseDetector; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.has org.jboss.netty.util.ObjectSizeEstimator oneway - - * @apiviz.has org.jboss.netty.handler.execution.ChannelEventRunnable oneway - - executes */ diff --git a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java index 6d03fb029c..e0f3976ba5 100644 --- a/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/OrderedMemoryAwareThreadPoolExecutor.java @@ -131,8 +131,6 @@ import org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap; * @author Trustin Lee * @author David M. Lloyd (david.lloyd@redhat.com) * - * @version $Rev$, $Date$ - * * @apiviz.landmark */ public class OrderedMemoryAwareThreadPoolExecutor extends diff --git a/src/main/java/org/jboss/netty/handler/logging/LoggingHandler.java b/src/main/java/org/jboss/netty/handler/logging/LoggingHandler.java index 9da46e4595..de42e9cadf 100644 --- a/src/main/java/org/jboss/netty/handler/logging/LoggingHandler.java +++ b/src/main/java/org/jboss/netty/handler/logging/LoggingHandler.java @@ -38,7 +38,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/handler/queue/BlockingReadHandler.java b/src/main/java/org/jboss/netty/handler/queue/BlockingReadHandler.java index b5c4f77e7b..aa2cb9f835 100644 --- a/src/main/java/org/jboss/netty/handler/queue/BlockingReadHandler.java +++ b/src/main/java/org/jboss/netty/handler/queue/BlockingReadHandler.java @@ -73,7 +73,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class BlockingReadHandler extends SimpleChannelUpstreamHandler { diff --git a/src/main/java/org/jboss/netty/handler/queue/BlockingReadTimeoutException.java b/src/main/java/org/jboss/netty/handler/queue/BlockingReadTimeoutException.java index d265e41a45..96a92c6f69 100644 --- a/src/main/java/org/jboss/netty/handler/queue/BlockingReadTimeoutException.java +++ b/src/main/java/org/jboss/netty/handler/queue/BlockingReadTimeoutException.java @@ -24,7 +24,6 @@ import java.io.InterruptedIOException; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class BlockingReadTimeoutException extends InterruptedIOException { diff --git a/src/main/java/org/jboss/netty/handler/queue/BufferedWriteHandler.java b/src/main/java/org/jboss/netty/handler/queue/BufferedWriteHandler.java index 56ee069670..f9d7a8d8bd 100644 --- a/src/main/java/org/jboss/netty/handler/queue/BufferedWriteHandler.java +++ b/src/main/java/org/jboss/netty/handler/queue/BufferedWriteHandler.java @@ -157,7 +157,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/handler/ssl/ImmediateExecutor.java b/src/main/java/org/jboss/netty/handler/ssl/ImmediateExecutor.java index f07a059c6e..d92ad7db70 100644 --- a/src/main/java/org/jboss/netty/handler/ssl/ImmediateExecutor.java +++ b/src/main/java/org/jboss/netty/handler/ssl/ImmediateExecutor.java @@ -22,9 +22,6 @@ import java.util.concurrent.Executor; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ final class ImmediateExecutor implements Executor { diff --git a/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java b/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java index c7c05cd4fb..bdbd411eb2 100644 --- a/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java +++ b/src/main/java/org/jboss/netty/handler/ssl/SslBufferPool.java @@ -35,8 +35,6 @@ import javax.net.ssl.SSLEngine; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SslBufferPool { diff --git a/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java b/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java index 7e151f0c97..968da0e049 100644 --- a/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java +++ b/src/main/java/org/jboss/netty/handler/ssl/SslHandler.java @@ -149,8 +149,6 @@ import org.jboss.netty.util.internal.NonReentrantLock; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.uses org.jboss.netty.handler.ssl.SslBufferPool */ diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java index cd754e2550..6bdcff563d 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java @@ -32,7 +32,6 @@ import org.jboss.netty.channel.FileRegion; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class ChunkedFile implements ChunkedInput { diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedInput.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedInput.java index 6274a44b58..830d5b1189 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedInput.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedInput.java @@ -22,7 +22,6 @@ import org.jboss.netty.buffer.ChannelBuffer; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedNioFile.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedNioFile.java index b5387a0e91..0f60620c00 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedNioFile.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedNioFile.java @@ -36,7 +36,6 @@ import org.jboss.netty.channel.FileRegion; * @author The Netty Project * @author Trustin Lee * @author Frederic Bregier - * @version $Rev$, $Date$ */ public class ChunkedNioFile implements ChunkedInput { diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedNioStream.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedNioStream.java index c07a90cb4a..0b7a78bada 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedNioStream.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedNioStream.java @@ -30,7 +30,6 @@ import org.jboss.netty.buffer.ChannelBuffer; * @author The Netty Project * @author Trustin Lee * @author Frederic Bregier - * @version $Rev$, $Date$ */ public class ChunkedNioStream implements ChunkedInput { diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedStream.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedStream.java index b769da58bf..7b25f058b8 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedStream.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedStream.java @@ -32,7 +32,6 @@ import java.io.PushbackInputStream; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class ChunkedStream implements ChunkedInput { diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java index cb9edd0a4a..81259816a4 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java @@ -70,7 +70,6 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.has org.jboss.netty.handler.stream.ChunkedInput oneway - - reads from diff --git a/src/main/java/org/jboss/netty/handler/timeout/DefaultIdleStateEvent.java b/src/main/java/org/jboss/netty/handler/timeout/DefaultIdleStateEvent.java index 53426d6dcc..c45537b2ce 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/DefaultIdleStateEvent.java +++ b/src/main/java/org/jboss/netty/handler/timeout/DefaultIdleStateEvent.java @@ -29,7 +29,6 @@ import org.jboss.netty.channel.ChannelFuture; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultIdleStateEvent implements IdleStateEvent { diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleState.java b/src/main/java/org/jboss/netty/handler/timeout/IdleState.java index da828033db..c875ccf78e 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleState.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleState.java @@ -23,7 +23,6 @@ import org.jboss.netty.channel.Channel; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public enum IdleState { /** diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelHandler.java b/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelHandler.java index fe61cfd0ef..fe85620994 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelHandler.java @@ -26,7 +26,6 @@ import org.jboss.netty.channel.SimpleChannelHandler; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.uses org.jboss.netty.handler.timeout.IdleStateEvent */ diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelUpstreamHandler.java b/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelUpstreamHandler.java index e66a3bf0f5..23694ae03f 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelUpstreamHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleStateAwareChannelUpstreamHandler.java @@ -26,7 +26,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.uses org.jboss.netty.handler.timeout.IdleStateEvent */ diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleStateEvent.java b/src/main/java/org/jboss/netty/handler/timeout/IdleStateEvent.java index 1e3c8450e4..195d1d4c74 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleStateEvent.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleStateEvent.java @@ -24,7 +24,6 @@ import org.jboss.netty.channel.ChannelEvent; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.has org.jboss.netty.handler.timeout.IdleState oneway - - diff --git a/src/main/java/org/jboss/netty/handler/timeout/IdleStateHandler.java b/src/main/java/org/jboss/netty/handler/timeout/IdleStateHandler.java index 6392949450..2c7aa4ad4a 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/IdleStateHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/IdleStateHandler.java @@ -115,7 +115,6 @@ import org.jboss.netty.util.TimerTask; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @see ReadTimeoutHandler * @see WriteTimeoutHandler diff --git a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutException.java b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutException.java index 6cf2f5152f..e2e5644707 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutException.java +++ b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutException.java @@ -21,7 +21,6 @@ package org.jboss.netty.handler.timeout; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class ReadTimeoutException extends TimeoutException { diff --git a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java index 486b0f22c2..fbb28a388c 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/ReadTimeoutHandler.java @@ -72,7 +72,6 @@ import org.jboss.netty.util.TimerTask; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @see WriteTimeoutHandler * @see IdleStateHandler diff --git a/src/main/java/org/jboss/netty/handler/timeout/TimeoutException.java b/src/main/java/org/jboss/netty/handler/timeout/TimeoutException.java index 82dfb2f884..3fce063ae9 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/TimeoutException.java +++ b/src/main/java/org/jboss/netty/handler/timeout/TimeoutException.java @@ -23,7 +23,6 @@ import org.jboss.netty.channel.ChannelException; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class TimeoutException extends ChannelException { diff --git a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutException.java b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutException.java index 9bdf89f20c..faff7f0408 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutException.java +++ b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutException.java @@ -22,7 +22,6 @@ package org.jboss.netty.handler.timeout; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class WriteTimeoutException extends TimeoutException { diff --git a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java index 9356554a48..aa318bd236 100644 --- a/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java +++ b/src/main/java/org/jboss/netty/handler/timeout/WriteTimeoutHandler.java @@ -68,7 +68,6 @@ import org.jboss.netty.util.TimerTask; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @see ReadTimeoutHandler * @see IdleStateHandler @@ -197,7 +196,6 @@ public class WriteTimeoutHandler extends SimpleChannelDownstreamHandler /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ private static final class TimeoutCanceller implements ChannelFutureListener { private final Timeout timeout; diff --git a/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java b/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java index f22439f2ca..3268fcce62 100644 --- a/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java +++ b/src/main/java/org/jboss/netty/handler/traffic/AbstractTrafficShapingHandler.java @@ -56,7 +56,6 @@ import org.jboss.netty.util.internal.ExecutorUtil; * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Frederic Bregier - * @version $Rev: 1832 $, $Date: 2009-10-25 19:53:54 +0900 (Sun, 25 Oct 2009) $ */ public abstract class AbstractTrafficShapingHandler extends SimpleChannelHandler implements ExternalResourceReleasable { diff --git a/src/main/java/org/jboss/netty/handler/traffic/GlobalTrafficShapingHandler.java b/src/main/java/org/jboss/netty/handler/traffic/GlobalTrafficShapingHandler.java index 60bec40dcb..8676a788c8 100644 --- a/src/main/java/org/jboss/netty/handler/traffic/GlobalTrafficShapingHandler.java +++ b/src/main/java/org/jboss/netty/handler/traffic/GlobalTrafficShapingHandler.java @@ -60,7 +60,6 @@ import org.jboss.netty.util.ObjectSizeEstimator; * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Frederic Bregier - * @version $Rev: 1794 $, $Date: 2009-10-20 14:20:28 +0900 (Tue, 20 Oct 2009) $ */ @Sharable public class GlobalTrafficShapingHandler extends AbstractTrafficShapingHandler { diff --git a/src/main/java/org/jboss/netty/handler/traffic/TrafficCounter.java b/src/main/java/org/jboss/netty/handler/traffic/TrafficCounter.java index 5ac7214621..235bba38a3 100644 --- a/src/main/java/org/jboss/netty/handler/traffic/TrafficCounter.java +++ b/src/main/java/org/jboss/netty/handler/traffic/TrafficCounter.java @@ -32,7 +32,6 @@ import org.jboss.netty.channel.ChannelHandlerContext; * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Frederic Bregier - * @version $Rev: 1794 $, $Date: 2009-10-20 14:20:28 +0900 (Tue, 20 Oct 2009) $ */ public class TrafficCounter { /** diff --git a/src/main/java/org/jboss/netty/logging/AbstractInternalLogger.java b/src/main/java/org/jboss/netty/logging/AbstractInternalLogger.java index 84d6bb27d7..45bc9e0a67 100644 --- a/src/main/java/org/jboss/netty/logging/AbstractInternalLogger.java +++ b/src/main/java/org/jboss/netty/logging/AbstractInternalLogger.java @@ -22,7 +22,6 @@ package org.jboss.netty.logging; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public abstract class AbstractInternalLogger implements InternalLogger { diff --git a/src/main/java/org/jboss/netty/logging/CommonsLogger.java b/src/main/java/org/jboss/netty/logging/CommonsLogger.java index bdeb996fe4..3e08195101 100644 --- a/src/main/java/org/jboss/netty/logging/CommonsLogger.java +++ b/src/main/java/org/jboss/netty/logging/CommonsLogger.java @@ -23,9 +23,6 @@ import org.apache.commons.logging.Log; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class CommonsLogger extends AbstractInternalLogger { diff --git a/src/main/java/org/jboss/netty/logging/CommonsLoggerFactory.java b/src/main/java/org/jboss/netty/logging/CommonsLoggerFactory.java index 599a15c14d..f6603f9df0 100644 --- a/src/main/java/org/jboss/netty/logging/CommonsLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/CommonsLoggerFactory.java @@ -24,9 +24,6 @@ package org.jboss.netty.logging; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class CommonsLoggerFactory extends InternalLoggerFactory { diff --git a/src/main/java/org/jboss/netty/logging/InternalLogLevel.java b/src/main/java/org/jboss/netty/logging/InternalLogLevel.java index ff08b8461f..ec2cebf15f 100644 --- a/src/main/java/org/jboss/netty/logging/InternalLogLevel.java +++ b/src/main/java/org/jboss/netty/logging/InternalLogLevel.java @@ -20,7 +20,6 @@ package org.jboss.netty.logging; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public enum InternalLogLevel { /** diff --git a/src/main/java/org/jboss/netty/logging/InternalLogger.java b/src/main/java/org/jboss/netty/logging/InternalLogger.java index c51333ab7f..0ccedd6d46 100644 --- a/src/main/java/org/jboss/netty/logging/InternalLogger.java +++ b/src/main/java/org/jboss/netty/logging/InternalLogger.java @@ -21,8 +21,6 @@ package org.jboss.netty.logging; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public interface InternalLogger { /** diff --git a/src/main/java/org/jboss/netty/logging/InternalLoggerFactory.java b/src/main/java/org/jboss/netty/logging/InternalLoggerFactory.java index fe33b5f160..9e1fe8bed8 100644 --- a/src/main/java/org/jboss/netty/logging/InternalLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/InternalLoggerFactory.java @@ -34,8 +34,6 @@ import org.jboss.netty.util.internal.StackTraceSimplifier; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.has org.jboss.netty.logging.InternalLogger oneway - - creates */ diff --git a/src/main/java/org/jboss/netty/logging/JBossLogger.java b/src/main/java/org/jboss/netty/logging/JBossLogger.java index 940b0c7147..9c8f4382c3 100644 --- a/src/main/java/org/jboss/netty/logging/JBossLogger.java +++ b/src/main/java/org/jboss/netty/logging/JBossLogger.java @@ -23,9 +23,6 @@ import org.jboss.logging.Logger; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class JBossLogger extends AbstractInternalLogger { diff --git a/src/main/java/org/jboss/netty/logging/JBossLoggerFactory.java b/src/main/java/org/jboss/netty/logging/JBossLoggerFactory.java index 1d59af4b4e..d017ba63b7 100644 --- a/src/main/java/org/jboss/netty/logging/JBossLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/JBossLoggerFactory.java @@ -24,9 +24,6 @@ package org.jboss.netty.logging; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class JBossLoggerFactory extends InternalLoggerFactory { diff --git a/src/main/java/org/jboss/netty/logging/JdkLogger.java b/src/main/java/org/jboss/netty/logging/JdkLogger.java index 920c468027..63103600c8 100644 --- a/src/main/java/org/jboss/netty/logging/JdkLogger.java +++ b/src/main/java/org/jboss/netty/logging/JdkLogger.java @@ -24,9 +24,6 @@ import java.util.logging.Logger; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class JdkLogger extends AbstractInternalLogger { diff --git a/src/main/java/org/jboss/netty/logging/JdkLoggerFactory.java b/src/main/java/org/jboss/netty/logging/JdkLoggerFactory.java index 3f08e10dce..d801d0492f 100644 --- a/src/main/java/org/jboss/netty/logging/JdkLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/JdkLoggerFactory.java @@ -23,9 +23,6 @@ package org.jboss.netty.logging; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class JdkLoggerFactory extends InternalLoggerFactory { diff --git a/src/main/java/org/jboss/netty/logging/Log4JLogger.java b/src/main/java/org/jboss/netty/logging/Log4JLogger.java index bcd4c246dd..d7e0ef6235 100644 --- a/src/main/java/org/jboss/netty/logging/Log4JLogger.java +++ b/src/main/java/org/jboss/netty/logging/Log4JLogger.java @@ -23,9 +23,6 @@ import org.apache.log4j.Logger; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class Log4JLogger extends AbstractInternalLogger { diff --git a/src/main/java/org/jboss/netty/logging/Log4JLoggerFactory.java b/src/main/java/org/jboss/netty/logging/Log4JLoggerFactory.java index 7e4f89bf9b..5d33d3afcd 100644 --- a/src/main/java/org/jboss/netty/logging/Log4JLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/Log4JLoggerFactory.java @@ -25,8 +25,6 @@ package org.jboss.netty.logging; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * */ public class Log4JLoggerFactory extends InternalLoggerFactory { diff --git a/src/main/java/org/jboss/netty/logging/OsgiLogger.java b/src/main/java/org/jboss/netty/logging/OsgiLogger.java index 21117fd49c..e4f3650fe3 100644 --- a/src/main/java/org/jboss/netty/logging/OsgiLogger.java +++ b/src/main/java/org/jboss/netty/logging/OsgiLogger.java @@ -22,9 +22,6 @@ import org.osgi.service.log.LogService; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class OsgiLogger extends AbstractInternalLogger { diff --git a/src/main/java/org/jboss/netty/logging/OsgiLoggerFactory.java b/src/main/java/org/jboss/netty/logging/OsgiLoggerFactory.java index 8db1f72d15..29979c05cd 100644 --- a/src/main/java/org/jboss/netty/logging/OsgiLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/OsgiLoggerFactory.java @@ -26,9 +26,6 @@ import org.osgi.util.tracker.ServiceTracker; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OsgiLoggerFactory extends InternalLoggerFactory { diff --git a/src/main/java/org/jboss/netty/logging/Slf4JLogger.java b/src/main/java/org/jboss/netty/logging/Slf4JLogger.java index a5e8db0c91..4ed1107d12 100644 --- a/src/main/java/org/jboss/netty/logging/Slf4JLogger.java +++ b/src/main/java/org/jboss/netty/logging/Slf4JLogger.java @@ -22,9 +22,6 @@ import org.slf4j.Logger; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ class Slf4JLogger extends AbstractInternalLogger { diff --git a/src/main/java/org/jboss/netty/logging/Slf4JLoggerFactory.java b/src/main/java/org/jboss/netty/logging/Slf4JLoggerFactory.java index 0d7ed1ce29..b98b9fbaca 100644 --- a/src/main/java/org/jboss/netty/logging/Slf4JLoggerFactory.java +++ b/src/main/java/org/jboss/netty/logging/Slf4JLoggerFactory.java @@ -23,9 +23,6 @@ package org.jboss.netty.logging; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class Slf4JLoggerFactory extends InternalLoggerFactory { diff --git a/src/main/java/org/jboss/netty/util/CharsetUtil.java b/src/main/java/org/jboss/netty/util/CharsetUtil.java index 7997c980ec..628ede83c4 100644 --- a/src/main/java/org/jboss/netty/util/CharsetUtil.java +++ b/src/main/java/org/jboss/netty/util/CharsetUtil.java @@ -28,7 +28,6 @@ import java.util.Map; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class CharsetUtil { diff --git a/src/main/java/org/jboss/netty/util/DebugUtil.java b/src/main/java/org/jboss/netty/util/DebugUtil.java index de95382738..e1c98c48b2 100644 --- a/src/main/java/org/jboss/netty/util/DebugUtil.java +++ b/src/main/java/org/jboss/netty/util/DebugUtil.java @@ -34,8 +34,6 @@ import org.jboss.netty.util.internal.SystemPropertyUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DebugUtil { diff --git a/src/main/java/org/jboss/netty/util/DefaultObjectSizeEstimator.java b/src/main/java/org/jboss/netty/util/DefaultObjectSizeEstimator.java index 7035f73c23..03372dd0b5 100644 --- a/src/main/java/org/jboss/netty/util/DefaultObjectSizeEstimator.java +++ b/src/main/java/org/jboss/netty/util/DefaultObjectSizeEstimator.java @@ -31,9 +31,6 @@ import org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DefaultObjectSizeEstimator implements ObjectSizeEstimator { diff --git a/src/main/java/org/jboss/netty/util/EstimatableObjectWrapper.java b/src/main/java/org/jboss/netty/util/EstimatableObjectWrapper.java index ec482b0f4c..993ed8bb76 100644 --- a/src/main/java/org/jboss/netty/util/EstimatableObjectWrapper.java +++ b/src/main/java/org/jboss/netty/util/EstimatableObjectWrapper.java @@ -22,7 +22,6 @@ package org.jboss.netty.util; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface EstimatableObjectWrapper { diff --git a/src/main/java/org/jboss/netty/util/ExternalResourceReleasable.java b/src/main/java/org/jboss/netty/util/ExternalResourceReleasable.java index 12036e746a..fcfb108813 100644 --- a/src/main/java/org/jboss/netty/util/ExternalResourceReleasable.java +++ b/src/main/java/org/jboss/netty/util/ExternalResourceReleasable.java @@ -21,7 +21,6 @@ package org.jboss.netty.util; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/util/ExternalResourceUtil.java b/src/main/java/org/jboss/netty/util/ExternalResourceUtil.java index cf154b7fad..827be182d5 100644 --- a/src/main/java/org/jboss/netty/util/ExternalResourceUtil.java +++ b/src/main/java/org/jboss/netty/util/ExternalResourceUtil.java @@ -21,7 +21,6 @@ package org.jboss.netty.util; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class ExternalResourceUtil { diff --git a/src/main/java/org/jboss/netty/util/HashedWheelTimer.java b/src/main/java/org/jboss/netty/util/HashedWheelTimer.java index 53d056c65f..d92680c629 100644 --- a/src/main/java/org/jboss/netty/util/HashedWheelTimer.java +++ b/src/main/java/org/jboss/netty/util/HashedWheelTimer.java @@ -80,7 +80,6 @@ import org.jboss.netty.util.internal.SharedResourceMisuseDetector; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class HashedWheelTimer implements Timer { diff --git a/src/main/java/org/jboss/netty/util/MapBackedSet.java b/src/main/java/org/jboss/netty/util/MapBackedSet.java index 626eca5d7f..db889ee0b7 100644 --- a/src/main/java/org/jboss/netty/util/MapBackedSet.java +++ b/src/main/java/org/jboss/netty/util/MapBackedSet.java @@ -26,8 +26,6 @@ import java.util.Set; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ final class MapBackedSet extends AbstractSet implements Serializable { diff --git a/src/main/java/org/jboss/netty/util/ObjectSizeEstimator.java b/src/main/java/org/jboss/netty/util/ObjectSizeEstimator.java index b3553f971a..11b2df1d45 100644 --- a/src/main/java/org/jboss/netty/util/ObjectSizeEstimator.java +++ b/src/main/java/org/jboss/netty/util/ObjectSizeEstimator.java @@ -22,8 +22,6 @@ package org.jboss.netty.util; * @author The Netty Project * @author Trustin Lee * - * @version $Rev$, $Date$ - * * @apiviz.landmark * @apiviz.uses org.jboss.netty.util.EstimatableObjectWrapper */ diff --git a/src/main/java/org/jboss/netty/util/Timeout.java b/src/main/java/org/jboss/netty/util/Timeout.java index 30d254ff84..56459b76d6 100644 --- a/src/main/java/org/jboss/netty/util/Timeout.java +++ b/src/main/java/org/jboss/netty/util/Timeout.java @@ -21,7 +21,6 @@ package org.jboss.netty.util; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface Timeout { diff --git a/src/main/java/org/jboss/netty/util/Timer.java b/src/main/java/org/jboss/netty/util/Timer.java index dbc99081ef..ce11f44733 100644 --- a/src/main/java/org/jboss/netty/util/Timer.java +++ b/src/main/java/org/jboss/netty/util/Timer.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark * @apiviz.has org.jboss.netty.util.TimerTask oneway - - executes diff --git a/src/main/java/org/jboss/netty/util/TimerTask.java b/src/main/java/org/jboss/netty/util/TimerTask.java index 7832956c79..ce5453972b 100644 --- a/src/main/java/org/jboss/netty/util/TimerTask.java +++ b/src/main/java/org/jboss/netty/util/TimerTask.java @@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface TimerTask { diff --git a/src/main/java/org/jboss/netty/util/VirtualExecutorService.java b/src/main/java/org/jboss/netty/util/VirtualExecutorService.java index 7f6f586cdf..f25966080e 100644 --- a/src/main/java/org/jboss/netty/util/VirtualExecutorService.java +++ b/src/main/java/org/jboss/netty/util/VirtualExecutorService.java @@ -74,7 +74,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ * * @apiviz.landmark */ diff --git a/src/main/java/org/jboss/netty/util/internal/AtomicFieldUpdaterUtil.java b/src/main/java/org/jboss/netty/util/internal/AtomicFieldUpdaterUtil.java index dc57f99cbb..d0f9f8f72a 100644 --- a/src/main/java/org/jboss/netty/util/internal/AtomicFieldUpdaterUtil.java +++ b/src/main/java/org/jboss/netty/util/internal/AtomicFieldUpdaterUtil.java @@ -21,7 +21,6 @@ import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ class AtomicFieldUpdaterUtil { diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java index c8cc4854f6..006894c1cb 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentHashMap.java @@ -43,7 +43,6 @@ import java.util.concurrent.locks.ReentrantLock; * @author Doug Lea * @author Jason T. Greene * @author Trustin Lee - * @version $Rev$, $Date$ * * @param the type of keys maintained by this map * @param the type of mapped values diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java index 7f82088dca..a6a653453d 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityHashMap.java @@ -43,7 +43,6 @@ import java.util.concurrent.locks.ReentrantLock; * @author Doug Lea * @author Jason T. Greene * @author Trustin Lee - * @version $Rev$, $Date$ * * @param the type of keys maintained by this map * @param the type of mapped values diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java index 4df097d353..11f88cd2fe 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentIdentityWeakKeyHashMap.java @@ -46,7 +46,6 @@ import java.util.concurrent.locks.ReentrantLock; * @author Doug Lea * @author Jason T. Greene * @author Trustin Lee - * @version $Rev$, $Date$ * * @param the type of keys maintained by this map * @param the type of mapped values diff --git a/src/main/java/org/jboss/netty/util/internal/ConcurrentWeakKeyHashMap.java b/src/main/java/org/jboss/netty/util/internal/ConcurrentWeakKeyHashMap.java index 5dad915d70..88f18cdf08 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConcurrentWeakKeyHashMap.java +++ b/src/main/java/org/jboss/netty/util/internal/ConcurrentWeakKeyHashMap.java @@ -46,7 +46,6 @@ import java.util.concurrent.locks.ReentrantLock; * @author Doug Lea * @author Jason T. Greene * @author Trustin Lee - * @version $Rev$, $Date$ * * @param the type of keys maintained by this map * @param the type of mapped values diff --git a/src/main/java/org/jboss/netty/util/internal/ConversionUtil.java b/src/main/java/org/jboss/netty/util/internal/ConversionUtil.java index 9bb7c5a173..6402de0882 100644 --- a/src/main/java/org/jboss/netty/util/internal/ConversionUtil.java +++ b/src/main/java/org/jboss/netty/util/internal/ConversionUtil.java @@ -24,9 +24,6 @@ import java.util.List; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ConversionUtil { diff --git a/src/main/java/org/jboss/netty/util/internal/DeadLockProofWorker.java b/src/main/java/org/jboss/netty/util/internal/DeadLockProofWorker.java index 48593af238..82a0b27f07 100644 --- a/src/main/java/org/jboss/netty/util/internal/DeadLockProofWorker.java +++ b/src/main/java/org/jboss/netty/util/internal/DeadLockProofWorker.java @@ -19,7 +19,6 @@ import java.util.concurrent.Executor; /** * @author Trustin Lee - * @version $Rev$, $Date$ */ public final class DeadLockProofWorker { diff --git a/src/main/java/org/jboss/netty/util/internal/ExecutorUtil.java b/src/main/java/org/jboss/netty/util/internal/ExecutorUtil.java index b6355fcfba..71e59c59d9 100644 --- a/src/main/java/org/jboss/netty/util/internal/ExecutorUtil.java +++ b/src/main/java/org/jboss/netty/util/internal/ExecutorUtil.java @@ -27,7 +27,6 @@ import java.util.concurrent.TimeUnit; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class ExecutorUtil { diff --git a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java index 57149985ca..d7c821f061 100644 --- a/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java +++ b/src/main/java/org/jboss/netty/util/internal/LinkedTransferQueue.java @@ -63,7 +63,6 @@ import java.util.concurrent.locks.LockSupport; * @author The Netty Project * @author Doug Lea * @author Trustin Lee - * @version $Rev$, $Date$ (Upstream: 1.79) * * @param the type of elements held in this collection */ diff --git a/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java b/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java index bc05add136..61b6e8add8 100644 --- a/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java +++ b/src/main/java/org/jboss/netty/util/internal/NonReentrantLock.java @@ -23,7 +23,6 @@ import java.util.concurrent.locks.Lock; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public final class NonReentrantLock extends AbstractQueuedSynchronizer implements Lock { diff --git a/src/main/java/org/jboss/netty/util/internal/ReusableIterator.java b/src/main/java/org/jboss/netty/util/internal/ReusableIterator.java index 6c3b44d36d..98468ca923 100644 --- a/src/main/java/org/jboss/netty/util/internal/ReusableIterator.java +++ b/src/main/java/org/jboss/netty/util/internal/ReusableIterator.java @@ -20,7 +20,6 @@ import java.util.Iterator; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public interface ReusableIterator extends Iterator { void rewind(); diff --git a/src/main/java/org/jboss/netty/util/internal/SharedResourceMisuseDetector.java b/src/main/java/org/jboss/netty/util/internal/SharedResourceMisuseDetector.java index f42d21b5a6..4f9c9458ac 100644 --- a/src/main/java/org/jboss/netty/util/internal/SharedResourceMisuseDetector.java +++ b/src/main/java/org/jboss/netty/util/internal/SharedResourceMisuseDetector.java @@ -26,7 +26,6 @@ import org.jboss.netty.logging.InternalLoggerFactory; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class SharedResourceMisuseDetector { diff --git a/src/main/java/org/jboss/netty/util/internal/StackTraceSimplifier.java b/src/main/java/org/jboss/netty/util/internal/StackTraceSimplifier.java index 10ff1f9f73..ff7ba2c512 100644 --- a/src/main/java/org/jboss/netty/util/internal/StackTraceSimplifier.java +++ b/src/main/java/org/jboss/netty/util/internal/StackTraceSimplifier.java @@ -31,9 +31,6 @@ import org.jboss.netty.util.DebugUtil; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class StackTraceSimplifier { diff --git a/src/main/java/org/jboss/netty/util/internal/StringUtil.java b/src/main/java/org/jboss/netty/util/internal/StringUtil.java index 42d1bc985e..d544055e20 100644 --- a/src/main/java/org/jboss/netty/util/internal/StringUtil.java +++ b/src/main/java/org/jboss/netty/util/internal/StringUtil.java @@ -22,7 +22,6 @@ import java.util.Formatter; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class StringUtil { diff --git a/src/main/java/org/jboss/netty/util/internal/SystemPropertyUtil.java b/src/main/java/org/jboss/netty/util/internal/SystemPropertyUtil.java index 1c7dd383ad..01518ae060 100644 --- a/src/main/java/org/jboss/netty/util/internal/SystemPropertyUtil.java +++ b/src/main/java/org/jboss/netty/util/internal/SystemPropertyUtil.java @@ -22,9 +22,6 @@ import java.util.regex.Pattern; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class SystemPropertyUtil { diff --git a/src/main/java/org/jboss/netty/util/internal/ThreadLocalBoolean.java b/src/main/java/org/jboss/netty/util/internal/ThreadLocalBoolean.java index 4f65f828b0..fb98feb752 100644 --- a/src/main/java/org/jboss/netty/util/internal/ThreadLocalBoolean.java +++ b/src/main/java/org/jboss/netty/util/internal/ThreadLocalBoolean.java @@ -18,7 +18,6 @@ package org.jboss.netty.util.internal; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class ThreadLocalBoolean extends ThreadLocal { diff --git a/src/main/java/org/jboss/netty/util/internal/UnterminatableExecutor.java b/src/main/java/org/jboss/netty/util/internal/UnterminatableExecutor.java index 37dfda8bef..7cb6bb4464 100644 --- a/src/main/java/org/jboss/netty/util/internal/UnterminatableExecutor.java +++ b/src/main/java/org/jboss/netty/util/internal/UnterminatableExecutor.java @@ -22,7 +22,6 @@ import java.util.concurrent.Executor; * * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class UnterminatableExecutor implements Executor { diff --git a/src/test/java/org/jboss/netty/bootstrap/AbstractSocketClientBootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/AbstractSocketClientBootstrapTest.java index 4003f2d069..e6fc5711c0 100644 --- a/src/test/java/org/jboss/netty/bootstrap/AbstractSocketClientBootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/AbstractSocketClientBootstrapTest.java @@ -38,11 +38,10 @@ import org.junit.Test; /** + * An abstract test class to test socket client bootstraps + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractSocketClientBootstrapTest { diff --git a/src/test/java/org/jboss/netty/bootstrap/AbstractSocketServerBootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/AbstractSocketServerBootstrapTest.java index 3d7a5845b5..92dd22bad5 100644 --- a/src/test/java/org/jboss/netty/bootstrap/AbstractSocketServerBootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/AbstractSocketServerBootstrapTest.java @@ -45,11 +45,10 @@ import org.junit.Test; /** + * An abstract test class to test server socket bootstraps + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractSocketServerBootstrapTest { diff --git a/src/test/java/org/jboss/netty/bootstrap/BootstrapOrderedMapTest.java b/src/test/java/org/jboss/netty/bootstrap/BootstrapOrderedMapTest.java index 2e134133eb..a55cff404e 100644 --- a/src/test/java/org/jboss/netty/bootstrap/BootstrapOrderedMapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/BootstrapOrderedMapTest.java @@ -27,11 +27,10 @@ import org.junit.Test; /** + * A test to make sure that a bootstrap can recognize ordered maps + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class BootstrapOrderedMapTest { diff --git a/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java index 86daaada3d..0280363f72 100644 --- a/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/BootstrapTest.java @@ -34,71 +34,112 @@ import org.junit.Test; /** + * A bootstrap test + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class BootstrapTest { + + /** + * Tests to make sure that a new bootstrap should not return null, but an IllegalStateException + */ @Test(expected = IllegalStateException.class) public void shouldNotReturnNullFactory() { new Bootstrap().getFactory(); } + /** + * Tests to make sure that a new bootstrap cannot have it's channel factory changed + */ @Test(expected = IllegalStateException.class) public void shouldNotAllowInitialFactoryToChange() { new Bootstrap(createMock(ChannelFactory.class)).setFactory(createMock(ChannelFactory.class)); } + /** + * Tests to make sure that a bootstrap's factory can only be set once and not reset after that + */ @Test public void shouldNotAllowFactoryToChangeMoreThanOnce() { + //Initialize a new bootstrap Bootstrap b = new Bootstrap(); + //Create a mock-up ChannelFactory ChannelFactory f = createMock(ChannelFactory.class); + //Set the bootstrap's channel factory b.setFactory(f); + //Assert that both f and the bootstrap's factory are the same assertSame(f, b.getFactory()); + //Start a try block try { + //Attempt to set the bootstrap's channel factory again b.setFactory(createMock(ChannelFactory.class)); + //Fail if no exception is thrown fail(); } catch (IllegalStateException e) { // Success. } } + /** + * Tests to make sure that setFactory does not accept null as a parameter + */ @Test(expected = NullPointerException.class) public void shouldNotAllowNullFactory() { new Bootstrap().setFactory(null); } + /** + * Tests to make sure that a new bootstrap's default pipeline is not null + */ @Test public void shouldHaveNonNullInitialPipeline() { assertNotNull(new Bootstrap().getPipeline()); } + /** + * Tests to make sure a bootstrap's pipeline cannot be set to null + */ @Test(expected = NullPointerException.class) public void shouldNotAllowNullPipeline() { new Bootstrap().setPipeline(null); } + /** + * Tests to make sure a bootstrap cannot have it's pipeline (map) set to null + */ @Test(expected = NullPointerException.class) public void shouldNotAllowNullPipelineMap() { new Bootstrap().setPipelineAsMap(null); } + /** + * Tests to make sure a bootstrap's initial pipeline factory is not null + */ @Test public void shouldHaveNonNullInitialPipelineFactory() { assertNotNull(new Bootstrap().getPipelineFactory()); } + /** + * Tests to make sure that a bootstrap's pipeline factory changes if a new pipeline is set + */ @Test public void shouldUpdatePipelineFactoryIfPipelineIsSet() { + //Make a new bootstrap Bootstrap b = new Bootstrap(); + //Get the initial pipeline factory ChannelPipelineFactory oldPipelineFactory = b.getPipelineFactory(); + //Set a new pipeline b.setPipeline(createMock(ChannelPipeline.class)); + //Assert that the new pipeline factory is not the same as the initial one assertNotSame(oldPipelineFactory, b.getPipelineFactory()); } + /** + * Tests to make sure a bootstrap's pipeline is not returned when a pipeline factory is explicitly set + */ @Test(expected = IllegalStateException.class) public void shouldNotReturnPipelineWhenPipelineFactoryIsSetByUser() { Bootstrap b = new Bootstrap(); @@ -106,6 +147,9 @@ public class BootstrapTest { b.getPipeline(); } + /** + * Tests to make sure a bootstrap's pipeline map is not returned when a pipeline factory is explicitly set + */ @Test(expected = IllegalStateException.class) public void shouldNotReturnPipelineMapWhenPipelineFactoryIsSetByUser() { Bootstrap b = new Bootstrap(); @@ -113,16 +157,25 @@ public class BootstrapTest { b.getPipelineAsMap(); } + /** + * Tests to make sure a bootstrap's pipeline factory cannot be set to null + */ @Test(expected = NullPointerException.class) public void shouldNotAllowNullPipelineFactory() { new Bootstrap().setPipelineFactory(null); } + /** + * Tests to make sure a new bootstrap's pipeline map is empty + */ @Test public void shouldHaveInitialEmptyPipelineMap() { assertTrue(new Bootstrap().getPipelineAsMap().isEmpty()); } + /** + * Tests to make sure that a buffer's pipeline map is ordered + */ @Test public void shouldReturnOrderedPipelineMap() { Bootstrap b = new Bootstrap(); @@ -151,6 +204,9 @@ public class BootstrapTest { assertFalse(m.hasNext()); } + /** + * Tests to make sure that a buffer's pipeline map cannot be set to an unordered map + */ @Test(expected = IllegalArgumentException.class) public void shouldNotAllowUnorderedPipelineMap() { Map m = new HashMap(); @@ -163,6 +219,9 @@ public class BootstrapTest { b.setPipelineAsMap(m); } + /** + * Tests to make sure a buffer's pipeline is ordered when it is set from a map + */ @Test public void shouldHaveOrderedPipelineWhenSetFromMap() { Map m = new LinkedHashMap(); @@ -197,11 +256,17 @@ public class BootstrapTest { } } + /** + * Tests to make sure that a new bootstrap should not have any options set + */ @Test public void shouldHaveInitialEmptyOptionMap() { assertTrue(new Bootstrap().getOptions().isEmpty()); } + /** + * Tests to make sure that a bootstrap's option map updates in real time + */ @Test public void shouldUpdateOptionMapAsRequested1() { Bootstrap b = new Bootstrap(); @@ -216,6 +281,9 @@ public class BootstrapTest { assertEquals(42, o.get("i")); } + /** + * Tests to make sure that a bootstrap's option map updates in real time + */ @Test public void shouldUpdateOptionMapAsRequested2() { Bootstrap b = new Bootstrap(); @@ -235,6 +303,9 @@ public class BootstrapTest { assertEquals(o1, o2); } + /** + * Tests to make sure that an option is removed from a buffer's options when the option is set to null + */ @Test public void shouldRemoveOptionIfValueIsNull() { Bootstrap b = new Bootstrap(); @@ -247,16 +318,25 @@ public class BootstrapTest { assertTrue(b.getOptions().isEmpty()); } + /** + * Tests to make sure that a bootstrap can't accept null as a parameter of getOption(key) + */ @Test(expected = NullPointerException.class) public void shouldNotAllowNullOptionKeyOnGet() { new Bootstrap().getOption(null); } + /** + * Tests to make sure a bootstrap can't accept a null key when using setOption(key, value) + */ @Test(expected = NullPointerException.class) public void shouldNotAllowNullOptionKeyOnSet() { new Bootstrap().setOption(null, "x"); } + /** + * Tests to make sure that a boostrap can't accept a null option map + */ @Test(expected = NullPointerException.class) public void shouldNotAllowNullOptionMap() { new Bootstrap().setOptions(null); diff --git a/src/test/java/org/jboss/netty/bootstrap/NioSocketClientBootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/NioSocketClientBootstrapTest.java index 894a2a8178..e3bd749c25 100644 --- a/src/test/java/org/jboss/netty/bootstrap/NioSocketClientBootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/NioSocketClientBootstrapTest.java @@ -21,15 +21,19 @@ import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; /** + * A test for New I/O socket client bootstraps + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioSocketClientBootstrapTest extends AbstractSocketClientBootstrapTest { + /** + * Creates a new New I/O client socket channel factory + * + * @param executor The executor to use + */ @Override protected ChannelFactory newClientSocketChannelFactory(Executor executor) { return new NioClientSocketChannelFactory(executor, executor); diff --git a/src/test/java/org/jboss/netty/bootstrap/NioSocketServerBootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/NioSocketServerBootstrapTest.java index c8694cd0eb..53998f7927 100644 --- a/src/test/java/org/jboss/netty/bootstrap/NioSocketServerBootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/NioSocketServerBootstrapTest.java @@ -21,15 +21,19 @@ import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** + * A test for New I/O socket server bootstraps + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioSocketServerBootstrapTest extends AbstractSocketServerBootstrapTest { + /** + * Creates a new New I/O server socket channel factory + * + * @param executor The executor to use + */ @Override protected ChannelFactory newServerSocketChannelFactory(Executor executor) { return new NioServerSocketChannelFactory(executor, executor); diff --git a/src/test/java/org/jboss/netty/bootstrap/OioSocketClientBootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/OioSocketClientBootstrapTest.java index 8b3c4ff736..c6438e6ef1 100644 --- a/src/test/java/org/jboss/netty/bootstrap/OioSocketClientBootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/OioSocketClientBootstrapTest.java @@ -21,15 +21,19 @@ import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; /** + * A test for "Old" I/O socket client bootstraps + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioSocketClientBootstrapTest extends AbstractSocketClientBootstrapTest { + /** + * Creates a new "Old" I/O client socket channel factory + * + * @param executor The executor to use + */ @Override protected ChannelFactory newClientSocketChannelFactory(Executor executor) { return new OioClientSocketChannelFactory(executor); diff --git a/src/test/java/org/jboss/netty/bootstrap/OioSocketServerBootstrapTest.java b/src/test/java/org/jboss/netty/bootstrap/OioSocketServerBootstrapTest.java index b29bfae718..059a3418ea 100644 --- a/src/test/java/org/jboss/netty/bootstrap/OioSocketServerBootstrapTest.java +++ b/src/test/java/org/jboss/netty/bootstrap/OioSocketServerBootstrapTest.java @@ -21,15 +21,19 @@ import org.jboss.netty.channel.ChannelFactory; import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** + * A socket server bootstrap test for "Old" I/O + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioSocketServerBootstrapTest extends AbstractSocketServerBootstrapTest { + /** + * Creates a new "Old" I/O server socket channel factory + * + * @param executor The executor to use + */ @Override protected ChannelFactory newServerSocketChannelFactory(Executor executor) { return new OioServerSocketChannelFactory(executor, executor); diff --git a/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java index 55823907be..aaa14b00b3 100644 --- a/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/AbstractChannelBufferTest.java @@ -32,11 +32,10 @@ import org.junit.Before; import org.junit.Test; /** + * An abstract test class for channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public abstract class AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/AbstractCompositeChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/AbstractCompositeChannelBufferTest.java index a9b44b3d1e..964722b066 100644 --- a/src/test/java/org/jboss/netty/buffer/AbstractCompositeChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/AbstractCompositeChannelBufferTest.java @@ -26,11 +26,11 @@ import java.util.List; import org.junit.Test; /** + * An abstract test class for composite channel buffers * * @author The Netty Project * @author Trustin Lee * @author Frederic Bregier (fredbregier@free.fr) - * @version $Rev$, $Date$ */ public abstract class AbstractCompositeChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/BigEndianCompositeChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/BigEndianCompositeChannelBufferTest.java index 01db78ff62..766f03e7d0 100644 --- a/src/test/java/org/jboss/netty/buffer/BigEndianCompositeChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/BigEndianCompositeChannelBufferTest.java @@ -17,11 +17,10 @@ package org.jboss.netty.buffer; /** + * Tests big-endian composite channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class BigEndianCompositeChannelBufferTest extends AbstractCompositeChannelBufferTest { public BigEndianCompositeChannelBufferTest() { diff --git a/src/test/java/org/jboss/netty/buffer/BigEndianDirectChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/BigEndianDirectChannelBufferTest.java index e75a93e9e4..ac7d94401c 100644 --- a/src/test/java/org/jboss/netty/buffer/BigEndianDirectChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/BigEndianDirectChannelBufferTest.java @@ -20,11 +20,10 @@ import static org.junit.Assert.*; import java.nio.ByteOrder; /** + * Tests big-endian direct channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class BigEndianDirectChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/BigEndianHeapChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/BigEndianHeapChannelBufferTest.java index 0ffd5f3ba9..1b58176057 100644 --- a/src/test/java/org/jboss/netty/buffer/BigEndianHeapChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/BigEndianHeapChannelBufferTest.java @@ -20,11 +20,10 @@ import static org.junit.Assert.*; import org.junit.Test; /** + * Tests big-endian heap channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class BigEndianHeapChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/ByteBufferBackedHeapChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/ByteBufferBackedHeapChannelBufferTest.java index 870a0add90..561138bfe3 100644 --- a/src/test/java/org/jboss/netty/buffer/ByteBufferBackedHeapChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/ByteBufferBackedHeapChannelBufferTest.java @@ -20,11 +20,10 @@ import java.nio.ByteBuffer; import org.junit.Test; /** + * Tests ByteBuffer backed heap channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class ByteBufferBackedHeapChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/ChannelBufferIndexFinderTest.java b/src/test/java/org/jboss/netty/buffer/ChannelBufferIndexFinderTest.java index 41f129008a..9fbd1b9487 100644 --- a/src/test/java/org/jboss/netty/buffer/ChannelBufferIndexFinderTest.java +++ b/src/test/java/org/jboss/netty/buffer/ChannelBufferIndexFinderTest.java @@ -22,11 +22,10 @@ import org.junit.Test; /** + * Tests the index-finding capabilities of channel buffers + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ChannelBufferIndexFinderTest { diff --git a/src/test/java/org/jboss/netty/buffer/ChannelBufferStreamTest.java b/src/test/java/org/jboss/netty/buffer/ChannelBufferStreamTest.java index 64267b654f..39fef6552f 100644 --- a/src/test/java/org/jboss/netty/buffer/ChannelBufferStreamTest.java +++ b/src/test/java/org/jboss/netty/buffer/ChannelBufferStreamTest.java @@ -23,11 +23,10 @@ import org.junit.Test; /** + * Tests channel buffer streams + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ChannelBufferStreamTest { diff --git a/src/test/java/org/jboss/netty/buffer/ChannelBuffersTest.java b/src/test/java/org/jboss/netty/buffer/ChannelBuffersTest.java index c03d13df0b..9a51f7c324 100644 --- a/src/test/java/org/jboss/netty/buffer/ChannelBuffersTest.java +++ b/src/test/java/org/jboss/netty/buffer/ChannelBuffersTest.java @@ -31,11 +31,10 @@ import org.easymock.classextension.EasyMock; import org.junit.Test; /** + * Tests channel buffers + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ChannelBuffersTest { diff --git a/src/test/java/org/jboss/netty/buffer/DuplicateChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/DuplicateChannelBufferTest.java index c48bbba454..164f5d95e8 100644 --- a/src/test/java/org/jboss/netty/buffer/DuplicateChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/DuplicateChannelBufferTest.java @@ -20,11 +20,10 @@ import static org.junit.Assert.*; import org.junit.Test; /** + * Tests duplicated channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DuplicateChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/DynamicChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/DynamicChannelBufferTest.java index 5b70250f9c..06d3c7cd39 100644 --- a/src/test/java/org/jboss/netty/buffer/DynamicChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/DynamicChannelBufferTest.java @@ -22,11 +22,10 @@ import java.nio.ByteOrder; import org.junit.Test; /** + * Tests dynamic channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DynamicChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/LittleEndianCompositeChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/LittleEndianCompositeChannelBufferTest.java index 4340aa020e..78bfeb2f55 100644 --- a/src/test/java/org/jboss/netty/buffer/LittleEndianCompositeChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/LittleEndianCompositeChannelBufferTest.java @@ -17,11 +17,10 @@ package org.jboss.netty.buffer; /** + * Tests little-endian composite channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class LittleEndianCompositeChannelBufferTest extends AbstractCompositeChannelBufferTest { public LittleEndianCompositeChannelBufferTest() { diff --git a/src/test/java/org/jboss/netty/buffer/LittleEndianDirectChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/LittleEndianDirectChannelBufferTest.java index 115c6df94b..cad1ed2ceb 100644 --- a/src/test/java/org/jboss/netty/buffer/LittleEndianDirectChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/LittleEndianDirectChannelBufferTest.java @@ -20,11 +20,10 @@ import static org.junit.Assert.*; import java.nio.ByteOrder; /** + * Tests little-endian direct channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class LittleEndianDirectChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/LittleEndianHeapChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/LittleEndianHeapChannelBufferTest.java index 5715501837..7c73cae31e 100644 --- a/src/test/java/org/jboss/netty/buffer/LittleEndianHeapChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/LittleEndianHeapChannelBufferTest.java @@ -22,11 +22,10 @@ import java.nio.ByteOrder; import org.junit.Test; /** - * + * Tests little-endian heap channel buffers + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class LittleEndianHeapChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java index 59718fa0e2..c1eba85974 100644 --- a/src/test/java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/ReadOnlyChannelBufferTest.java @@ -29,11 +29,10 @@ import java.nio.channels.ScatteringByteChannel; import org.junit.Test; /** + * Tests read-only channel buffers + * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ReadOnlyChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/SlicedChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/SlicedChannelBufferTest.java index b15b6fae6c..54e1d507e8 100644 --- a/src/test/java/org/jboss/netty/buffer/SlicedChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/SlicedChannelBufferTest.java @@ -22,11 +22,10 @@ import java.util.Random; import org.junit.Test; /** + * Tests sliced channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class SlicedChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/buffer/TruncatedChannelBufferTest.java b/src/test/java/org/jboss/netty/buffer/TruncatedChannelBufferTest.java index 9ada147648..2ccd6e3e5a 100644 --- a/src/test/java/org/jboss/netty/buffer/TruncatedChannelBufferTest.java +++ b/src/test/java/org/jboss/netty/buffer/TruncatedChannelBufferTest.java @@ -20,11 +20,10 @@ import static org.junit.Assert.*; import org.junit.Test; /** + * Tests truncated channel buffers * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class TruncatedChannelBufferTest extends AbstractChannelBufferTest { diff --git a/src/test/java/org/jboss/netty/channel/CompleteChannelFutureTest.java b/src/test/java/org/jboss/netty/channel/CompleteChannelFutureTest.java index b94082f075..f9f4294b57 100644 --- a/src/test/java/org/jboss/netty/channel/CompleteChannelFutureTest.java +++ b/src/test/java/org/jboss/netty/channel/CompleteChannelFutureTest.java @@ -27,9 +27,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class CompleteChannelFutureTest { diff --git a/src/test/java/org/jboss/netty/channel/FailedChannelFutureTest.java b/src/test/java/org/jboss/netty/channel/FailedChannelFutureTest.java index 1ab2d5d0b0..a1ed18ab24 100644 --- a/src/test/java/org/jboss/netty/channel/FailedChannelFutureTest.java +++ b/src/test/java/org/jboss/netty/channel/FailedChannelFutureTest.java @@ -24,9 +24,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class FailedChannelFutureTest { @Test diff --git a/src/test/java/org/jboss/netty/channel/StaticChannelPipelineTest.java b/src/test/java/org/jboss/netty/channel/StaticChannelPipelineTest.java index b9b1d6b990..5e5e72aa12 100644 --- a/src/test/java/org/jboss/netty/channel/StaticChannelPipelineTest.java +++ b/src/test/java/org/jboss/netty/channel/StaticChannelPipelineTest.java @@ -24,7 +24,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class StaticChannelPipelineTest { diff --git a/src/test/java/org/jboss/netty/channel/SucceededChannelFutureTest.java b/src/test/java/org/jboss/netty/channel/SucceededChannelFutureTest.java index f2544ff659..44eba4b796 100644 --- a/src/test/java/org/jboss/netty/channel/SucceededChannelFutureTest.java +++ b/src/test/java/org/jboss/netty/channel/SucceededChannelFutureTest.java @@ -24,9 +24,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class SucceededChannelFutureTest { @Test diff --git a/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java b/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java index 0a5427a0ae..f9e5ccb50b 100644 --- a/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/AbstractSocketEchoTest.java @@ -47,9 +47,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractSocketEchoTest { diff --git a/src/test/java/org/jboss/netty/channel/socket/NioClientSocketShutdownTimeTest.java b/src/test/java/org/jboss/netty/channel/socket/NioClientSocketShutdownTimeTest.java index 7063677eea..33820e8e73 100644 --- a/src/test/java/org/jboss/netty/channel/socket/NioClientSocketShutdownTimeTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/NioClientSocketShutdownTimeTest.java @@ -33,9 +33,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioClientSocketShutdownTimeTest { diff --git a/src/test/java/org/jboss/netty/channel/socket/NioNioSocketEchoTest.java b/src/test/java/org/jboss/netty/channel/socket/NioNioSocketEchoTest.java index 5ae8856ede..7dd41bd3a4 100644 --- a/src/test/java/org/jboss/netty/channel/socket/NioNioSocketEchoTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/NioNioSocketEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioNioSocketEchoTest extends AbstractSocketEchoTest { diff --git a/src/test/java/org/jboss/netty/channel/socket/NioOioSocketEchoTest.java b/src/test/java/org/jboss/netty/channel/socket/NioOioSocketEchoTest.java index 4de8592fed..5cfc7b6d77 100644 --- a/src/test/java/org/jboss/netty/channel/socket/NioOioSocketEchoTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/NioOioSocketEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioOioSocketEchoTest extends AbstractSocketEchoTest { diff --git a/src/test/java/org/jboss/netty/channel/socket/NioServerSocketShutdownTimeTest.java b/src/test/java/org/jboss/netty/channel/socket/NioServerSocketShutdownTimeTest.java index 0b0338f762..3912bbff36 100644 --- a/src/test/java/org/jboss/netty/channel/socket/NioServerSocketShutdownTimeTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/NioServerSocketShutdownTimeTest.java @@ -35,9 +35,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioServerSocketShutdownTimeTest { diff --git a/src/test/java/org/jboss/netty/channel/socket/OioNioSocketEchoTest.java b/src/test/java/org/jboss/netty/channel/socket/OioNioSocketEchoTest.java index 97d21145d0..404f2d6f84 100644 --- a/src/test/java/org/jboss/netty/channel/socket/OioNioSocketEchoTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/OioNioSocketEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioNioSocketEchoTest extends AbstractSocketEchoTest { diff --git a/src/test/java/org/jboss/netty/channel/socket/OioOioSocketEchoTest.java b/src/test/java/org/jboss/netty/channel/socket/OioOioSocketEchoTest.java index d88fd1bab9..f9f88ad3f9 100644 --- a/src/test/java/org/jboss/netty/channel/socket/OioOioSocketEchoTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/OioOioSocketEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioOioSocketEchoTest extends AbstractSocketEchoTest { diff --git a/src/test/java/org/jboss/netty/channel/socket/http/AcceptedServerChannelRequestDispatchTest.java b/src/test/java/org/jboss/netty/channel/socket/http/AcceptedServerChannelRequestDispatchTest.java index f5114c42ac..4d50dc8621 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/AcceptedServerChannelRequestDispatchTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/AcceptedServerChannelRequestDispatchTest.java @@ -37,6 +37,8 @@ import org.junit.Test; import org.junit.runner.RunWith; /** + * Tests an accepted server channel request dispatch + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/FakeChannelConfig.java b/src/test/java/org/jboss/netty/channel/socket/http/FakeChannelConfig.java index 2075248556..591d752b8f 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/FakeChannelConfig.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/FakeChannelConfig.java @@ -28,6 +28,8 @@ import org.jboss.netty.channel.socket.SocketChannelConfig; import org.jboss.netty.util.internal.ConversionUtil; /** + * A face channel config class for use in testing + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/FakeChannelSink.java b/src/test/java/org/jboss/netty/channel/socket/http/FakeChannelSink.java index 5ef2fa8dda..ea014a8e13 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/FakeChannelSink.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/FakeChannelSink.java @@ -24,6 +24,8 @@ import org.jboss.netty.channel.ChannelEvent; import org.jboss.netty.channel.ChannelPipeline; /** + * A fake channel sink for use in testing + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/FakeClientSocketChannelFactory.java b/src/test/java/org/jboss/netty/channel/socket/http/FakeClientSocketChannelFactory.java index 84a559675c..770843b685 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/FakeClientSocketChannelFactory.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/FakeClientSocketChannelFactory.java @@ -24,6 +24,8 @@ import org.jboss.netty.channel.socket.ClientSocketChannelFactory; import org.jboss.netty.channel.socket.SocketChannel; /** + * A fake client socket channel factory for use in testing + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannel.java b/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannel.java index 27a3a443bd..1028a8f806 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannel.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannel.java @@ -30,6 +30,8 @@ import org.jboss.netty.channel.socket.ServerSocketChannel; import org.jboss.netty.channel.socket.ServerSocketChannelConfig; /** + * A fake server socket channel for use in testing + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannelConfig.java b/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannelConfig.java index cb799ffd74..62212f79ce 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannelConfig.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannelConfig.java @@ -23,6 +23,8 @@ import org.jboss.netty.channel.DefaultChannelConfig; import org.jboss.netty.channel.socket.ServerSocketChannelConfig; /** + * A fake server socket channel config class for use in testing + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannelFactory.java b/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannelFactory.java index 7ce450160d..11273c3d15 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannelFactory.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/FakeServerSocketChannelFactory.java @@ -22,6 +22,8 @@ import org.jboss.netty.channel.socket.ServerSocketChannel; import org.jboss.netty.channel.socket.ServerSocketChannelFactory; /** + * A fake server socket channel factory for use in testing + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/FakeSocketChannel.java b/src/test/java/org/jboss/netty/channel/socket/http/FakeSocketChannel.java index f303192d4b..631d43a098 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/FakeSocketChannel.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/FakeSocketChannel.java @@ -29,6 +29,8 @@ import org.jboss.netty.channel.socket.SocketChannel; import org.jboss.netty.channel.socket.SocketChannelConfig; /** + * A fake socket channel for use in testing + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelSinkTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelSinkTest.java index 14dfe3ca64..57371990d8 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelSinkTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelAcceptedChannelSinkTest.java @@ -28,6 +28,8 @@ import org.junit.Test; import org.junit.runner.RunWith; /** + * Tests HTTP tunnel accepted channel sinks + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelConfigTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelConfigTest.java index 5b9b535c19..ebf61944ea 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelConfigTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelConfigTest.java @@ -29,6 +29,8 @@ import org.junit.Test; import org.junit.runner.RunWith; /** + * Tests HTTP tunnel client channel config + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelTest.java index ccc185ca2a..6c47d0ecb9 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientChannelTest.java @@ -36,6 +36,8 @@ import org.junit.Before; import org.junit.Test; /** + * Tests HTTP tunnel client channels + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientPollHandlerTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientPollHandlerTest.java index fa8685d1b9..95b55f5e65 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientPollHandlerTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientPollHandlerTest.java @@ -33,6 +33,8 @@ import org.junit.Before; import org.junit.Test; /** + * Tests HTTP tunnel client polling + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSendHandlerTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSendHandlerTest.java index 943789a58e..1ac222fc27 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSendHandlerTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSendHandlerTest.java @@ -36,6 +36,8 @@ import org.junit.Before; import org.junit.Test; /** + * Tests HTTP tunnel client sending + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelFactoryTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelFactoryTest.java index cb592a096b..976ff1010d 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelFactoryTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelFactoryTest.java @@ -33,6 +33,8 @@ import org.junit.Test; import org.junit.runner.RunWith; /** + * Tests HTTP tunnel server channel factories + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java index 7c949cf6a8..068ac55b45 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelSinkTest.java @@ -38,6 +38,8 @@ import org.junit.Test; import org.junit.runner.RunWith; /** + * Tests HTTP tunnel server channel sinks + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelTest.java index baaaa9c41d..3bd750dfa8 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelServerChannelTest.java @@ -42,6 +42,8 @@ import org.junit.Test; import org.junit.runner.RunWith; /** + * Tests HTTP tunnel server channels + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java index 14d45f2494..bc362b2988 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelSoakTester.java @@ -53,6 +53,8 @@ import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** + * Tests HTTP tunnel soaking + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelTest.java b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelTest.java index 21639a7457..586daa2b87 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/HttpTunnelTest.java @@ -50,6 +50,8 @@ import org.junit.Before; import org.junit.Test; /** + * Tests HTTP tunnelling + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/MockChannelStateListener.java b/src/test/java/org/jboss/netty/channel/socket/http/MockChannelStateListener.java index 059fdec679..e30277416a 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/MockChannelStateListener.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/MockChannelStateListener.java @@ -24,6 +24,8 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.ChannelFuture; /** + * A mock channel state listener + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/NettyTestUtils.java b/src/test/java/org/jboss/netty/channel/socket/http/NettyTestUtils.java index d896cacdfc..98bd7aa1aa 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/NettyTestUtils.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/NettyTestUtils.java @@ -40,6 +40,8 @@ import org.jboss.netty.channel.ExceptionEvent; import org.jboss.netty.channel.UpstreamMessageEvent; /** + * Test utilities for Netty + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/NettyTestUtilsTest.java b/src/test/java/org/jboss/netty/channel/socket/http/NettyTestUtilsTest.java index 2f71b647d8..6f3de78e77 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/NettyTestUtilsTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/NettyTestUtilsTest.java @@ -26,6 +26,8 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.junit.Test; /** + * Tests the Netty utilities + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/NullChannelHandler.java b/src/test/java/org/jboss/netty/channel/socket/http/NullChannelHandler.java index bc726f0257..356ab356c9 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/NullChannelHandler.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/NullChannelHandler.java @@ -22,6 +22,8 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelUpstreamHandler; /** + * A channel handler that simply sends events upstream or downstream + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/SaturationManagerTest.java b/src/test/java/org/jboss/netty/channel/socket/http/SaturationManagerTest.java index fcd4dca697..8916cd1892 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/SaturationManagerTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/SaturationManagerTest.java @@ -6,6 +6,11 @@ import static org.jboss.netty.channel.socket.http.SaturationStateChange.*; import org.junit.Before; import org.junit.Test; +/** + * Tests saturation managers + * + * @author The Netty Project (netty-dev@lists.jboss.org) + */ public class SaturationManagerTest { private SaturationManager manager; diff --git a/src/test/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchTest.java b/src/test/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchTest.java index 6ea85850ff..d7eb76daf0 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/ServerMessageSwitchTest.java @@ -34,6 +34,8 @@ import org.junit.Test; import org.junit.runner.RunWith; /** + * Tests server message switching + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/UpstreamEventCatcher.java b/src/test/java/org/jboss/netty/channel/socket/http/UpstreamEventCatcher.java index 22c8797b1d..4c7918dd6c 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/UpstreamEventCatcher.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/UpstreamEventCatcher.java @@ -24,6 +24,8 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelUpstreamHandler; /** + * Tests the upstream event catcher + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/WriteFragmenterTest.java b/src/test/java/org/jboss/netty/channel/socket/http/WriteFragmenterTest.java index cf03851be0..a4aa7e8aba 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/WriteFragmenterTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/WriteFragmenterTest.java @@ -31,6 +31,8 @@ import org.junit.Before; import org.junit.Test; /** + * Tests write fragmenting capabilities + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/http/WriteSplitterTest.java b/src/test/java/org/jboss/netty/channel/socket/http/WriteSplitterTest.java index d0258f5461..ac40d2265e 100644 --- a/src/test/java/org/jboss/netty/channel/socket/http/WriteSplitterTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/http/WriteSplitterTest.java @@ -27,6 +27,8 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.junit.Test; /** + * Tests write splitting capabilities + * * @author The Netty Project (netty-dev@lists.jboss.org) * @author Iain McGinniss (iain.mcginniss@onedrum.com) */ diff --git a/src/test/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelTest.java b/src/test/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelTest.java index 6122808050..2ca91a0a37 100644 --- a/src/test/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelTest.java +++ b/src/test/java/org/jboss/netty/channel/socket/nio/NioDatagramChannelTest.java @@ -31,9 +31,10 @@ import org.junit.BeforeClass; import org.junit.Test; /** + * Tests NIO (UDP) datagrams + * * @author The Netty Project * @author Daniel Bevenius (dbevenius@jboss.com) - * @version $Rev$, $Date$ */ public class NioDatagramChannelTest { private static Channel sc; diff --git a/src/test/java/org/jboss/netty/channel/socket/nio/SimpleHandler.java b/src/test/java/org/jboss/netty/channel/socket/nio/SimpleHandler.java index 785e332d22..442273a480 100644 --- a/src/test/java/org/jboss/netty/channel/socket/nio/SimpleHandler.java +++ b/src/test/java/org/jboss/netty/channel/socket/nio/SimpleHandler.java @@ -21,13 +21,19 @@ import org.jboss.netty.channel.MessageEvent; import org.jboss.netty.channel.SimpleChannelHandler; /** + * A very simple channel handler * * @author The Netty Project * @author Daniel Bevenius (dbevenius@jboss.com) - * @version $Rev$, $Date$ */ public class SimpleHandler extends SimpleChannelHandler { + /** + * Called when a message is received + * + * @param ctx The channel handler context + * @param e The message event + */ @Override public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent e) throws Exception { diff --git a/src/test/java/org/jboss/netty/channel/socket/nio/UdpClient.java b/src/test/java/org/jboss/netty/channel/socket/nio/UdpClient.java index b60e65b0aa..4a41038a63 100644 --- a/src/test/java/org/jboss/netty/channel/socket/nio/UdpClient.java +++ b/src/test/java/org/jboss/netty/channel/socket/nio/UdpClient.java @@ -22,25 +22,52 @@ import java.net.InetAddress; import java.net.SocketException; /** + * A UDP (User Datagram Protocol) client for use in testing * * @author The Netty Project * @author Daniel Bevenius (dbevenius@jboss.com) - * @version $Rev$, $Date$ */ public class UdpClient { + /** + * The internet address which is the target of this client + */ private final InetAddress address; + + /** + * The datagram socket used by this client + */ private final DatagramSocket clientSocket; + + /** + * The destination port used by this client + */ private final int port; + /** + * Creates a new UDP client + * + * @param address The target address to use + * @param port The target port to use + */ public UdpClient(final InetAddress address, final int port) throws SocketException { + //Set the address this.address = address; + //Set the port this.port = port; + //Set up a new datagram socket clientSocket = new DatagramSocket(); + //And allow addresses to be reused clientSocket.setReuseAddress(true); } + /** + * Sends a packet + * + * @param payload The payload of bytes to send + * @return The datagram packet sent + */ public DatagramPacket send(final byte[] payload) throws IOException { final DatagramPacket dp = new DatagramPacket(payload, payload.length, address, port); @@ -48,11 +75,20 @@ public class UdpClient { return dp; } + /** + * Receives data from a datagram packet + * + * @param dp The datagram packet to use + * @param timeout The timeout to use + */ public void receive(final DatagramPacket dp, final int timeout) throws IOException { clientSocket.setSoTimeout(timeout); clientSocket.receive(dp); } + /** + * Close this client and the socket it uses + */ public void close() { clientSocket.close(); } diff --git a/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoderTest.java index 380ed21108..90b086b093 100644 --- a/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayDecoderTest.java @@ -28,7 +28,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Tomasz Blachowicz (tblachowicz@gmail.com) - * @version $Rev$, $Date$ */ public class ByteArrayDecoderTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoderTest.java b/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoderTest.java index 44ae01f524..6705f970bb 100644 --- a/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/bytes/ByteArrayEncoderTest.java @@ -29,7 +29,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Tomasz Blachowicz (tblachowicz@gmail.com) - * @version $Rev$, $Date$ */ public class ByteArrayEncoderTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java index 24cd4b148a..a83503a886 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/AbstractSocketFixedLengthEchoTest.java @@ -47,9 +47,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractSocketFixedLengthEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/NioNioSocketFixedLengthEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/NioNioSocketFixedLengthEchoTest.java index b2aeab0605..0e6582bbaf 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/NioNioSocketFixedLengthEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/NioNioSocketFixedLengthEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioNioSocketFixedLengthEchoTest extends AbstractSocketFixedLengthEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/NioOioSocketFixedLengthEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/NioOioSocketFixedLengthEchoTest.java index 7636fea4e8..ff494248aa 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/NioOioSocketFixedLengthEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/NioOioSocketFixedLengthEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioOioSocketFixedLengthEchoTest extends AbstractSocketFixedLengthEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/OioNioSocketFixedLengthEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/OioNioSocketFixedLengthEchoTest.java index 74499875de..628b61346c 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/OioNioSocketFixedLengthEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/OioNioSocketFixedLengthEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioNioSocketFixedLengthEchoTest extends AbstractSocketFixedLengthEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/frame/OioOioSocketFixedLengthEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/frame/OioOioSocketFixedLengthEchoTest.java index f3edcd8816..0dad1e93ad 100644 --- a/src/test/java/org/jboss/netty/handler/codec/frame/OioOioSocketFixedLengthEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/frame/OioOioSocketFixedLengthEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioOioSocketFixedLengthEchoTest extends AbstractSocketFixedLengthEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/http/CookieDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/http/CookieDecoderTest.java index a0138db92d..ca19340f3e 100644 --- a/src/test/java/org/jboss/netty/handler/codec/http/CookieDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/http/CookieDecoderTest.java @@ -32,7 +32,6 @@ import org.junit.Test; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class CookieDecoderTest { @Test diff --git a/src/test/java/org/jboss/netty/handler/codec/http/CookieEncoderTest.java b/src/test/java/org/jboss/netty/handler/codec/http/CookieEncoderTest.java index 45ed3f17ff..1a903d2ee1 100644 --- a/src/test/java/org/jboss/netty/handler/codec/http/CookieEncoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/http/CookieEncoderTest.java @@ -29,7 +29,6 @@ import org.junit.Test; * @author The Netty Project * @author Andy Taylor (andy.taylor@jboss.org) * @author Trustin Lee - * @version $Rev$, $Date$ */ public class CookieEncoderTest { @Test diff --git a/src/test/java/org/jboss/netty/handler/codec/http/DefaultHttpMessageTest.java b/src/test/java/org/jboss/netty/handler/codec/http/DefaultHttpMessageTest.java index b5277e77e7..f542bd6e28 100644 --- a/src/test/java/org/jboss/netty/handler/codec/http/DefaultHttpMessageTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/http/DefaultHttpMessageTest.java @@ -21,7 +21,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class DefaultHttpMessageTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java index 07a2bd3f1d..5317f1d631 100644 --- a/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/http/QueryStringDecoderTest.java @@ -23,7 +23,6 @@ import org.junit.Test; * @author The Netty Project * @author Trustin Lee * @author Benoit Sigoure - * @version $Rev$, $Date$ */ public class QueryStringDecoderTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoderTest.java index 51f4f3cf46..2bc2bd23df 100644 --- a/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32FrameDecoderTest.java @@ -28,7 +28,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Tomasz Blachowicz (tblachowicz@gmail.com) - * @version $Rev$, $Date$ */ public class ProtobufVarint32FrameDecoderTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java b/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java index a1c8f488eb..20315b103a 100644 --- a/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java @@ -27,7 +27,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Tomasz Blachowicz (tblachowicz@gmail.com) - * @version $Rev$, $Date$ */ public class ProtobufVarint32LengthFieldPrependerTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderTest.java b/src/test/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderTest.java index 17ca8dba51..9a263a4065 100644 --- a/src/test/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/replay/ReplayingDecoderTest.java @@ -28,7 +28,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ public class ReplayingDecoderTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java index cf987f4873..33bff60960 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketCompatibleObjectStreamEchoTest.java @@ -45,9 +45,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractSocketCompatibleObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java index 9260c861b9..9a4a19e98b 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/AbstractSocketObjectStreamEchoTest.java @@ -45,9 +45,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractSocketObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/NioNioSocketCompatibleObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/NioNioSocketCompatibleObjectStreamEchoTest.java index 7f85a33ffa..491719e3a7 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/NioNioSocketCompatibleObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/NioNioSocketCompatibleObjectStreamEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioNioSocketCompatibleObjectStreamEchoTest extends AbstractSocketCompatibleObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/NioNioSocketObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/NioNioSocketObjectStreamEchoTest.java index 8443c2a559..eb571824d4 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/NioNioSocketObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/NioNioSocketObjectStreamEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioNioSocketObjectStreamEchoTest extends AbstractSocketObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/NioOioSocketCompatibleObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/NioOioSocketCompatibleObjectStreamEchoTest.java index 5e46dc3ee7..a3a8db1f9d 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/NioOioSocketCompatibleObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/NioOioSocketCompatibleObjectStreamEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioOioSocketCompatibleObjectStreamEchoTest extends AbstractSocketCompatibleObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/NioOioSocketObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/NioOioSocketObjectStreamEchoTest.java index 16aca5d9ec..d40866e445 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/NioOioSocketObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/NioOioSocketObjectStreamEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioOioSocketObjectStreamEchoTest extends AbstractSocketObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/OioNioSocketCompatibleObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/OioNioSocketCompatibleObjectStreamEchoTest.java index 677171a9e0..8b31e5e06f 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/OioNioSocketCompatibleObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/OioNioSocketCompatibleObjectStreamEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioNioSocketCompatibleObjectStreamEchoTest extends AbstractSocketCompatibleObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/OioNioSocketObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/OioNioSocketObjectStreamEchoTest.java index 04e0493b57..7521925672 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/OioNioSocketObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/OioNioSocketObjectStreamEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioNioSocketObjectStreamEchoTest extends AbstractSocketObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/OioOioSocketCompatibleObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/OioOioSocketCompatibleObjectStreamEchoTest.java index 94bef10ffe..36a310a923 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/OioOioSocketCompatibleObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/OioOioSocketCompatibleObjectStreamEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioOioSocketCompatibleObjectStreamEchoTest extends AbstractSocketCompatibleObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/OioOioSocketObjectStreamEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/OioOioSocketObjectStreamEchoTest.java index d6fa216e6f..7fb03c415f 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/OioOioSocketObjectStreamEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/OioOioSocketObjectStreamEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioOioSocketObjectStreamEchoTest extends AbstractSocketObjectStreamEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/serialization/SwitchableInputStreamTest.java b/src/test/java/org/jboss/netty/handler/codec/serialization/SwitchableInputStreamTest.java index cf3e1a766f..9209233bbd 100644 --- a/src/test/java/org/jboss/netty/handler/codec/serialization/SwitchableInputStreamTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/serialization/SwitchableInputStreamTest.java @@ -27,9 +27,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class SwitchableInputStreamTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java index a8c2c319e0..2cc11d31f3 100644 --- a/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/string/AbstractSocketStringEchoTest.java @@ -48,9 +48,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractSocketStringEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/string/NioNioSocketStringEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/string/NioNioSocketStringEchoTest.java index 95c23fc9d9..4214b5e01b 100644 --- a/src/test/java/org/jboss/netty/handler/codec/string/NioNioSocketStringEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/string/NioNioSocketStringEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioNioSocketStringEchoTest extends AbstractSocketStringEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/string/NioOioSocketStringEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/string/NioOioSocketStringEchoTest.java index a36dd3241a..aaf40c8f47 100644 --- a/src/test/java/org/jboss/netty/handler/codec/string/NioOioSocketStringEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/string/NioOioSocketStringEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioOioSocketStringEchoTest extends AbstractSocketStringEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/string/OioNioSocketStringEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/string/OioNioSocketStringEchoTest.java index 9d365f13d9..5eec850e26 100644 --- a/src/test/java/org/jboss/netty/handler/codec/string/OioNioSocketStringEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/string/OioNioSocketStringEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioNioSocketStringEchoTest extends AbstractSocketStringEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/codec/string/OioOioSocketStringEchoTest.java b/src/test/java/org/jboss/netty/handler/codec/string/OioOioSocketStringEchoTest.java index 81e35dc9a8..52029e13a9 100644 --- a/src/test/java/org/jboss/netty/handler/codec/string/OioOioSocketStringEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/codec/string/OioOioSocketStringEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioOioSocketStringEchoTest extends AbstractSocketStringEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java b/src/test/java/org/jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java index 34aa06644c..812b901b17 100644 --- a/src/test/java/org/jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/ssl/AbstractSocketSslEchoTest.java @@ -54,9 +54,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public abstract class AbstractSocketSslEchoTest { static final InternalLogger logger = diff --git a/src/test/java/org/jboss/netty/handler/ssl/ImmediateExecutorTest.java b/src/test/java/org/jboss/netty/handler/ssl/ImmediateExecutorTest.java index f3ac997901..1f22b32c65 100644 --- a/src/test/java/org/jboss/netty/handler/ssl/ImmediateExecutorTest.java +++ b/src/test/java/org/jboss/netty/handler/ssl/ImmediateExecutorTest.java @@ -23,9 +23,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ImmediateExecutorTest { diff --git a/src/test/java/org/jboss/netty/handler/ssl/NioNioSocketSslEchoTest.java b/src/test/java/org/jboss/netty/handler/ssl/NioNioSocketSslEchoTest.java index 77e3c639b8..495a631a24 100644 --- a/src/test/java/org/jboss/netty/handler/ssl/NioNioSocketSslEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/ssl/NioNioSocketSslEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioNioSocketSslEchoTest extends AbstractSocketSslEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/ssl/NioOioSocketSslEchoTest.java b/src/test/java/org/jboss/netty/handler/ssl/NioOioSocketSslEchoTest.java index a017477404..348d6890ae 100644 --- a/src/test/java/org/jboss/netty/handler/ssl/NioOioSocketSslEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/ssl/NioOioSocketSslEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class NioOioSocketSslEchoTest extends AbstractSocketSslEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/ssl/OioNioSocketSslEchoTest.java b/src/test/java/org/jboss/netty/handler/ssl/OioNioSocketSslEchoTest.java index fa88cd0099..479dd07698 100644 --- a/src/test/java/org/jboss/netty/handler/ssl/OioNioSocketSslEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/ssl/OioNioSocketSslEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioNioSocketSslEchoTest extends AbstractSocketSslEchoTest { diff --git a/src/test/java/org/jboss/netty/handler/ssl/OioOioSocketSslEchoTest.java b/src/test/java/org/jboss/netty/handler/ssl/OioOioSocketSslEchoTest.java index a50bc81d6e..2359bde5af 100644 --- a/src/test/java/org/jboss/netty/handler/ssl/OioOioSocketSslEchoTest.java +++ b/src/test/java/org/jboss/netty/handler/ssl/OioOioSocketSslEchoTest.java @@ -24,9 +24,6 @@ import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class OioOioSocketSslEchoTest extends AbstractSocketSslEchoTest { diff --git a/src/test/java/org/jboss/netty/logging/CommonsLoggerFactoryTest.java b/src/test/java/org/jboss/netty/logging/CommonsLoggerFactoryTest.java index c964e33590..f71f35247e 100644 --- a/src/test/java/org/jboss/netty/logging/CommonsLoggerFactoryTest.java +++ b/src/test/java/org/jboss/netty/logging/CommonsLoggerFactoryTest.java @@ -23,9 +23,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class CommonsLoggerFactoryTest { diff --git a/src/test/java/org/jboss/netty/logging/CommonsLoggerTest.java b/src/test/java/org/jboss/netty/logging/CommonsLoggerTest.java index 4fb1a2c7e9..d6c7f63f5d 100644 --- a/src/test/java/org/jboss/netty/logging/CommonsLoggerTest.java +++ b/src/test/java/org/jboss/netty/logging/CommonsLoggerTest.java @@ -24,9 +24,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class CommonsLoggerTest { private static final Exception e = new Exception(); diff --git a/src/test/java/org/jboss/netty/logging/InternalLoggerFactoryTest.java b/src/test/java/org/jboss/netty/logging/InternalLoggerFactoryTest.java index 3b71a6403a..1b27399a17 100644 --- a/src/test/java/org/jboss/netty/logging/InternalLoggerFactoryTest.java +++ b/src/test/java/org/jboss/netty/logging/InternalLoggerFactoryTest.java @@ -27,9 +27,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class InternalLoggerFactoryTest { private static final Exception e = new Exception(); diff --git a/src/test/java/org/jboss/netty/logging/JBossLoggerFactoryTest.java b/src/test/java/org/jboss/netty/logging/JBossLoggerFactoryTest.java index 938e8a6a73..3c4b108477 100644 --- a/src/test/java/org/jboss/netty/logging/JBossLoggerFactoryTest.java +++ b/src/test/java/org/jboss/netty/logging/JBossLoggerFactoryTest.java @@ -23,9 +23,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class JBossLoggerFactoryTest { diff --git a/src/test/java/org/jboss/netty/logging/JBossLoggerTest.java b/src/test/java/org/jboss/netty/logging/JBossLoggerTest.java index e4d4ae0f63..329f3a5b66 100644 --- a/src/test/java/org/jboss/netty/logging/JBossLoggerTest.java +++ b/src/test/java/org/jboss/netty/logging/JBossLoggerTest.java @@ -25,9 +25,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class JBossLoggerTest { private static final Exception e = new Exception(); diff --git a/src/test/java/org/jboss/netty/logging/JdkLoggerFactoryTest.java b/src/test/java/org/jboss/netty/logging/JdkLoggerFactoryTest.java index 9200f73da5..e4d6f15500 100644 --- a/src/test/java/org/jboss/netty/logging/JdkLoggerFactoryTest.java +++ b/src/test/java/org/jboss/netty/logging/JdkLoggerFactoryTest.java @@ -23,9 +23,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class JdkLoggerFactoryTest { diff --git a/src/test/java/org/jboss/netty/logging/JdkLoggerTest.java b/src/test/java/org/jboss/netty/logging/JdkLoggerTest.java index 29e53ff9fd..1818f5c586 100644 --- a/src/test/java/org/jboss/netty/logging/JdkLoggerTest.java +++ b/src/test/java/org/jboss/netty/logging/JdkLoggerTest.java @@ -27,9 +27,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class JdkLoggerTest { private static final Exception e = new Exception(); diff --git a/src/test/java/org/jboss/netty/logging/Log4JLoggerFactoryTest.java b/src/test/java/org/jboss/netty/logging/Log4JLoggerFactoryTest.java index 4b302a4671..767cd8e720 100644 --- a/src/test/java/org/jboss/netty/logging/Log4JLoggerFactoryTest.java +++ b/src/test/java/org/jboss/netty/logging/Log4JLoggerFactoryTest.java @@ -23,9 +23,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class Log4JLoggerFactoryTest { diff --git a/src/test/java/org/jboss/netty/logging/Log4JLoggerTest.java b/src/test/java/org/jboss/netty/logging/Log4JLoggerTest.java index e7291b70a1..65986fd8f4 100644 --- a/src/test/java/org/jboss/netty/logging/Log4JLoggerTest.java +++ b/src/test/java/org/jboss/netty/logging/Log4JLoggerTest.java @@ -25,9 +25,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class Log4JLoggerTest { private static final Exception e = new Exception(); diff --git a/src/test/java/org/jboss/netty/logging/Slf4JLoggerFactoryTest.java b/src/test/java/org/jboss/netty/logging/Slf4JLoggerFactoryTest.java index 0e4a2aa8f1..bad50cefec 100644 --- a/src/test/java/org/jboss/netty/logging/Slf4JLoggerFactoryTest.java +++ b/src/test/java/org/jboss/netty/logging/Slf4JLoggerFactoryTest.java @@ -23,9 +23,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class Slf4JLoggerFactoryTest { diff --git a/src/test/java/org/jboss/netty/logging/Slf4JLoggerTest.java b/src/test/java/org/jboss/netty/logging/Slf4JLoggerTest.java index a14f36feca..db0fa9fc7a 100644 --- a/src/test/java/org/jboss/netty/logging/Slf4JLoggerTest.java +++ b/src/test/java/org/jboss/netty/logging/Slf4JLoggerTest.java @@ -24,9 +24,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class Slf4JLoggerTest { private static final Exception e = new Exception(); diff --git a/src/test/java/org/jboss/netty/util/DebugUtilTest.java b/src/test/java/org/jboss/netty/util/DebugUtilTest.java index 3cda4802c3..62fcfe20e2 100644 --- a/src/test/java/org/jboss/netty/util/DebugUtilTest.java +++ b/src/test/java/org/jboss/netty/util/DebugUtilTest.java @@ -27,9 +27,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class DebugUtilTest { diff --git a/src/test/java/org/jboss/netty/util/DummyHandler.java b/src/test/java/org/jboss/netty/util/DummyHandler.java index 4885f91a57..67e9df7450 100644 --- a/src/test/java/org/jboss/netty/util/DummyHandler.java +++ b/src/test/java/org/jboss/netty/util/DummyHandler.java @@ -25,8 +25,6 @@ import org.jboss.netty.channel.ChannelUpstreamHandler; * * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ */ public class DummyHandler implements ChannelUpstreamHandler, ChannelDownstreamHandler { diff --git a/src/test/java/org/jboss/netty/util/MapBackedSetTest.java b/src/test/java/org/jboss/netty/util/MapBackedSetTest.java index 54d45c036c..89002aa5d8 100644 --- a/src/test/java/org/jboss/netty/util/MapBackedSetTest.java +++ b/src/test/java/org/jboss/netty/util/MapBackedSetTest.java @@ -28,9 +28,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class MapBackedSetTest { diff --git a/src/test/java/org/jboss/netty/util/TestUtil.java b/src/test/java/org/jboss/netty/util/TestUtil.java index 7a52d0fcef..000db49d79 100644 --- a/src/test/java/org/jboss/netty/util/TestUtil.java +++ b/src/test/java/org/jboss/netty/util/TestUtil.java @@ -22,7 +22,6 @@ import java.net.UnknownHostException; /** * @author The Netty Project * @author Trustin Lee - * @version $Rev$, $Date$ */ @org.junit.Ignore public final class TestUtil { diff --git a/src/test/java/org/jboss/netty/util/internal/ConversionUtilTest.java b/src/test/java/org/jboss/netty/util/internal/ConversionUtilTest.java index 6c112a2699..01723d5325 100644 --- a/src/test/java/org/jboss/netty/util/internal/ConversionUtilTest.java +++ b/src/test/java/org/jboss/netty/util/internal/ConversionUtilTest.java @@ -23,9 +23,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class ConversionUtilTest { diff --git a/src/test/java/org/jboss/netty/util/internal/StackTraceSimplifierTest.java b/src/test/java/org/jboss/netty/util/internal/StackTraceSimplifierTest.java index b8a4735e89..414d3df827 100644 --- a/src/test/java/org/jboss/netty/util/internal/StackTraceSimplifierTest.java +++ b/src/test/java/org/jboss/netty/util/internal/StackTraceSimplifierTest.java @@ -29,9 +29,6 @@ import org.junit.Test; /** * @author The Netty Project * @author Trustin Lee - * - * @version $Rev$, $Date$ - * */ public class StackTraceSimplifierTest { diff --git a/src/test/java/org/jboss/netty/util/internal/StringUtilTest.java b/src/test/java/org/jboss/netty/util/internal/StringUtilTest.java index 1c1933a444..0370978576 100644 --- a/src/test/java/org/jboss/netty/util/internal/StringUtilTest.java +++ b/src/test/java/org/jboss/netty/util/internal/StringUtilTest.java @@ -21,11 +21,9 @@ import org.junit.Test; /** * Unit test for {@link StringUtil}. - *

* * @author The Netty Project * @author Daniel Bevenius (dbevenius@jboss.com) - * @version $Rev$, $Date$ */ public class StringUtilTest { From 0d5c7d3d2e8a0de5aa48ecfc3bb761e90c633026 Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 1 Dec 2011 14:12:24 +0100 Subject: [PATCH 93/93] Make sure the cumulation Buffer is only created if really needed. See #88 --- .../handler/codec/frame/FrameDecoder.java | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java index 300b6fb510..2323ab9967 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java @@ -205,17 +205,28 @@ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler { return; } - ChannelBuffer cumulation = cumulation(ctx); - if (cumulation.readable()) { - cumulation.discardReadBytes(); - cumulation.writeBytes(input); - callDecode(ctx, e.getChannel(), cumulation, e.getRemoteAddress()); - } else { + if (cumulation == null) { + // the cumulation buffer is not created yet so just pass the input to callDecode(...) method callDecode(ctx, e.getChannel(), input, e.getRemoteAddress()); if (input.readable()) { + // seems like there is something readable left in the input buffer. So create the cumulation buffer and copy the input into it + ChannelBuffer cumulation = cumulation(ctx); cumulation.writeBytes(input); } + } else { + ChannelBuffer cumulation = cumulation(ctx); + if (cumulation.readable()) { + cumulation.discardReadBytes(); + cumulation.writeBytes(input); + callDecode(ctx, e.getChannel(), cumulation, e.getRemoteAddress()); + } else { + callDecode(ctx, e.getChannel(), input, e.getRemoteAddress()); + if (input.readable()) { + cumulation.writeBytes(input); + } + } } + } @Override @@ -347,6 +358,12 @@ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler { } } + /** + * Get the currently used {@link ChannelBuffer} for cumulation or create one in a lazy fashion if none exist yet + * + * @param ctx the {@link ChannelHandlerContext} for this handler + * @return buffer the {@link ChannelBuffer} which is used fo cumulation + */ private ChannelBuffer cumulation(ChannelHandlerContext ctx) { ChannelBuffer c = cumulation; if (c == null) {