Updated Branches: refs/heads/trunk 438938d1e -> 523b36274
Removed some Sonar warnings Project: http://git-wip-us.apache.org/repos/asf/mina/repo Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/13d52b88 Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/13d52b88 Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/13d52b88 Branch: refs/heads/trunk Commit: 13d52b8819ee70c6c7d9c06d47b48e7dc10bbf9c Parents: 438938d Author: Emmanuel Lécharny <[email protected]> Authored: Fri May 17 14:52:57 2013 +0200 Committer: Emmanuel Lécharny <[email protected]> Committed: Fri May 17 14:52:57 2013 +0200 ---------------------------------------------------------------------- .../org/apache/mina/coap/codec/CoapDecoder.java | 2 +- .../main/java/org/apache/mina/codec/IoBuffer.java | 2 +- .../org/apache/mina/codec/ProtocolDecoder.java | 3 +- .../mina/codec/delimited/ByteBufferDecoder.java | 4 +- .../mina/codec/delimited/SizePrefixedDecoder.java | 3 +- .../apache/mina/codec/delimited/ints/RawInt32.java | 2 +- .../apache/mina/codec/delimited/ints/VarInt.java | 2 +- .../serialization/JavaNativeMessageDecoder.java | 2 +- .../main/java/org/apache/mina/api/IoFuture.java | 2 +- .../main/java/org/apache/mina/api/IoSession.java | 16 +++++++------- .../org/apache/mina/session/AbstractIoSession.java | 2 +- .../org/apache/mina/http/HttpServerDecoder.java | 3 +- .../java/org/apache/mina/http/api/HttpPdu.java | 2 +- .../mina/http/api/HttpPduEncodingVisitor.java | 8 +++--- .../mina/codec/delimited/ProtobufDecoder.java | 9 +++---- .../codec/delimited/ProtobufDynamicDecoder.java | 5 +-- .../ProtobufDynamicMessageDecoder.java | 10 +++----- .../serialization/ProtobufMessageDecoder.java | 9 +++---- .../apache/mina/codec/delimited/ThriftDecoder.java | 5 +-- .../mina/codec/delimited/ThriftDynamicDecoder.java | 5 +-- .../apache/mina/codec/delimited/ThriftEncoder.java | 5 +-- .../serialization/ThriftDynamicMessageDecoder.java | 3 +- .../serialization/ThriftMessageDecoder.java | 3 +- 23 files changed, 47 insertions(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java ---------------------------------------------------------------------- diff --git a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java index 19b6f7e..65dc941 100644 --- a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java +++ b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java @@ -60,7 +60,7 @@ public class CoapDecoder implements StatelessProtocolDecoder<ByteBuffer, CoapMes * {@inheritDoc} */ @Override - public CoapMessage decode(ByteBuffer input, Void context) throws ProtocolDecoderException { + public CoapMessage decode(ByteBuffer input, Void context) { LOG.debug("decode"); if (input.remaining() <= 0) { http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/codec/src/main/java/org/apache/mina/codec/IoBuffer.java ---------------------------------------------------------------------- diff --git a/codec/src/main/java/org/apache/mina/codec/IoBuffer.java b/codec/src/main/java/org/apache/mina/codec/IoBuffer.java index bdef926..dd164bb 100644 --- a/codec/src/main/java/org/apache/mina/codec/IoBuffer.java +++ b/codec/src/main/java/org/apache/mina/codec/IoBuffer.java @@ -527,7 +527,7 @@ public class IoBuffer { /** * Load an int from the underlying byteBuffers, taking the order into account. */ - private final int loadInt(int index) { + private int loadInt(int index) { int bytes = 0; if (order == ByteOrder.BIG_ENDIAN) { http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/codec/src/main/java/org/apache/mina/codec/ProtocolDecoder.java ---------------------------------------------------------------------- diff --git a/codec/src/main/java/org/apache/mina/codec/ProtocolDecoder.java b/codec/src/main/java/org/apache/mina/codec/ProtocolDecoder.java index cc0e30d..eef5c52 100644 --- a/codec/src/main/java/org/apache/mina/codec/ProtocolDecoder.java +++ b/codec/src/main/java/org/apache/mina/codec/ProtocolDecoder.java @@ -50,9 +50,8 @@ public interface ProtocolDecoder<INPUT, OUTPUT, DECODING_STATE> { * @param input the received message to decode * @param context the decoding context (will be stored in the session for the next decode call) * @return the decoded message or <code>null</code> if nothing was decoded - * @throws ProtocolDecoderException if something wrong happen during decoding (e.g. : a malformed input message) */ - OUTPUT decode(INPUT input, DECODING_STATE context) throws ProtocolDecoderException; + OUTPUT decode(INPUT input, DECODING_STATE context); /** * Finish decoding, for example if the decoder accumulated some unused input, it should discard it, or throw an http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/codec/src/main/java/org/apache/mina/codec/delimited/ByteBufferDecoder.java ---------------------------------------------------------------------- diff --git a/codec/src/main/java/org/apache/mina/codec/delimited/ByteBufferDecoder.java b/codec/src/main/java/org/apache/mina/codec/delimited/ByteBufferDecoder.java index 81ebed9..73b6bbf 100644 --- a/codec/src/main/java/org/apache/mina/codec/delimited/ByteBufferDecoder.java +++ b/codec/src/main/java/org/apache/mina/codec/delimited/ByteBufferDecoder.java @@ -77,7 +77,7 @@ public abstract class ByteBufferDecoder<INPUT> implements StatelessProtocolDecod * * @throws ProtocolDecoderException */ - public abstract INPUT decode(ByteBuffer input) throws ProtocolDecoderException; + public abstract INPUT decode(ByteBuffer input); /** * Decodes a message from a {@link ByteBuffer} @@ -87,7 +87,7 @@ public abstract class ByteBufferDecoder<INPUT> implements StatelessProtocolDecod * </p> */ @Override - public final INPUT decode(ByteBuffer input, Void context) throws ProtocolDecoderException { + public final INPUT decode(ByteBuffer input, Void context) { return decode(input); } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/codec/src/main/java/org/apache/mina/codec/delimited/SizePrefixedDecoder.java ---------------------------------------------------------------------- diff --git a/codec/src/main/java/org/apache/mina/codec/delimited/SizePrefixedDecoder.java b/codec/src/main/java/org/apache/mina/codec/delimited/SizePrefixedDecoder.java index 536d42d..b44b96a 100644 --- a/codec/src/main/java/org/apache/mina/codec/delimited/SizePrefixedDecoder.java +++ b/codec/src/main/java/org/apache/mina/codec/delimited/SizePrefixedDecoder.java @@ -22,7 +22,6 @@ package org.apache.mina.codec.delimited; import java.nio.ByteBuffer; import org.apache.mina.codec.ProtocolDecoder; -import org.apache.mina.codec.ProtocolDecoderException; /** * @@ -101,7 +100,7 @@ public class SizePrefixedDecoder<OUT> implements ProtocolDecoder<ByteBuffer, OUT } @Override - public OUT decode(ByteBuffer input, MutableInt nextBlockSize) throws ProtocolDecoderException { + public OUT decode(ByteBuffer input, MutableInt nextBlockSize) { OUT output = null; if (nextBlockSize.getValue() == null) { http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/codec/src/main/java/org/apache/mina/codec/delimited/ints/RawInt32.java ---------------------------------------------------------------------- diff --git a/codec/src/main/java/org/apache/mina/codec/delimited/ints/RawInt32.java b/codec/src/main/java/org/apache/mina/codec/delimited/ints/RawInt32.java index d27b88a..7427c04 100644 --- a/codec/src/main/java/org/apache/mina/codec/delimited/ints/RawInt32.java +++ b/codec/src/main/java/org/apache/mina/codec/delimited/ints/RawInt32.java @@ -126,7 +126,7 @@ public class RawInt32 { } @Override - public Integer decode(ByteBuffer input) throws ProtocolDecoderException { + public Integer decode(ByteBuffer input) { if (input.remaining() < 4) { return null; } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java ---------------------------------------------------------------------- diff --git a/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java b/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java index 809c711..23eb3ef 100644 --- a/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java +++ b/codec/src/main/java/org/apache/mina/codec/delimited/ints/VarInt.java @@ -94,7 +94,7 @@ public class VarInt { public static class Decoder extends ByteBufferDecoder<Integer> { @Override - public Integer decode(ByteBuffer input) throws ProtocolDecoderException { + public Integer decode(ByteBuffer input) { int origpos = input.position(); int size = 0; http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/codec/src/main/java/org/apache/mina/codec/delimited/serialization/JavaNativeMessageDecoder.java ---------------------------------------------------------------------- diff --git a/codec/src/main/java/org/apache/mina/codec/delimited/serialization/JavaNativeMessageDecoder.java b/codec/src/main/java/org/apache/mina/codec/delimited/serialization/JavaNativeMessageDecoder.java index ecd4028..d7cc44d 100644 --- a/codec/src/main/java/org/apache/mina/codec/delimited/serialization/JavaNativeMessageDecoder.java +++ b/codec/src/main/java/org/apache/mina/codec/delimited/serialization/JavaNativeMessageDecoder.java @@ -36,7 +36,7 @@ public class JavaNativeMessageDecoder<IN extends Serializable> extends ByteBuffe @SuppressWarnings("unchecked") @Override - public IN decode(final ByteBuffer input) throws ProtocolDecoderException { + public IN decode(final ByteBuffer input) { try { ObjectInputStream ois = new ObjectInputStream(new ByteBufferInputStream(input)); IN s = (IN) ois.readObject(); http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/core/src/main/java/org/apache/mina/api/IoFuture.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/mina/api/IoFuture.java b/core/src/main/java/org/apache/mina/api/IoFuture.java index 0f0f871..088c77d 100644 --- a/core/src/main/java/org/apache/mina/api/IoFuture.java +++ b/core/src/main/java/org/apache/mina/api/IoFuture.java @@ -36,5 +36,5 @@ public interface IoFuture<V> extends Future<V> { * @param listener the listener to asynchronously receive the results of the future computation * @return the instance of the future to allow "chaining" of registrations */ - public IoFuture<V> register(IoFutureListener<V> listener); + IoFuture<V> register(IoFutureListener<V> listener); } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/core/src/main/java/org/apache/mina/api/IoSession.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/mina/api/IoSession.java b/core/src/main/java/org/apache/mina/api/IoSession.java index 7104fdd..b54fcd7 100644 --- a/core/src/main/java/org/apache/mina/api/IoSession.java +++ b/core/src/main/java/org/apache/mina/api/IoSession.java @@ -56,7 +56,7 @@ import org.apache.mina.transport.nio.SelectorLoop; */ public interface IoSession { /** The SslHelper instance name, stored in the session's attributes */ - static final AttributeKey<SslHelper> SSL_HELPER = new AttributeKey<SslHelper>(SslHelper.class, "internal_sslHelper"); + final AttributeKey<SslHelper> SSL_HELPER = new AttributeKey<SslHelper>(SslHelper.class, "internal_sslHelper"); /** * The unique identifier of this session. @@ -151,7 +151,7 @@ public interface IoSession { * * @param newState The final SessionState */ - void changeState(SessionState newState) throws IllegalStateException; + void changeState(SessionState newState); /** * Initializes the SSL/TLS environment for this session. @@ -326,7 +326,7 @@ public interface IoSession { * @return the removed value, <code>null</code> if this container doesn't contain the specified attribute * @exception IllegalArgumentException if <code>key==null</code> */ - public <T> T removeAttribute(AttributeKey<T> key); + <T> T removeAttribute(AttributeKey<T> key); /** * State of a {@link IoSession} @@ -334,7 +334,7 @@ public interface IoSession { * @author <a href="http://mina.apache.org">Apache MINA Project</a> * */ - public enum SessionState { + enum SessionState { CREATED, CONNECTED, CLOSING, CLOSED, SECURING, SECURED } @@ -344,7 +344,7 @@ public interface IoSession { * filter chain and wrote to socket by the {@link SelectorLoop} * */ - public void write(Object message); + void write(Object message); /** * Same as {@link IoSession#write(Object)}, but provide a {@link IoFuture} for tracking the completion of this @@ -353,7 +353,7 @@ public interface IoSession { * @param message the message to be processed and written * @return the {@link IoFuture} for tracking this asynchronous operation */ - public IoFuture<Void> writeWithFuture(Object message); + IoFuture<Void> writeWithFuture(Object message); /** * Internal method for enqueue write request after filter chain processing @@ -361,12 +361,12 @@ public interface IoSession { * @param writeRequest the message to put in the write request * @return the created write request */ - public WriteRequest enqueueWriteRequest(WriteRequest writeRequest); + WriteRequest enqueueWriteRequest(WriteRequest writeRequest); /** * Get the {@link Queue} of this session. The write queue contains the pending writes. * * @return the write queue of this session */ - public Queue<WriteRequest> getWriteQueue(); + Queue<WriteRequest> getWriteQueue(); } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/core/src/main/java/org/apache/mina/session/AbstractIoSession.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/mina/session/AbstractIoSession.java b/core/src/main/java/org/apache/mina/session/AbstractIoSession.java index 33943a9..3dc7c5a 100644 --- a/core/src/main/java/org/apache/mina/session/AbstractIoSession.java +++ b/core/src/main/java/org/apache/mina/session/AbstractIoSession.java @@ -262,7 +262,7 @@ public abstract class AbstractIoSession implements IoSession, ReadFilterChainCon * {@inheritDoc} */ @Override - public void changeState(final SessionState to) throws IllegalStateException { + public void changeState(final SessionState to) { try { stateWriteLock.lock(); http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/http/src/main/java/org/apache/mina/http/HttpServerDecoder.java ---------------------------------------------------------------------- diff --git a/http/src/main/java/org/apache/mina/http/HttpServerDecoder.java b/http/src/main/java/org/apache/mina/http/HttpServerDecoder.java index 4877dbc..e0a0262 100644 --- a/http/src/main/java/org/apache/mina/http/HttpServerDecoder.java +++ b/http/src/main/java/org/apache/mina/http/HttpServerDecoder.java @@ -26,7 +26,6 @@ import java.util.Map; import java.util.regex.Pattern; import org.apache.mina.codec.ProtocolDecoder; -import org.apache.mina.codec.ProtocolDecoderException; import org.apache.mina.http.api.HttpContentChunk; import org.apache.mina.http.api.HttpEndOfContent; import org.apache.mina.http.api.HttpMethod; @@ -79,7 +78,7 @@ public class HttpServerDecoder implements ProtocolDecoder<ByteBuffer, HttpPdu, H * {@inheritDoc} */ @Override - public HttpPdu decode(ByteBuffer msg, HttpDecoderState context) throws ProtocolDecoderException { + public HttpPdu decode(ByteBuffer msg, HttpDecoderState context) { LOG.debug("decode : {}", msg); if (msg.remaining() <= 0) { return null; http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/http/src/main/java/org/apache/mina/http/api/HttpPdu.java ---------------------------------------------------------------------- diff --git a/http/src/main/java/org/apache/mina/http/api/HttpPdu.java b/http/src/main/java/org/apache/mina/http/api/HttpPdu.java index d868a20..60e83a4 100644 --- a/http/src/main/java/org/apache/mina/http/api/HttpPdu.java +++ b/http/src/main/java/org/apache/mina/http/api/HttpPdu.java @@ -28,6 +28,6 @@ import java.nio.ByteBuffer; */ public interface HttpPdu { - public ByteBuffer encode(HttpPduEncodingVisitor visitor); + ByteBuffer encode(HttpPduEncodingVisitor visitor); } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/http/src/main/java/org/apache/mina/http/api/HttpPduEncodingVisitor.java ---------------------------------------------------------------------- diff --git a/http/src/main/java/org/apache/mina/http/api/HttpPduEncodingVisitor.java b/http/src/main/java/org/apache/mina/http/api/HttpPduEncodingVisitor.java index 206ae9b..d8f760d 100644 --- a/http/src/main/java/org/apache/mina/http/api/HttpPduEncodingVisitor.java +++ b/http/src/main/java/org/apache/mina/http/api/HttpPduEncodingVisitor.java @@ -28,11 +28,11 @@ import java.nio.ByteBuffer; */ public interface HttpPduEncodingVisitor { - public ByteBuffer visit(HttpRequest msg); + ByteBuffer visit(HttpRequest msg); - public ByteBuffer visit(HttpResponse msg); + ByteBuffer visit(HttpResponse msg); - public ByteBuffer visit(HttpContentChunk msg); + ByteBuffer visit(HttpContentChunk msg); - public ByteBuffer visit(HttpEndOfContent msg); + ByteBuffer visit(HttpEndOfContent msg); } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java ---------------------------------------------------------------------- diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java index ac1fbc3..08d3c3b 100644 --- a/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java +++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDecoder.java @@ -30,17 +30,16 @@ import com.google.protobuf.GeneratedMessage; */ public class ProtobufDecoder<M extends GeneratedMessage> extends SizePrefixedDecoder<M> { public static <L extends GeneratedMessage> ProtobufDecoder<L> newInstance(Class<L> clazz, - ExtensionRegistryLite registry) throws SecurityException, NoSuchMethodException { + ExtensionRegistryLite registry) throws NoSuchMethodException { return new ProtobufDecoder<L>(clazz, registry); } - public static <L extends GeneratedMessage> ProtobufDecoder<L> newInstance(Class<L> clazz) throws SecurityException, - NoSuchMethodException { + public static <L extends GeneratedMessage> ProtobufDecoder<L> newInstance(Class<L> clazz) + throws NoSuchMethodException { return newInstance(clazz, ExtensionRegistryLite.getEmptyRegistry()); } - public ProtobufDecoder(Class<M> clazz, ExtensionRegistryLite registry) throws SecurityException, - NoSuchMethodException { + public ProtobufDecoder(Class<M> clazz, ExtensionRegistryLite registry) throws NoSuchMethodException { super(new VarInt.Decoder(), ProtobufMessageDecoder.newInstance(clazz, registry)); } } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java ---------------------------------------------------------------------- diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java index ff02822..001fc92 100644 --- a/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java +++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/ProtobufDynamicDecoder.java @@ -29,12 +29,11 @@ import com.google.protobuf.GeneratedMessage; */ public class ProtobufDynamicDecoder extends SizePrefixedDecoder<ProtobufDynamicMessageDecoder.ProtobufSerializedMessage> { - public static <L extends GeneratedMessage> ProtobufDynamicDecoder newInstance() throws SecurityException, - NoSuchMethodException { + public static <L extends GeneratedMessage> ProtobufDynamicDecoder newInstance() throws NoSuchMethodException { return new ProtobufDynamicDecoder(); } - public ProtobufDynamicDecoder() throws SecurityException, NoSuchMethodException { + public ProtobufDynamicDecoder() throws NoSuchMethodException { super(new VarInt.Decoder(), ProtobufDynamicMessageDecoder.newInstance()); } } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java ---------------------------------------------------------------------- diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java index df60b70..c1dfef4 100644 --- a/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java +++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufDynamicMessageDecoder.java @@ -24,7 +24,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.nio.ByteBuffer; -import org.apache.mina.codec.ProtocolDecoderException; import org.apache.mina.codec.delimited.ByteBufferDecoder; import org.apache.mina.util.ByteBufferInputStream; @@ -48,7 +47,7 @@ public class ProtobufDynamicMessageDecoder extends } @Override - public ProtobufSerializedMessage decode(ByteBuffer input) throws ProtocolDecoderException { + public ProtobufSerializedMessage decode(ByteBuffer input) { return new ProtobufSerializedMessage(input); } @@ -61,14 +60,13 @@ public class ProtobufDynamicMessageDecoder extends @SuppressWarnings("unchecked") public <L extends GeneratedMessage> L get(Class<L> clazz, ExtensionRegistryLite registry) - throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, - InvocationTargetException { + throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Method parseMethod = clazz.getDeclaredMethod("parseFrom", InputStream.class, ExtensionRegistryLite.class); return (L) parseMethod.invoke(null, new ByteBufferInputStream(input.duplicate()), registry); } - public <L extends GeneratedMessage> L get(Class<L> clazz) throws SecurityException, NoSuchMethodException, - IllegalArgumentException, IllegalAccessException, InvocationTargetException { + public <L extends GeneratedMessage> L get(Class<L> clazz) throws NoSuchMethodException, IllegalAccessException, + InvocationTargetException { return get(clazz, ExtensionRegistryLite.getEmptyRegistry()); } } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java ---------------------------------------------------------------------- diff --git a/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java index 3466da1..62e0781 100644 --- a/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java +++ b/protobuf/src/main/java/org/apache/mina/codec/delimited/serialization/ProtobufMessageDecoder.java @@ -39,17 +39,16 @@ public class ProtobufMessageDecoder<IN extends GeneratedMessage> extends ByteBuf private final ExtensionRegistryLite registry; public static <TYPE extends GeneratedMessage> ProtobufMessageDecoder<TYPE> newInstance(Class<TYPE> c) - throws SecurityException, NoSuchMethodException { + throws NoSuchMethodException { return newInstance(c, ExtensionRegistryLite.getEmptyRegistry()); } public static <TYPE extends GeneratedMessage> ProtobufMessageDecoder<TYPE> newInstance(Class<TYPE> c, - ExtensionRegistryLite registry) throws SecurityException, NoSuchMethodException { + ExtensionRegistryLite registry) throws NoSuchMethodException { return new ProtobufMessageDecoder<TYPE>(c, registry); } - private ProtobufMessageDecoder(Class<IN> clazz, ExtensionRegistryLite registry) throws SecurityException, - NoSuchMethodException { + private ProtobufMessageDecoder(Class<IN> clazz, ExtensionRegistryLite registry) throws NoSuchMethodException { super(); parseMethod = clazz.getDeclaredMethod("parseFrom", InputStream.class, ExtensionRegistryLite.class); this.registry = registry; @@ -57,7 +56,7 @@ public class ProtobufMessageDecoder<IN extends GeneratedMessage> extends ByteBuf @SuppressWarnings("unchecked") @Override - public IN decode(ByteBuffer input) throws ProtocolDecoderException { + public IN decode(ByteBuffer input) { try { return (IN) parseMethod.invoke(null, new ByteBufferInputStream(input), registry); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java ---------------------------------------------------------------------- diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java index e601ce8..15154ed 100644 --- a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java +++ b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDecoder.java @@ -26,12 +26,11 @@ import org.apache.thrift.TBase; * @author <a href="http://mina.apache.org">Apache MINA Project</a> */ public class ThriftDecoder<M extends TBase<?, ?>> extends SizePrefixedDecoder<M> { - public static <L extends TBase<?, ?>> ThriftDecoder<L> newInstance(Class<L> clazz) throws SecurityException, - NoSuchMethodException { + public static <L extends TBase<?, ?>> ThriftDecoder<L> newInstance(Class<L> clazz) throws NoSuchMethodException { return new ThriftDecoder<L>(clazz); } - public ThriftDecoder(Class<M> clazz) throws SecurityException, NoSuchMethodException { + public ThriftDecoder(Class<M> clazz) throws NoSuchMethodException { super(new RawInt32.Decoder(RawInt32.Endianness.BIG), null); } } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java ---------------------------------------------------------------------- diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java index 1e80f99..f04a688 100644 --- a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java +++ b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftDynamicDecoder.java @@ -27,12 +27,11 @@ import org.apache.thrift.TBase; * @author <a href="http://mina.apache.org">Apache MINA Project</a> */ public class ThriftDynamicDecoder extends SizePrefixedDecoder<ThriftDynamicMessageDecoder.ThriftSerializedMessage> { - public static <L extends TBase<?, ?>> ThriftDynamicDecoder newInstance() throws SecurityException, - NoSuchMethodException { + public static <L extends TBase<?, ?>> ThriftDynamicDecoder newInstance() throws NoSuchMethodException { return new ThriftDynamicDecoder(); } - public ThriftDynamicDecoder() throws SecurityException, NoSuchMethodException { + public ThriftDynamicDecoder() throws NoSuchMethodException { super(new VarInt.Decoder(), ThriftDynamicMessageDecoder.newInstance()); } } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java ---------------------------------------------------------------------- diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java index bbde43a..5f98f98 100644 --- a/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java +++ b/thrift/src/main/java/org/apache/mina/codec/delimited/ThriftEncoder.java @@ -29,12 +29,11 @@ import org.apache.thrift.TBase; */ public class ThriftEncoder<OUT extends TBase<?, ?>> extends SizePrefixedEncoder<OUT> { - public static <L extends TBase<?, ?>> ThriftEncoder<L> newInstance(Class<L> clazz) throws SecurityException, - NoSuchMethodException { + public static <L extends TBase<?, ?>> ThriftEncoder<L> newInstance(Class<L> clazz) throws NoSuchMethodException { return new ThriftEncoder<L>(clazz); } - public ThriftEncoder(Class<OUT> clazz) throws SecurityException, NoSuchMethodException { + public ThriftEncoder(Class<OUT> clazz) throws NoSuchMethodException { super(new RawInt32.Encoder(Endianness.BIG), ThriftMessageEncoder.newInstance(clazz)); } } http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java ---------------------------------------------------------------------- diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java index a38ceaa..32006ac 100644 --- a/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java +++ b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftDynamicMessageDecoder.java @@ -21,7 +21,6 @@ package org.apache.mina.codec.delimited.serialization; import java.nio.ByteBuffer; -import org.apache.mina.codec.ProtocolDecoderException; import org.apache.mina.codec.delimited.ByteBufferDecoder; import org.apache.thrift.TBase; import org.apache.thrift.TDeserializer; @@ -35,7 +34,7 @@ public class ThriftDynamicMessageDecoder extends ByteBufferDecoder<ThriftDynamic private TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory()); @Override - public ThriftSerializedMessage decode(ByteBuffer input) throws ProtocolDecoderException { + public ThriftSerializedMessage decode(ByteBuffer input) { byte array[] = new byte[input.remaining()]; input.get(array); return new ThriftSerializedMessage(deserializer, array); http://git-wip-us.apache.org/repos/asf/mina/blob/13d52b88/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java ---------------------------------------------------------------------- diff --git a/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java index 9de4112..a25c20e 100644 --- a/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java +++ b/thrift/src/main/java/org/apache/mina/codec/delimited/serialization/ThriftMessageDecoder.java @@ -21,7 +21,6 @@ package org.apache.mina.codec.delimited.serialization; import java.nio.ByteBuffer; -import org.apache.mina.codec.ProtocolDecoderException; import org.apache.mina.codec.delimited.ByteBufferDecoder; import org.apache.thrift.TBase; import org.apache.thrift.TDeserializer; @@ -37,7 +36,7 @@ public class ThriftMessageDecoder<IN extends TBase<?, ?>> extends ByteBufferDeco } @Override - public IN decode(ByteBuffer input) throws ProtocolDecoderException { + public IN decode(ByteBuffer input) { IN object; try { byte array[] = new byte[input.remaining()];
