http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationCodecFactory.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationCodecFactory.java b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationCodecFactory.java index 5064751..fefe24e 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationCodecFactory.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationCodecFactory.java @@ -47,22 +47,30 @@ public class ObjectSerializationCodecFactory implements ProtocolCodecFactory { /** * Creates a new instance with the specified {@link ClassLoader}. + * + * @param classLoader The class loader to use */ public ObjectSerializationCodecFactory(ClassLoader classLoader) { encoder = new ObjectSerializationEncoder(); decoder = new ObjectSerializationDecoder(classLoader); } + /** + * {@inheritDoc} + */ public ProtocolEncoder getEncoder(IoSession session) { return encoder; } + /** + * {@inheritDoc} + */ public ProtocolDecoder getDecoder(IoSession session) { return decoder; } /** - * Returns the allowed maximum size of the encoded object. + * @return the allowed maximum size of the encoded object. * If the size of the encoded object exceeds this value, the encoder * will throw a {@link IllegalArgumentException}. The default value * is {@link Integer#MAX_VALUE}. @@ -80,13 +88,15 @@ public class ObjectSerializationCodecFactory implements ProtocolCodecFactory { * is {@link Integer#MAX_VALUE}. * <p> * This method does the same job with {@link ObjectSerializationEncoder#setMaxObjectSize(int)}. + * + * @param maxObjectSize The maximum size of the encoded object */ public void setEncoderMaxObjectSize(int maxObjectSize) { encoder.setMaxObjectSize(maxObjectSize); } /** - * Returns the allowed maximum size of the object to be decoded. + * @return the allowed maximum size of the object to be decoded. * If the size of the object to be decoded exceeds this value, the * decoder will throw a {@link BufferDataException}. The default * value is <tt>1048576</tt> (1MB). @@ -104,6 +114,8 @@ public class ObjectSerializationCodecFactory implements ProtocolCodecFactory { * value is <tt>1048576</tt> (1MB). * <p> * This method does the same job with {@link ObjectSerializationDecoder#setMaxObjectSize(int)}. + * + * @param maxObjectSize The maximum size of the decoded object */ public void setDecoderMaxObjectSize(int maxObjectSize) { decoder.setMaxObjectSize(maxObjectSize);
http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationDecoder.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationDecoder.java b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationDecoder.java index a988274..caf9468 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationDecoder.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationDecoder.java @@ -49,6 +49,8 @@ public class ObjectSerializationDecoder extends CumulativeProtocolDecoder { /** * Creates a new instance with the specified {@link ClassLoader}. + * + * @param classLoader The class loader to use */ public ObjectSerializationDecoder(ClassLoader classLoader) { if (classLoader == null) { @@ -58,7 +60,7 @@ public class ObjectSerializationDecoder extends CumulativeProtocolDecoder { } /** - * Returns the allowed maximum size of the object to be decoded. + * @return the allowed maximum size of the object to be decoded. * If the size of the object to be decoded exceeds this value, this * decoder will throw a {@link BufferDataException}. The default * value is <tt>1048576</tt> (1MB). @@ -72,6 +74,8 @@ public class ObjectSerializationDecoder extends CumulativeProtocolDecoder { * If the size of the object to be decoded exceeds this value, this * decoder will throw a {@link BufferDataException}. The default * value is <tt>1048576</tt> (1MB). + * + * @param maxObjectSize The maximum size for an object to be decoded */ public void setMaxObjectSize(int maxObjectSize) { if (maxObjectSize <= 0) { @@ -81,6 +85,9 @@ public class ObjectSerializationDecoder extends CumulativeProtocolDecoder { this.maxObjectSize = maxObjectSize; } + /** + * {@inheritDoc} + */ @Override protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { if (!in.prefixedDataAvailable(4, maxObjectSize)) { http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationEncoder.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationEncoder.java b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationEncoder.java index fad0191..93fe4ee 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationEncoder.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationEncoder.java @@ -45,7 +45,7 @@ public class ObjectSerializationEncoder extends ProtocolEncoderAdapter { } /** - * Returns the allowed maximum size of the encoded object. + * @return the allowed maximum size of the encoded object. * If the size of the encoded object exceeds this value, this encoder * will throw a {@link IllegalArgumentException}. The default value * is {@link Integer#MAX_VALUE}. @@ -59,6 +59,8 @@ public class ObjectSerializationEncoder extends ProtocolEncoderAdapter { * If the size of the encoded object exceeds this value, this encoder * will throw a {@link IllegalArgumentException}. The default value * is {@link Integer#MAX_VALUE}. + * + * @param maxObjectSize the maximum size for an encoded object */ public void setMaxObjectSize(int maxObjectSize) { if (maxObjectSize <= 0) { @@ -68,6 +70,9 @@ public class ObjectSerializationEncoder extends ProtocolEncoderAdapter { this.maxObjectSize = maxObjectSize; } + /** + * {@inheritDoc} + */ public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception { if (!(message instanceof Serializable)) { throw new NotSerializableException(); http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationInputStream.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationInputStream.java b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationInputStream.java index 13f9373..d9fa1c4 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationInputStream.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationInputStream.java @@ -43,14 +43,24 @@ public class ObjectSerializationInputStream extends InputStream implements Objec private int maxObjectSize = 1048576; + /** + * Create a new instance of an ObjectSerializationInputStream + * @param in The {@link InputStream} to use + */ public ObjectSerializationInputStream(InputStream in) { this(in, null); } + /** + * Create a new instance of an ObjectSerializationInputStream + * @param in The {@link InputStream} to use + * @param classLoader The class loader to use + */ public ObjectSerializationInputStream(InputStream in, ClassLoader classLoader) { if (in == null) { throw new IllegalArgumentException("in"); } + if (classLoader == null) { classLoader = Thread.currentThread().getContextClassLoader(); } @@ -65,7 +75,7 @@ public class ObjectSerializationInputStream extends InputStream implements Objec } /** - * Returns the allowed maximum size of the object to be decoded. + * @return the allowed maximum size of the object to be decoded. * If the size of the object to be decoded exceeds this value, this * decoder will throw a {@link BufferDataException}. The default * value is <tt>1048576</tt> (1MB). @@ -79,6 +89,8 @@ public class ObjectSerializationInputStream extends InputStream implements Objec * If the size of the object to be decoded exceeds this value, this * decoder will throw a {@link BufferDataException}. The default * value is <tt>1048576</tt> (1MB). + * + * @param maxObjectSize The maximum decoded object size */ public void setMaxObjectSize(int maxObjectSize) { if (maxObjectSize <= 0) { @@ -88,11 +100,17 @@ public class ObjectSerializationInputStream extends InputStream implements Objec this.maxObjectSize = maxObjectSize; } + /** + * {@inheritDoc} + */ @Override public int read() throws IOException { return in.read(); } + /** + * {@inheritDoc} + */ public Object readObject() throws ClassNotFoundException, IOException { int objectSize = in.readInt(); if (objectSize <= 0) { @@ -112,34 +130,58 @@ public class ObjectSerializationInputStream extends InputStream implements Objec return buf.getObject(classLoader); } + /** + * {@inheritDoc} + */ public boolean readBoolean() throws IOException { return in.readBoolean(); } + /** + * {@inheritDoc} + */ public byte readByte() throws IOException { return in.readByte(); } + /** + * {@inheritDoc} + */ public char readChar() throws IOException { return in.readChar(); } + /** + * {@inheritDoc} + */ public double readDouble() throws IOException { return in.readDouble(); } + /** + * {@inheritDoc} + */ public float readFloat() throws IOException { return in.readFloat(); } + /** + * {@inheritDoc} + */ public void readFully(byte[] b) throws IOException { in.readFully(b); } + /** + * {@inheritDoc} + */ public void readFully(byte[] b, int off, int len) throws IOException { in.readFully(b, off, len); } + /** + * {@inheritDoc} + */ public int readInt() throws IOException { return in.readInt(); } @@ -153,26 +195,44 @@ public class ObjectSerializationInputStream extends InputStream implements Objec return in.readLine(); } + /** + * {@inheritDoc} + */ public long readLong() throws IOException { return in.readLong(); } + /** + * {@inheritDoc} + */ public short readShort() throws IOException { return in.readShort(); } + /** + * {@inheritDoc} + */ public String readUTF() throws IOException { return in.readUTF(); } + /** + * {@inheritDoc} + */ public int readUnsignedByte() throws IOException { return in.readUnsignedByte(); } + /** + * {@inheritDoc} + */ public int readUnsignedShort() throws IOException { return in.readUnsignedShort(); } + /** + * {@inheritDoc} + */ public int skipBytes(int n) throws IOException { return in.skipBytes(n); } http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationOutputStream.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationOutputStream.java b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationOutputStream.java index 6cb3db5..eea063c 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationOutputStream.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/serialization/ObjectSerializationOutputStream.java @@ -21,6 +21,7 @@ package org.apache.mina.filter.codec.serialization; import java.io.DataOutputStream; import java.io.IOException; +import java.io.InputStream; import java.io.ObjectOutput; import java.io.OutputStream; @@ -38,6 +39,10 @@ public class ObjectSerializationOutputStream extends OutputStream implements Obj private int maxObjectSize = Integer.MAX_VALUE; + /** + * Create a new instance of an ObjectSerializationOutputStream + * @param out The {@link OutputStream} to use + */ public ObjectSerializationOutputStream(OutputStream out) { if (out == null) { throw new IllegalArgumentException("out"); @@ -51,7 +56,7 @@ public class ObjectSerializationOutputStream extends OutputStream implements Obj } /** - * Returns the allowed maximum size of the encoded object. + * @return the allowed maximum size of the encoded object. * If the size of the encoded object exceeds this value, this encoder * will throw a {@link IllegalArgumentException}. The default value * is {@link Integer#MAX_VALUE}. @@ -65,6 +70,8 @@ public class ObjectSerializationOutputStream extends OutputStream implements Obj * If the size of the encoded object exceeds this value, this encoder * will throw a {@link IllegalArgumentException}. The default value * is {@link Integer#MAX_VALUE}. + * + * @param maxObjectSize The maximum object size */ public void setMaxObjectSize(int maxObjectSize) { if (maxObjectSize <= 0) { @@ -74,31 +81,49 @@ public class ObjectSerializationOutputStream extends OutputStream implements Obj this.maxObjectSize = maxObjectSize; } + /** + * {@inheritDoc} + */ @Override public void close() throws IOException { out.close(); } + /** + * {@inheritDoc} + */ @Override public void flush() throws IOException { out.flush(); } + /** + * {@inheritDoc} + */ @Override public void write(int b) throws IOException { out.write(b); } + /** + * {@inheritDoc} + */ @Override public void write(byte[] b) throws IOException { out.write(b); } + /** + * {@inheritDoc} + */ @Override public void write(byte[] b, int off, int len) throws IOException { out.write(b, off, len); } + /** + * {@inheritDoc} + */ public void writeObject(Object obj) throws IOException { IoBuffer buf = IoBuffer.allocate(64, false); buf.setAutoExpand(true); @@ -113,46 +138,79 @@ public class ObjectSerializationOutputStream extends OutputStream implements Obj out.write(buf.array(), 0, buf.position()); } + /** + * {@inheritDoc} + */ public void writeBoolean(boolean v) throws IOException { out.writeBoolean(v); } + /** + * {@inheritDoc} + */ public void writeByte(int v) throws IOException { out.writeByte(v); } + /** + * {@inheritDoc} + */ public void writeBytes(String s) throws IOException { out.writeBytes(s); } + /** + * {@inheritDoc} + */ public void writeChar(int v) throws IOException { out.writeChar(v); } + /** + * {@inheritDoc} + */ public void writeChars(String s) throws IOException { out.writeChars(s); } + /** + * {@inheritDoc} + */ public void writeDouble(double v) throws IOException { out.writeDouble(v); } + /** + * {@inheritDoc} + */ public void writeFloat(float v) throws IOException { out.writeFloat(v); } + /** + * {@inheritDoc} + */ public void writeInt(int v) throws IOException { out.writeInt(v); } + /** + * {@inheritDoc} + */ public void writeLong(long v) throws IOException { out.writeLong(v); } + /** + * {@inheritDoc} + */ public void writeShort(int v) throws IOException { out.writeShort(v); } + /** + * {@inheritDoc} + */ public void writeUTF(String str) throws IOException { out.writeUTF(str); } http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateMachine.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateMachine.java b/mina-core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateMachine.java index d38ba52..54bdb6f 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateMachine.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/statemachine/DecodingStateMachine.java @@ -70,6 +70,7 @@ public abstract class DecodingStateMachine implements DecodingState { * Invoked to initialize this state machine. * * @return the start {@link DecodingState}. + * @throws Exception if the initialization failed */ protected abstract DecodingState init() throws Exception; @@ -82,6 +83,7 @@ public abstract class DecodingStateMachine implements DecodingState { * @param out the real {@link ProtocolDecoderOutput} used by the * {@link ProtocolCodecFilter}. * @return the next state if the state machine should resume. + * @throws Exception if the decoding end failed */ protected abstract DecodingState finishDecode(List<Object> childProducts, ProtocolDecoderOutput out) throws Exception; @@ -89,6 +91,8 @@ public abstract class DecodingStateMachine implements DecodingState { /** * Invoked to destroy this state machine once the end state has been reached * or the session has been closed. + * + * @throws Exception if the destruction failed */ protected abstract void destroy() throws Exception; http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/textline/LineDelimiter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/textline/LineDelimiter.java b/mina-core/src/main/java/org/apache/mina/filter/codec/textline/LineDelimiter.java index 5388944..9910f99 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/textline/LineDelimiter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/textline/LineDelimiter.java @@ -85,6 +85,8 @@ public class LineDelimiter { /** * Creates a new line delimiter with the specified <tt>value</tt>. + * + * @param value The new Line Delimiter */ public LineDelimiter(String value) { if (value == null) { @@ -95,7 +97,7 @@ public class LineDelimiter { } /** - * Return the delimiter string. + * @return the delimiter string. */ public String getValue() { return value; http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java b/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java index ec86de8..b6f7374 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java @@ -52,8 +52,7 @@ public class TextLineCodecFactory implements ProtocolCodecFactory { * encoder uses a UNIX {@link LineDelimiter} and the decoder uses * the AUTO {@link LineDelimiter}. * - * @param charset - * The charset to use in the encoding and decoding + * @param charset The charset to use in the encoding and decoding */ public TextLineCodecFactory(Charset charset) { encoder = new TextLineEncoder(charset, LineDelimiter.UNIX); @@ -92,16 +91,22 @@ public class TextLineCodecFactory implements ProtocolCodecFactory { decoder = new TextLineDecoder(charset, decodingDelimiter); } + /** + * {@inheritDoc} + */ public ProtocolEncoder getEncoder(IoSession session) { return encoder; } + /** + * {@inheritDoc} + */ public ProtocolDecoder getDecoder(IoSession session) { return decoder; } /** - * Returns the allowed maximum size of the encoded line. + * @return the allowed maximum size of the encoded line. * If the size of the encoded line exceeds this value, the encoder * will throw a {@link IllegalArgumentException}. The default value * is {@link Integer#MAX_VALUE}. @@ -119,13 +124,15 @@ public class TextLineCodecFactory implements ProtocolCodecFactory { * is {@link Integer#MAX_VALUE}. * <p> * This method does the same job with {@link TextLineEncoder#setMaxLineLength(int)}. + * + * @param maxLineLength The maximum encoded line length */ public void setEncoderMaxLineLength(int maxLineLength) { encoder.setMaxLineLength(maxLineLength); } /** - * Returns the allowed maximum size of the line to be decoded. + * @return the allowed maximum size of the line to be decoded. * If the size of the line to be decoded exceeds this value, the * decoder will throw a {@link BufferDataException}. The default * value is <tt>1024</tt> (1KB). @@ -143,6 +150,8 @@ public class TextLineCodecFactory implements ProtocolCodecFactory { * value is <tt>1024</tt> (1KB). * <p> * This method does the same job with {@link TextLineDecoder#setMaxLineLength(int)}. + * + * @param maxLineLength the maximum decoded line length */ public void setDecoderMaxLineLength(int maxLineLength) { decoder.setMaxLineLength(maxLineLength); http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java b/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java index 84699f2..a42ee27 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineDecoder.java @@ -67,6 +67,8 @@ public class TextLineDecoder implements ProtocolDecoder { /** * Creates a new instance with the current default {@link Charset} * and the specified <tt>delimiter</tt>. + * + * @param delimiter The line delimiter to use */ public TextLineDecoder(String delimiter) { this(new LineDelimiter(delimiter)); @@ -75,6 +77,8 @@ public class TextLineDecoder implements ProtocolDecoder { /** * Creates a new instance with the current default {@link Charset} * and the specified <tt>delimiter</tt>. + * + * @param delimiter The line delimiter to use */ public TextLineDecoder(LineDelimiter delimiter) { this(Charset.defaultCharset(), delimiter); @@ -83,6 +87,8 @@ public class TextLineDecoder implements ProtocolDecoder { /** * Creates a new instance with the spcified <tt>charset</tt> * and {@link LineDelimiter#AUTO} delimiter. + * + * @param charset The {@link Charset} to use */ public TextLineDecoder(Charset charset) { this(charset, LineDelimiter.AUTO); @@ -91,6 +97,9 @@ public class TextLineDecoder implements ProtocolDecoder { /** * Creates a new instance with the spcified <tt>charset</tt> * and the specified <tt>delimiter</tt>. + * + * @param charset The {@link Charset} to use + * @param delimiter The line delimiter to use */ public TextLineDecoder(Charset charset, String delimiter) { this(charset, new LineDelimiter(delimiter)); @@ -99,6 +108,9 @@ public class TextLineDecoder implements ProtocolDecoder { /** * Creates a new instance with the specified <tt>charset</tt> * and the specified <tt>delimiter</tt>. + * + * @param charset The {@link Charset} to use + * @param delimiter The line delimiter to use */ public TextLineDecoder(Charset charset, LineDelimiter delimiter) { if (charset == null) { @@ -128,7 +140,7 @@ public class TextLineDecoder implements ProtocolDecoder { } /** - * Returns the allowed maximum size of the line to be decoded. + * @return the allowed maximum size of the line to be decoded. * If the size of the line to be decoded exceeds this value, the * decoder will throw a {@link BufferDataException}. The default * value is <tt>1024</tt> (1KB). @@ -142,6 +154,8 @@ public class TextLineDecoder implements ProtocolDecoder { * If the size of the line to be decoded exceeds this value, the * decoder will throw a {@link BufferDataException}. The default * value is <tt>1024</tt> (1KB). + * + * @param maxLineLength The maximum line length */ public void setMaxLineLength(int maxLineLength) { if (maxLineLength <= 0) { @@ -167,7 +181,7 @@ public class TextLineDecoder implements ProtocolDecoder { } /** - * Returns the allowed buffer size used to store the decoded line + * @return the allowed buffer size used to store the decoded line * in the Context instance. */ public int getBufferLength() { @@ -188,7 +202,9 @@ public class TextLineDecoder implements ProtocolDecoder { } /** - * Return the context for this session + * @return the context for this session + * + * @param session The session for which we want the context */ private Context getContext(IoSession session) { Context ctx; http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineEncoder.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineEncoder.java b/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineEncoder.java index 4588298..27003da 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineEncoder.java +++ b/mina-core/src/main/java/org/apache/mina/filter/codec/textline/TextLineEncoder.java @@ -55,6 +55,8 @@ public class TextLineEncoder extends ProtocolEncoderAdapter { /** * Creates a new instance with the current default {@link Charset} * and the specified <tt>delimiter</tt>. + * + * @param delimiter The line delimiter to use */ public TextLineEncoder(String delimiter) { this(new LineDelimiter(delimiter)); @@ -63,30 +65,40 @@ public class TextLineEncoder extends ProtocolEncoderAdapter { /** * Creates a new instance with the current default {@link Charset} * and the specified <tt>delimiter</tt>. + * + * @param delimiter The line delimiter to use */ public TextLineEncoder(LineDelimiter delimiter) { this(Charset.defaultCharset(), delimiter); } /** - * Creates a new instance with the spcified <tt>charset</tt> + * Creates a new instance with the specified <tt>charset</tt> * and {@link LineDelimiter#UNIX} delimiter. + * + * @param charset The {@link Charset} to use */ public TextLineEncoder(Charset charset) { this(charset, LineDelimiter.UNIX); } /** - * Creates a new instance with the spcified <tt>charset</tt> + * Creates a new instance with the specified <tt>charset</tt> * and the specified <tt>delimiter</tt>. + * + * @param charset The {@link Charset} to use + * @param delimiter The line delimiter to use */ public TextLineEncoder(Charset charset, String delimiter) { this(charset, new LineDelimiter(delimiter)); } /** - * Creates a new instance with the spcified <tt>charset</tt> + * Creates a new instance with the specified <tt>charset</tt> * and the specified <tt>delimiter</tt>. + * + * @param charset The {@link Charset} to use + * @param delimiter The line delimiter to use */ public TextLineEncoder(Charset charset, LineDelimiter delimiter) { if (charset == null) { @@ -104,7 +116,7 @@ public class TextLineEncoder extends ProtocolEncoderAdapter { } /** - * Returns the allowed maximum size of the encoded line. + * @return the allowed maximum size of the encoded line. * If the size of the encoded line exceeds this value, the encoder * will throw a {@link IllegalArgumentException}. The default value * is {@link Integer#MAX_VALUE}. @@ -118,6 +130,8 @@ public class TextLineEncoder extends ProtocolEncoderAdapter { * If the size of the encoded line exceeds this value, the encoder * will throw a {@link IllegalArgumentException}. The default value * is {@link Integer#MAX_VALUE}. + * + * @param maxLineLength The maximum line length */ public void setMaxLineLength(int maxLineLength) { if (maxLineLength <= 0) { @@ -127,6 +141,9 @@ public class TextLineEncoder extends ProtocolEncoderAdapter { this.maxLineLength = maxLineLength; } + /** + * {@inheritDoc} + */ public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception { CharsetEncoder encoder = (CharsetEncoder) session.getAttribute(ENCODER); @@ -148,6 +165,9 @@ public class TextLineEncoder extends ProtocolEncoderAdapter { out.write(buf); } + /** + * {@inheritDoc} + */ public void dispose() throws Exception { // Do nothing } http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java b/mina-core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java index 4b0400a..6ab6acc 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/errorgenerating/ErrorGeneratingFilter.java @@ -211,7 +211,7 @@ public class ErrorGeneratingFilter extends IoFilterAdapter { /** * not functional ATM - * @param duplicatePduProbability + * @param duplicatePduProbability The probability for generating duplicated PDU */ public void setDuplicatePduProbability(int duplicatePduProbability) { this.duplicatePduProbability = duplicatePduProbability; @@ -237,7 +237,8 @@ public class ErrorGeneratingFilter extends IoFilterAdapter { /** * Set to true if you want to apply error to the read {@link IoBuffer} - * @param manipulateReads + * + * @param manipulateReads The number of manipulated reads */ public void setManipulateReads(boolean manipulateReads) { this.manipulateReads = manipulateReads; @@ -249,7 +250,8 @@ public class ErrorGeneratingFilter extends IoFilterAdapter { /** * Set to true if you want to apply error to the written {@link IoBuffer} - * @param manipulateWrites + * + * @param manipulateWrites The umber of manipulated writes */ public void setManipulateWrites(boolean manipulateWrites) { this.manipulateWrites = manipulateWrites; @@ -263,6 +265,7 @@ public class ErrorGeneratingFilter extends IoFilterAdapter { * Set the probability for the remove byte error. * If this probability is > 0 the filter will remove a random number of byte * in the processed {@link IoBuffer}. + * * @param removeByteProbability probability of modifying an {@link IoBuffer} out of 1000 processed IoBuffer */ public void setRemoveByteProbability(int removeByteProbability) { @@ -275,7 +278,7 @@ public class ErrorGeneratingFilter extends IoFilterAdapter { /** * not functional ATM - * @param removePduProbability + * @param removePduProbability The PDU removal probability */ public void setRemovePduProbability(int removePduProbability) { this.removePduProbability = removePduProbability; @@ -287,7 +290,7 @@ public class ErrorGeneratingFilter extends IoFilterAdapter { /** * not functional ATM - * @param resendPduLasterProbability + * @param resendPduLasterProbability The delay before a resend */ public void setResendPduLasterProbability(int resendPduLasterProbability) { this.resendPduLasterProbability = resendPduLasterProbability; http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java b/mina-core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java index 47cd3a2..7d76b36 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java @@ -495,9 +495,7 @@ public class ExecutorFilter extends IoFilterAdapter { } /** - * Returns the underlying {@link Executor} instance this filter uses. - * - * @return The underlying {@link Executor} + * @return the underlying {@link Executor} instance this filter uses. */ public final Executor getExecutor() { return executor; http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/executor/IoEventQueueHandler.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/executor/IoEventQueueHandler.java b/mina-core/src/main/java/org/apache/mina/filter/executor/IoEventQueueHandler.java index 76326f0..9c0cbaf 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/executor/IoEventQueueHandler.java +++ b/mina-core/src/main/java/org/apache/mina/filter/executor/IoEventQueueHandler.java @@ -49,21 +49,30 @@ public interface IoEventQueueHandler extends EventListener { }; /** - * Returns <tt>true</tt> if and only if the specified <tt>event</tt> is + * @return <tt>true</tt> if and only if the specified <tt>event</tt> is * allowed to be offered to the event queue. The <tt>event</tt> is dropped * if <tt>false</tt> is returned. + * + * @param source The source of event + * @param event The received event */ boolean accept(Object source, IoEvent event); /** * Invoked after the specified <tt>event</tt> has been offered to the * event queue. + * + * @param source The source of event + * @param event The received event */ void offered(Object source, IoEvent event); /** * Invoked after the specified <tt>event</tt> has been polled from the * event queue. + * + * @param source The source of event + * @param event The received event */ void polled(Object source, IoEvent event); } http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/executor/WriteRequestFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/executor/WriteRequestFilter.java b/mina-core/src/main/java/org/apache/mina/filter/executor/WriteRequestFilter.java index 9a88f28..1485d5a 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/executor/WriteRequestFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/executor/WriteRequestFilter.java @@ -73,6 +73,8 @@ public class WriteRequestFilter extends IoFilterAdapter { /** * Creates a new instance with the specified {@link IoEventQueueHandler}. + * + * @param queueHandler The {@link IoEventQueueHandler} instance to use */ public WriteRequestFilter(IoEventQueueHandler queueHandler) { if (queueHandler == null) { @@ -82,7 +84,7 @@ public class WriteRequestFilter extends IoFilterAdapter { } /** - * Returns the {@link IoEventQueueHandler} which is attached to this + * @return the {@link IoEventQueueHandler} which is attached to this * filter. */ public IoEventQueueHandler getQueueHandler() { http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java b/mina-core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java index 19819d7..5126d35 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java @@ -128,6 +128,8 @@ public class BlacklistFilter extends IoFilterAdapter { /** * Blocks the specified endpoint. + * + * @param address The address to block */ public void block(InetAddress address) { if (address == null) { @@ -139,6 +141,8 @@ public class BlacklistFilter extends IoFilterAdapter { /** * Blocks the specified subnet. + * + * @param subnet The subnet to block */ public void block(Subnet subnet) { if (subnet == null) { @@ -150,6 +154,8 @@ public class BlacklistFilter extends IoFilterAdapter { /** * Unblocks the specified endpoint. + * + * @param address The address to unblock */ public void unblock(InetAddress address) { if (address == null) { @@ -161,6 +167,8 @@ public class BlacklistFilter extends IoFilterAdapter { /** * Unblocks the specified subnet. + * + * @param subnet The subnet to unblock */ public void unblock(Subnet subnet) { if (subnet == null) { http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveFilter.java b/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveFilter.java index 7f2b463..d7fdbbc 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveFilter.java @@ -182,6 +182,8 @@ public class KeepAliveFilter extends IoFilterAdapter { * <li><tt>keepAliveRequestInterval</tt> - 60 (seconds)</li> * <li><tt>keepAliveRequestTimeout</tt> - 30 (seconds)</li> * </ul> + * + * @param messageFactory The message factory to use */ public KeepAliveFilter(KeepAliveMessageFactory messageFactory) { this(messageFactory, IdleStatus.READER_IDLE, KeepAliveRequestTimeoutHandler.CLOSE); @@ -195,6 +197,9 @@ public class KeepAliveFilter extends IoFilterAdapter { * <li><tt>keepAliveRequestInterval</tt> - 60 (seconds)</li> * <li><tt>keepAliveRequestTimeout</tt> - 30 (seconds)</li> * </ul> + * + * @param messageFactory The message factory to use + * @param interestedIdleStatus The IdleStatus the filter is interested in */ public KeepAliveFilter(KeepAliveMessageFactory messageFactory, IdleStatus interestedIdleStatus) { this(messageFactory, interestedIdleStatus, KeepAliveRequestTimeoutHandler.CLOSE, 60, 30); @@ -208,6 +213,9 @@ public class KeepAliveFilter extends IoFilterAdapter { * <li><tt>keepAliveRequestInterval</tt> - 60 (seconds)</li> * <li><tt>keepAliveRequestTimeout</tt> - 30 (seconds)</li> * </ul> + * + * @param messageFactory The message factory to use + * @param policy The TimeOut handler policy */ public KeepAliveFilter(KeepAliveMessageFactory messageFactory, KeepAliveRequestTimeoutHandler policy) { this(messageFactory, IdleStatus.READER_IDLE, policy, 60, 30); @@ -220,6 +228,10 @@ public class KeepAliveFilter extends IoFilterAdapter { * <li><tt>keepAliveRequestInterval</tt> - 60 (seconds)</li> * <li><tt>keepAliveRequestTimeout</tt> - 30 (seconds)</li> * </ul> + * + * @param messageFactory The message factory to use + * @param interestedIdleStatus The IdleStatus the filter is interested in + * @param policy The TimeOut handler policy */ public KeepAliveFilter(KeepAliveMessageFactory messageFactory, IdleStatus interestedIdleStatus, KeepAliveRequestTimeoutHandler policy) { @@ -228,15 +240,23 @@ public class KeepAliveFilter extends IoFilterAdapter { /** * Creates a new instance. + * + * @param messageFactory The message factory to use + * @param interestedIdleStatus The IdleStatus the filter is interested in + * @param policy The TimeOut handler policy + * @param keepAliveRequestInterval the interval to use + * @param keepAliveRequestTimeout The timeout to use */ public KeepAliveFilter(KeepAliveMessageFactory messageFactory, IdleStatus interestedIdleStatus, KeepAliveRequestTimeoutHandler policy, int keepAliveRequestInterval, int keepAliveRequestTimeout) { if (messageFactory == null) { throw new IllegalArgumentException("messageFactory"); } + if (interestedIdleStatus == null) { throw new IllegalArgumentException("interestedIdleStatus"); } + if (policy == null) { throw new IllegalArgumentException("policy"); } @@ -249,14 +269,25 @@ public class KeepAliveFilter extends IoFilterAdapter { setRequestTimeout(keepAliveRequestTimeout); } + /** + * @return The {@link IdleStatus} + */ public IdleStatus getInterestedIdleStatus() { return interestedIdleStatus; } + /** + * @return The timeout request handler + */ public KeepAliveRequestTimeoutHandler getRequestTimeoutHandler() { return requestTimeoutHandler; } + /** + * Set the timeout handler + * + * @param timeoutHandler The instance of {@link KeepAliveRequestTimeoutHandler} to use + */ public void setRequestTimeoutHandler(KeepAliveRequestTimeoutHandler timeoutHandler) { if (timeoutHandler == null) { throw new IllegalArgumentException("timeoutHandler"); @@ -264,36 +295,57 @@ public class KeepAliveFilter extends IoFilterAdapter { requestTimeoutHandler = timeoutHandler; } + /** + * @return the interval for keep alive messages + */ public int getRequestInterval() { return requestInterval; } + /** + * Sets the interval for keepAlive messages + * + * @param keepAliveRequestInterval the interval to set + */ public void setRequestInterval(int keepAliveRequestInterval) { if (keepAliveRequestInterval <= 0) { throw new IllegalArgumentException("keepAliveRequestInterval must be a positive integer: " + keepAliveRequestInterval); } + requestInterval = keepAliveRequestInterval; } + /** + * @return The timeout + */ public int getRequestTimeout() { return requestTimeout; } + /** + * Sets the timeout + * + * @param keepAliveRequestTimeout The timeout to set + */ public void setRequestTimeout(int keepAliveRequestTimeout) { if (keepAliveRequestTimeout <= 0) { throw new IllegalArgumentException("keepAliveRequestTimeout must be a positive integer: " + keepAliveRequestTimeout); } + requestTimeout = keepAliveRequestTimeout; } + /** + * @return The message factory + */ public KeepAliveMessageFactory getMessageFactory() { return messageFactory; } /** - * Returns <tt>true</tt> if and only if this filter forwards + * @return <tt>true</tt> if and only if this filter forwards * a {@link IoEventType#SESSION_IDLE} event to the next filter. * By default, the value of this property is <tt>false</tt>. */ @@ -305,11 +357,16 @@ public class KeepAliveFilter extends IoFilterAdapter { * Sets if this filter needs to forward a * {@link IoEventType#SESSION_IDLE} event to the next filter. * By default, the value of this property is <tt>false</tt>. + * + * @param forwardEvent a flag set to tell if the filter has to forward a {@link IoEventType#SESSION_IDLE} event */ public void setForwardEvent(boolean forwardEvent) { this.forwardEvent = forwardEvent; } + /** + * {@inheritDoc} + */ @Override public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception { if (parent.contains(this)) { @@ -318,16 +375,25 @@ public class KeepAliveFilter extends IoFilterAdapter { } } + /** + * {@inheritDoc} + */ @Override public void onPostAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception { resetStatus(parent.getSession()); } + /** + * {@inheritDoc} + */ @Override public void onPostRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception { resetStatus(parent.getSession()); } + /** + * {@inheritDoc} + */ @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { try { @@ -349,19 +415,27 @@ public class KeepAliveFilter extends IoFilterAdapter { } } + /** + * {@inheritDoc} + */ @Override public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception { Object message = writeRequest.getMessage(); + if (!isKeepAliveMessage(session, message)) { nextFilter.messageSent(session, writeRequest); } } + /** + * {@inheritDoc} + */ @Override public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception { if (status == interestedIdleStatus) { if (!session.containsAttribute(WAITING_FOR_RESPONSE)) { Object pingMessage = messageFactory.getRequest(session); + if (pingMessage != null) { nextFilter.filterWrite(session, new DefaultWriteRequest(pingMessage)); http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveMessageFactory.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveMessageFactory.java b/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveMessageFactory.java index 357717d..34d2e8d 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveMessageFactory.java +++ b/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveMessageFactory.java @@ -29,26 +29,35 @@ import org.apache.mina.core.session.IoSession; public interface KeepAliveMessageFactory { /** - * Returns <tt>true</tt> if and only if the specified message is a + * @return <tt>true</tt> if and only if the specified message is a * keep-alive request message. + * + * @param session The current session + * @param message teh message to check */ boolean isRequest(IoSession session, Object message); /** - * Returns <tt>true</tt> if and only if the specified message is a + * @return <tt>true</tt> if and only if the specified message is a * keep-alive response message; + * + * @param session The current session + * @param message teh message to check */ boolean isResponse(IoSession session, Object message); /** - * Returns a (new) keep-alive request message. - * Returns <tt>null</tt> if no request is required. + * @return a (new) keep-alive request message or <tt>null</tt> if no request is required. + * + * @param session The current session */ Object getRequest(IoSession session); /** - * Returns a (new) response message for the specified keep-alive request. - * Returns <tt>null</tt> if no response is required. + * @return a (new) response message for the specified keep-alive request, or <tt>null</tt> if no response is required. + * + * @param session The current session + * @param request The request we are lookig for */ Object getResponse(IoSession session, Object request); } http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutException.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutException.java b/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutException.java index e7fdba2..eba5445 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutException.java +++ b/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutException.java @@ -29,18 +29,37 @@ public class KeepAliveRequestTimeoutException extends RuntimeException { private static final long serialVersionUID = -1985092764656546558L; + /** + * Creates a new instance of a KeepAliveRequestTimeoutException + */ public KeepAliveRequestTimeoutException() { super(); } + /** + * Creates a new instance of a KeepAliveRequestTimeoutException + * + * @param message The detail message + * @param cause The Exception's cause + */ public KeepAliveRequestTimeoutException(String message, Throwable cause) { super(message, cause); } + /** + * Creates a new instance of a KeepAliveRequestTimeoutException + * + * @param message The detail message + */ public KeepAliveRequestTimeoutException(String message) { super(message); } + /** + * Creates a new instance of a KeepAliveRequestTimeoutException + * + * @param cause The Exception's cause + */ public KeepAliveRequestTimeoutException(Throwable cause) { super(cause); } http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutHandler.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutHandler.java b/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutHandler.java index 5d2ba8a..eae4910 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutHandler.java +++ b/mina-core/src/main/java/org/apache/mina/filter/keepalive/KeepAliveRequestTimeoutHandler.java @@ -86,6 +86,10 @@ public interface KeepAliveRequestTimeoutHandler { /** * Invoked when {@link KeepAliveFilter} couldn't receive the response for * the sent keep alive message. + * + * @param filter The filter to use + * @param session The current session + * @throws Exception If anything went wrong */ void keepAliveRequestTimedOut(KeepAliveFilter filter, IoSession session) throws Exception; } http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java b/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java index 447d02a..1859ceb 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java +++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java @@ -53,6 +53,11 @@ public class KeyStoreFactory { * by the base class when Spring creates a bean using this FactoryBean. * * @return a new {@link KeyStore} instance. + * @throws KeyStoreException If we can't create an instance of the KeyStore for the given type + * @throws NoSuchProviderException If we don't have the provider registered to create the KeyStore + * @throws NoSuchAlgorithmException If the KeyStore algorithm cannot be used + * @throws CertificateException If the KeyStore certificate cannot be loaded + * @throws IOException If the KeyStore cannot be loaded */ public KeyStore newInstance() throws KeyStoreException, NoSuchProviderException, NoSuchAlgorithmException, CertificateException, IOException { @@ -68,6 +73,7 @@ public class KeyStoreFactory { } InputStream is = new ByteArrayInputStream(data); + try { ks.load(is, password); } finally { @@ -136,6 +142,7 @@ public class KeyStoreFactory { * Sets the data which contains the key store. * * @param dataStream the {@link InputStream} that contains the key store + * @throws IOException If we can't process the stream */ private void setData(InputStream dataStream) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -161,6 +168,7 @@ public class KeyStoreFactory { * Sets the data which contains the key store. * * @param dataFile the {@link File} that contains the key store + * @throws IOException If we can't process the file */ public void setDataFile(File dataFile) throws IOException { setData(new BufferedInputStream(new FileInputStream(dataFile))); @@ -170,6 +178,7 @@ public class KeyStoreFactory { * Sets the data which contains the key store. * * @param dataUrl the {@link URL} that contains the key store. + * @throws IOException If we can't process the URL */ public void setDataUrl(URL dataUrl) throws IOException { setData(dataUrl.openStream()); http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java index 77747eb..115ad1c 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java @@ -58,7 +58,6 @@ import org.slf4j.LoggerFactory; * This filter uses an {@link SSLEngine} which was introduced in Java 5, so * Java version 5 or above is mandatory to use this filter. And please note that * this filter only works for TCP/IP connections. - * <p> * * <h2>Implementing StartTLS</h2> * <p> @@ -173,6 +172,8 @@ public class SslFilter extends IoFilterAdapter { /** * Creates a new SSL filter using the specified {@link SSLContext}. * The handshake will start immediately. + * + * @param sslContext The SSLContext to use */ public SslFilter(SSLContext sslContext) { this(sslContext, START_HANDSHAKE); @@ -180,8 +181,11 @@ public class SslFilter extends IoFilterAdapter { /** * Creates a new SSL filter using the specified {@link SSLContext}. - * If the <code>autostart</code> flag is set to <tt>true</tt>, the + * If the <tt>autostart</tt> flag is set to <tt>true</tt>, the * handshake will start immediately. + * + * @param sslContext The SSLContext to use + * @param autoStart The flag used to tell the filter to start the handshake immediately */ public SslFilter(SSLContext sslContext, boolean autoStart) { if (sslContext == null) { @@ -195,6 +199,7 @@ public class SslFilter extends IoFilterAdapter { /** * Returns the underlying {@link SSLSession} for the specified session. * + * @param session The current session * @return <tt>null</tt> if no {@link SSLSession} is initialized yet. */ public SSLSession getSslSession(IoSession session) { @@ -206,6 +211,7 @@ public class SslFilter extends IoFilterAdapter { * Please note that SSL session is automatically started by default, and therefore * you don't need to call this method unless you've used TLS closure. * + * @param session The session that will be switched to SSL mode * @return <tt>true</tt> if the SSL session has been started, <tt>false</tt> if already started. * @throws SSLException if failed to start the SSL session */ @@ -268,10 +274,12 @@ public class SslFilter extends IoFilterAdapter { } /** - * Returns <tt>true</tt> if and only if the specified <tt>session</tt> is + * @return <tt>true</tt> if and only if the specified <tt>session</tt> is * encrypted/decrypted over SSL/TLS currently. This method will start * to return <tt>false</tt> after TLS <tt>close_notify</tt> message * is sent and any messages written after then is not going to get encrypted. + * + * @param session the session we want to check */ public boolean isSslStarted(IoSession session) { SslHandler sslHandler = (SslHandler) session.getAttribute(SSL_HANDLER); @@ -290,8 +298,8 @@ public class SslFilter extends IoFilterAdapter { * initiate TLS closure. * * @param session the {@link IoSession} to initiate TLS closure + * @return The Future for the initiated closure * @throws SSLException if failed to initiate TLS closure - * @throws IllegalArgumentException if this filter is not managing the specified session */ public WriteFuture stopSsl(IoSession session) throws SSLException { SslHandler sslHandler = getSslSessionHandler(session); @@ -313,7 +321,7 @@ public class SslFilter extends IoFilterAdapter { } /** - * Returns <tt>true</tt> if the engine is set to use client mode + * @return <tt>true</tt> if the engine is set to use client mode * when handshaking. */ public boolean isUseClientMode() { @@ -322,13 +330,15 @@ public class SslFilter extends IoFilterAdapter { /** * Configures the engine to use client (or server) mode when handshaking. + * + * @param clientMode <tt>true</tt> when we are in client mode, <tt>false</tt> when in server mode */ public void setUseClientMode(boolean clientMode) { this.client = clientMode; } /** - * Returns <tt>true</tt> if the engine will <em>require</em> client authentication. + * @return <tt>true</tt> if the engine will <em>require</em> client authentication. * This option is only useful to engines in the server mode. */ public boolean isNeedClientAuth() { @@ -338,13 +348,15 @@ public class SslFilter extends IoFilterAdapter { /** * Configures the engine to <em>require</em> client authentication. * This option is only useful for engines in the server mode. + * + * @param needClientAuth A flag set when we need to authenticate the client */ public void setNeedClientAuth(boolean needClientAuth) { this.needClientAuth = needClientAuth; } /** - * Returns <tt>true</tt> if the engine will <em>request</em> client authentication. + * @return <tt>true</tt> if the engine will <em>request</em> client authentication. * This option is only useful to engines in the server mode. */ public boolean isWantClientAuth() { @@ -354,16 +366,16 @@ public class SslFilter extends IoFilterAdapter { /** * Configures the engine to <em>request</em> client authentication. * This option is only useful for engines in the server mode. + * + * @param wantClientAuth A flag set when we want to check the client authentication */ public void setWantClientAuth(boolean wantClientAuth) { this.wantClientAuth = wantClientAuth; } /** - * Returns the list of cipher suites to be enabled when {@link SSLEngine} - * is initialized. - * - * @return <tt>null</tt> means 'use {@link SSLEngine}'s default.' + * @return the list of cipher suites to be enabled when {@link SSLEngine} + * is initialized. <tt>null</tt> means 'use {@link SSLEngine}'s default.' */ public String[] getEnabledCipherSuites() { return enabledCipherSuites; @@ -380,10 +392,8 @@ public class SslFilter extends IoFilterAdapter { } /** - * Returns the list of protocols to be enabled when {@link SSLEngine} - * is initialized. - * - * @return <tt>null</tt> means 'use {@link SSLEngine}'s default.' + * @return the list of protocols to be enabled when {@link SSLEngine} + * is initialized. <tt>null</tt> means 'use {@link SSLEngine}'s default.' */ public String[] getEnabledProtocols() { return enabledProtocols; http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java index b3aaa3a..6706627 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java +++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java @@ -756,8 +756,7 @@ class SslHandler { throw new SSLException("SSL buffer overflow"); } - appBuffer.capacity(newCapacity); - appBuffer.limit(appBuffer.capacity()); + appBuffer.expand(newCapacity); continue; } } while (((status == SSLEngineResult.Status.OK) || (status == SSLEngineResult.Status.BUFFER_OVERFLOW)) http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java b/mina-core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java index b0bdde9..c1c2256 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java @@ -854,8 +854,6 @@ public class ProfilerTimerFilter extends IoFilterAdapter { } /** - * Returns the total number of profiled operations - * * @return The total number of profiled operation */ public long getCallsNumber() { @@ -863,8 +861,6 @@ public class ProfilerTimerFilter extends IoFilterAdapter { } /** - * Returns the total time - * * @return the total time */ public long getTotal() { @@ -872,8 +868,6 @@ public class ProfilerTimerFilter extends IoFilterAdapter { } /** - * Returns the lowest execution time - * * @return the lowest execution time */ public long getMinimum() { @@ -881,8 +875,6 @@ public class ProfilerTimerFilter extends IoFilterAdapter { } /** - * Returns the longest execution time - * * @return the longest execution time */ public long getMaximum() { http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java b/mina-core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java index eabfab5..0d15640 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/stream/AbstractStreamWriteFilter.java @@ -142,10 +142,8 @@ public abstract class AbstractStreamWriteFilter<T> extends IoFilterAdapter { } /** - * Returns the size of the write buffer in bytes. Data will be read from the + * @return the size of the write buffer in bytes. Data will be read from the * stream in chunks of this size and then written to the next filter. - * - * @return the write buffer size. */ public int getWriteBufferSize() { return writeBufferSize; @@ -155,6 +153,7 @@ public abstract class AbstractStreamWriteFilter<T> extends IoFilterAdapter { * Sets the size of the write buffer in bytes. Data will be read from the * stream in chunks of this size and then written to the next filter. * + * @param writeBufferSize The size of the write buffer * @throws IllegalArgumentException if the specified size is < 1. */ public void setWriteBufferSize(int writeBufferSize) { http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java b/mina-core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java index a0ce793..4dc9087 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java +++ b/mina-core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java @@ -53,6 +53,8 @@ public class SessionAttributeInitializingFilter extends IoFilterAdapter { * Creates a new instance with the specified default attributes. You can * set the additional attributes by calling methods such as * {@link #setAttribute(String, Object)} and {@link #setAttributes(Map)}. + * + * @param attributes The Attribute's Map to set */ public SessionAttributeInitializingFilter(Map<String, ? extends Object> attributes) { setAttributes(attributes); @@ -98,6 +100,7 @@ public class SessionAttributeInitializingFilter extends IoFilterAdapter { /** * Removes a user-defined attribute with the specified key. * + * @param key The attribut's key we want to removee * @return The old value of the attribute. <tt>null</tt> if not found. */ public Object removeAttribute(String key) { @@ -105,7 +108,7 @@ public class SessionAttributeInitializingFilter extends IoFilterAdapter { } /** - * Returns <tt>true</tt> if this session contains the attribute with + * @return <tt>true</tt> if this session contains the attribute with * the specified <tt>key</tt>. */ boolean containsAttribute(String key) { @@ -113,7 +116,7 @@ public class SessionAttributeInitializingFilter extends IoFilterAdapter { } /** - * Returns the set of keys of all user-defined attributes. + * @return the set of keys of all user-defined attributes. */ public Set<String> getAttributeKeys() { return attributes.keySet(); @@ -123,6 +126,8 @@ public class SessionAttributeInitializingFilter extends IoFilterAdapter { * Sets the attribute map. The specified attributes are copied into the * underlying map, so modifying the specified attributes parameter after * the call won't change the internal state. + * + * @param attributes The attributes Map to set */ public void setAttributes(Map<String, ? extends Object> attributes) { if (attributes == null) { http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java b/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java index a4f6e71..dd1e16c 100644 --- a/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java +++ b/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java @@ -53,7 +53,7 @@ public class ChainedIoHandler extends IoHandlerAdapter { } /** - * Returns the {@link IoHandlerCommand} this handler will use to + * @return the {@link IoHandlerCommand} this handler will use to * handle <tt>messageReceived</tt> events. */ public IoHandlerChain getChain() { http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java b/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java index 25581db..a12b05e 100644 --- a/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java +++ b/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java @@ -306,21 +306,21 @@ public class IoHandlerChain implements IoHandlerCommand { } /** - * Returns the name of the command. + * @return the name of the command. */ public String getName() { return name; } /** - * Returns the command. + * @return the command. */ public IoHandlerCommand getCommand() { return command; } /** - * Returns the {@link IoHandlerCommand.NextCommand} of the command. + * @return the {@link IoHandlerCommand.NextCommand} of the command. */ public NextCommand getNextCommand() { return nextCommand; http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerCommand.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerCommand.java b/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerCommand.java index b3a778e..d74e8d0 100644 --- a/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerCommand.java +++ b/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerCommand.java @@ -86,6 +86,10 @@ public interface IoHandlerCommand { /** * Forwards the request to the next {@link IoHandlerCommand} in the * {@link IoHandlerChain}. + * + * @param session The current session + * @param message The message to pass on + * @throws Exception If anything went wrong */ void execute(IoSession session, Object message) throws Exception; } http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java b/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java index 5f2a0c6..3cad95f 100644 --- a/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java +++ b/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java @@ -96,7 +96,10 @@ public class DemuxingIoHandler extends IoHandlerAdapter { /** * Registers a {@link MessageHandler} that handles the received messages of * the specified <code>type</code>. - * + * + * @param <E> The message handler's type + * @param type The message's type + * @param handler The message handler * @return the old handler if there is already a registered handler for * the specified <tt>type</tt>. <tt>null</tt> otherwise. */ @@ -111,6 +114,8 @@ public class DemuxingIoHandler extends IoHandlerAdapter { * Deregisters a {@link MessageHandler} that handles the received messages * of the specified <code>type</code>. * + * @param <E> The message handler's type + * @param type The message's type * @return the removed handler if successfully removed. <tt>null</tt> otherwise. */ @SuppressWarnings("unchecked") @@ -124,6 +129,9 @@ public class DemuxingIoHandler extends IoHandlerAdapter { * Registers a {@link MessageHandler} that handles the sent messages of the * specified <code>type</code>. * + * @param <E> The message handler's type + * @param type The message's type + * @param handler The message handler * @return the old handler if there is already a registered handler for * the specified <tt>type</tt>. <tt>null</tt> otherwise. */ @@ -138,6 +146,8 @@ public class DemuxingIoHandler extends IoHandlerAdapter { * Deregisters a {@link MessageHandler} that handles the sent messages of * the specified <code>type</code>. * + * @param <E> The message handler's type + * @param type The message's type * @return the removed handler if successfully removed. <tt>null</tt> otherwise. */ @SuppressWarnings("unchecked") @@ -151,6 +161,9 @@ public class DemuxingIoHandler extends IoHandlerAdapter { * Registers a {@link MessageHandler} that receives the messages of * the specified <code>type</code>. * + * @param <E> The message handler's type + * @param type The message's type + * @param handler The Exception handler * @return the old handler if there is already a registered handler for * the specified <tt>type</tt>. <tt>null</tt> otherwise. */ @@ -166,6 +179,8 @@ public class DemuxingIoHandler extends IoHandlerAdapter { * Deregisters a {@link MessageHandler} that receives the messages of * the specified <code>type</code>. * + * @param <E> The Exception Handler's type + * @param type The message's type * @return the removed handler if successfully removed. <tt>null</tt> otherwise. */ @SuppressWarnings("unchecked") @@ -176,8 +191,10 @@ public class DemuxingIoHandler extends IoHandlerAdapter { } /** - * Returns the {@link MessageHandler} which is registered to process + * @return the {@link MessageHandler} which is registered to process * the specified <code>type</code>. + * @param <E> The message handler's type + * @param type The message's type */ @SuppressWarnings("unchecked") public <E> MessageHandler<? super E> getMessageHandler(Class<E> type) { @@ -185,7 +202,7 @@ public class DemuxingIoHandler extends IoHandlerAdapter { } /** - * Returns the {@link Map} which contains all messageType-{@link MessageHandler} + * @return the {@link Map} which contains all messageType-{@link MessageHandler} * pairs registered to this handler for received messages. */ public Map<Class<?>, MessageHandler<?>> getReceivedMessageHandlerMap() { @@ -193,7 +210,7 @@ public class DemuxingIoHandler extends IoHandlerAdapter { } /** - * Returns the {@link Map} which contains all messageType-{@link MessageHandler} + * @return the {@link Map} which contains all messageType-{@link MessageHandler} * pairs registered to this handler for sent messages. */ public Map<Class<?>, MessageHandler<?>> getSentMessageHandlerMap() { @@ -201,7 +218,7 @@ public class DemuxingIoHandler extends IoHandlerAdapter { } /** - * Returns the {@link Map} which contains all messageType-{@link MessageHandler} + * @return the {@link Map} which contains all messageType-{@link MessageHandler} * pairs registered to this handler. */ public Map<Class<?>, ExceptionHandler<?>> getExceptionHandlerMap() { @@ -215,6 +232,8 @@ public class DemuxingIoHandler extends IoHandlerAdapter { * <b>Warning !</b> If you are to overload this method, be aware that you * _must_ call the messageHandler in your own method, otherwise it won't * be called. + * + * {@inheritDoc} */ @Override public void messageReceived(IoSession session, Object message) throws Exception { @@ -234,6 +253,8 @@ public class DemuxingIoHandler extends IoHandlerAdapter { * <b>Warning !</b> If you are to overload this method, be aware that you * _must_ call the messageHandler in your own method, otherwise it won't * be called. + * + * {@inheritDoc} */ @Override public void messageSent(IoSession session, Object message) throws Exception { @@ -255,6 +276,8 @@ public class DemuxingIoHandler extends IoHandlerAdapter { * <b>Warning !</b> If you are to overload this method, be aware that you * _must_ call the messageHandler in your own method, otherwise it won't * be called. + * + * {@inheritDoc} */ @Override public void exceptionCaught(IoSession session, Throwable cause) throws Exception { http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java b/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java index cf80690..05a2b5d 100644 --- a/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java +++ b/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java @@ -54,6 +54,10 @@ public interface ExceptionHandler<E extends Throwable> { /** * Invoked when the specific type of exception is caught from the * specified <code>session</code>. + * + * @param session The current session + * @param cause the exception's cause + * @throws Exception If we can't process the event */ void exceptionCaught(IoSession session, E cause) throws Exception; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java index f180133..b11c86e 100644 --- a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java +++ b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java @@ -50,7 +50,7 @@ public interface SingleSessionIoHandler { * Invoked when the session is created. Initialize default socket parameters * and user-defined attributes here. * - * @throws Exception + * @throws Exception If the session can't be created * @see IoHandler#sessionCreated(IoSession) */ void sessionCreated() throws Exception; @@ -59,6 +59,7 @@ public interface SingleSessionIoHandler { * Invoked when the connection is opened. This method is not invoked if the * transport type is UDP. * + * @throws Exception If the session can't be opened * @see IoHandler#sessionOpened(IoSession) */ void sessionOpened() throws Exception; @@ -67,6 +68,7 @@ public interface SingleSessionIoHandler { * Invoked when the connection is closed. This method is not invoked if the * transport type is UDP. * + * @throws Exception If the session can't be closed * @see IoHandler#sessionClosed(IoSession) */ void sessionClosed() throws Exception; @@ -76,6 +78,7 @@ public interface SingleSessionIoHandler { * method is not invoked if the transport type is UDP. * * @param status the type of idleness + * @throws Exception If the idle event can't be handled * @see IoHandler#sessionIdle(IoSession, IdleStatus) */ void sessionIdle(IdleStatus status) throws Exception; @@ -86,10 +89,16 @@ public interface SingleSessionIoHandler { * {@link IOException}, MINA will close the connection automatically. * * @param cause the caught exception + * @throws Exception If the exception can't be handled * @see IoHandler#exceptionCaught(IoSession, Throwable) */ void exceptionCaught(Throwable cause) throws Exception; + /** + * Invoked when a half-duplex connection is closed + * + * @param session The current session + */ void inputClosed(IoSession session); /** @@ -97,6 +106,7 @@ public interface SingleSessionIoHandler { * here. * * @param message the received message + * @throws Exception If the received message can't be processed * @see IoHandler#messageReceived(IoSession, Object) */ void messageReceived(Object message) throws Exception; @@ -106,6 +116,7 @@ public interface SingleSessionIoHandler { * {@link IoSession#write(Object)} is sent out actually. * * @param message the sent message + * @throws Exception If the sent message can't be processed * @see IoHandler#messageSent(IoSession, Object) */ void messageSent(Object message) throws Exception; http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java index f2bd86d..ac5a383 100644 --- a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java +++ b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java @@ -66,7 +66,7 @@ public class SingleSessionIoHandlerDelegate implements IoHandler { } /** - * Returns the {@link SingleSessionIoHandlerFactory} that is used to create a new + * @return the {@link SingleSessionIoHandlerFactory} that is used to create a new * {@link SingleSessionIoHandler} instance. */ public SingleSessionIoHandlerFactory getFactory() { @@ -77,8 +77,10 @@ public class SingleSessionIoHandlerDelegate implements IoHandler { * Creates a new instance with the factory passed to the constructor of * this class. The created handler is stored as a session * attribute named {@link #HANDLER}. - * + * * @see org.apache.mina.core.service.IoHandler#sessionCreated(org.apache.mina.core.session.IoSession) + * + * {@inheritDoc} */ public void sessionCreated(IoSession session) throws Exception { SingleSessionIoHandler handler = factory.getHandler(session); @@ -90,6 +92,8 @@ public class SingleSessionIoHandlerDelegate implements IoHandler { * Delegates the method call to the * {@link SingleSessionIoHandler#sessionOpened()} method of the handler * assigned to this session. + * + * {@inheritDoc} */ public void sessionOpened(IoSession session) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session.getAttribute(HANDLER); @@ -100,6 +104,8 @@ public class SingleSessionIoHandlerDelegate implements IoHandler { * Delegates the method call to the * {@link SingleSessionIoHandler#sessionClosed()} method of the handler * assigned to this session. + * + * {@inheritDoc} */ public void sessionClosed(IoSession session) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session.getAttribute(HANDLER); @@ -110,6 +116,8 @@ public class SingleSessionIoHandlerDelegate implements IoHandler { * Delegates the method call to the * {@link SingleSessionIoHandler#sessionIdle(IdleStatus)} method of the * handler assigned to this session. + * + * {@inheritDoc} */ public void sessionIdle(IoSession session, IdleStatus status) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session.getAttribute(HANDLER); @@ -120,6 +128,8 @@ public class SingleSessionIoHandlerDelegate implements IoHandler { * Delegates the method call to the * {@link SingleSessionIoHandler#exceptionCaught(Throwable)} method of the * handler assigned to this session. + * + * {@inheritDoc} */ public void exceptionCaught(IoSession session, Throwable cause) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session.getAttribute(HANDLER); @@ -130,6 +140,8 @@ public class SingleSessionIoHandlerDelegate implements IoHandler { * Delegates the method call to the * {@link SingleSessionIoHandler#messageReceived(Object)} method of the * handler assigned to this session. + * + * {@inheritDoc} */ public void messageReceived(IoSession session, Object message) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session.getAttribute(HANDLER); @@ -140,12 +152,17 @@ public class SingleSessionIoHandlerDelegate implements IoHandler { * Delegates the method call to the * {@link SingleSessionIoHandler#messageSent(Object)} method of the handler * assigned to this session. + * + * {@inheritDoc} */ public void messageSent(IoSession session, Object message) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session.getAttribute(HANDLER); handler.messageSent(message); } + /** + * {@inheritDoc} + */ public void inputClosed(IoSession session) throws Exception { SingleSessionIoHandler handler = (SingleSessionIoHandler) session.getAttribute(HANDLER); handler.inputClosed(session); http://git-wip-us.apache.org/repos/asf/mina/blob/6f0509f7/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java ---------------------------------------------------------------------- diff --git a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java index 445207e..ff77bc7 100644 --- a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java +++ b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java @@ -33,9 +33,10 @@ import org.apache.mina.core.session.IoSession; public interface SingleSessionIoHandlerFactory { /** - * Returns a {@link SingleSessionIoHandler} for the given session. + * @return a {@link SingleSessionIoHandler} for the given session. * * @param session the session for which a handler is requested + * @throws Exception If we can't get the handler */ SingleSessionIoHandler getHandler(IoSession session) throws Exception; }
