Remove unnecessary throws clauses for unchecked exceptions

This commit is contained in:
Trustin Lee 2012-11-10 07:07:37 +09:00
parent 0d0eb0abfb
commit d6a0fe54fd
5 changed files with 13 additions and 12 deletions

View File

@ -531,7 +531,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<Object, HttpMe
} }
} }
private State readHeaders(ByteBuf buffer) throws TooLongFrameException { private State readHeaders(ByteBuf buffer) {
headerSize = 0; headerSize = 0;
final HttpMessage message = this.message; final HttpMessage message = this.message;
String line = readHeader(buffer); String line = readHeader(buffer);
@ -577,7 +577,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<Object, HttpMe
return nextState; return nextState;
} }
private HttpChunkTrailer readTrailingHeaders(ByteBuf buffer) throws TooLongFrameException { private HttpChunkTrailer readTrailingHeaders(ByteBuf buffer) {
headerSize = 0; headerSize = 0;
String line = readHeader(buffer); String line = readHeader(buffer);
String lastHeader = null; String lastHeader = null;
@ -614,7 +614,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<Object, HttpMe
return HttpChunk.LAST_CHUNK; return HttpChunk.LAST_CHUNK;
} }
private String readHeader(ByteBuf buffer) throws TooLongFrameException { private String readHeader(ByteBuf buffer) {
StringBuilder sb = new StringBuilder(64); StringBuilder sb = new StringBuilder(64);
int headerSize = this.headerSize; int headerSize = this.headerSize;
@ -672,7 +672,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<Object, HttpMe
return Integer.parseInt(hex, 16); return Integer.parseInt(hex, 16);
} }
private static String readLine(ByteBuf buffer, int maxLineLength) throws TooLongFrameException { private static String readLine(ByteBuf buffer, int maxLineLength) {
StringBuilder sb = new StringBuilder(64); StringBuilder sb = new StringBuilder(64);
int lineLength = 0; int lineLength = 0;
while (true) { while (true) {

View File

@ -70,7 +70,7 @@ public class WebSocket00FrameDecoder extends ReplayingDecoder<WebSocketFrame, Vo
} }
} }
private WebSocketFrame decodeBinaryFrame(byte type, ByteBuf buffer) throws TooLongFrameException { private WebSocketFrame decodeBinaryFrame(byte type, ByteBuf buffer) {
long frameSize = 0; long frameSize = 0;
int lengthFieldSize = 0; int lengthFieldSize = 0;
byte b; byte b;
@ -96,7 +96,7 @@ public class WebSocket00FrameDecoder extends ReplayingDecoder<WebSocketFrame, Vo
return new BinaryWebSocketFrame(buffer.readBytes((int) frameSize)); return new BinaryWebSocketFrame(buffer.readBytes((int) frameSize));
} }
private WebSocketFrame decodeTextFrame(ByteBuf buffer) throws TooLongFrameException { private WebSocketFrame decodeTextFrame(ByteBuf buffer) {
int ridx = buffer.readerIndex(); int ridx = buffer.readerIndex();
int rbytes = actualReadableBytes(); int rbytes = actualReadableBytes();
int delimPos = buffer.indexOf(ridx, ridx + rbytes, (byte) 0xFF); int delimPos = buffer.indexOf(ridx, ridx + rbytes, (byte) 0xFF);

View File

@ -366,7 +366,7 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder<WebSocketFrame, We
} }
} }
private void protocolViolation(ChannelHandlerContext ctx, String reason) throws CorruptedFrameException { private void protocolViolation(ChannelHandlerContext ctx, String reason) {
checkpoint(State.CORRUPT); checkpoint(State.CORRUPT);
if (ctx.channel().isActive()) { if (ctx.channel().isActive()) {
ctx.flush().addListener(ChannelFutureListener.CLOSE); ctx.flush().addListener(ChannelFutureListener.CLOSE);
@ -374,7 +374,7 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder<WebSocketFrame, We
throw new CorruptedFrameException(reason); throw new CorruptedFrameException(reason);
} }
private static int toFrameLength(long l) throws TooLongFrameException { private static int toFrameLength(long l) {
if (l > Integer.MAX_VALUE) { if (l > Integer.MAX_VALUE) {
throw new TooLongFrameException("Length:" + l); throw new TooLongFrameException("Length:" + l);
} else { } else {
@ -382,7 +382,7 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder<WebSocketFrame, We
} }
} }
private void checkUTF8String(ChannelHandlerContext ctx, byte[] bytes) throws CorruptedFrameException { private void checkUTF8String(ChannelHandlerContext ctx, byte[] bytes) {
try { try {
if (fragmentedFramesText == null) { if (fragmentedFramesText == null) {
fragmentedFramesText = new UTF8Output(bytes); fragmentedFramesText = new UTF8Output(bytes);
@ -394,8 +394,9 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder<WebSocketFrame, We
} }
} }
/** */
protected void checkCloseFrameBody( protected void checkCloseFrameBody(
ChannelHandlerContext ctx, ByteBuf buffer) throws CorruptedFrameException { ChannelHandlerContext ctx, ByteBuf buffer) {
if (buffer == null || buffer.capacity() == 0) { if (buffer == null || buffer.capacity() == 0) {
return; return;
} }

View File

@ -206,7 +206,7 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
* @throws WebSocketHandshakeException * @throws WebSocketHandshakeException
*/ */
@Override @Override
public void finishHandshake(Channel channel, HttpResponse response) throws WebSocketHandshakeException { public void finishHandshake(Channel channel, HttpResponse response) {
final HttpResponseStatus status = new HttpResponseStatus(101, "WebSocket Protocol Handshake"); final HttpResponseStatus status = new HttpResponseStatus(101, "WebSocket Protocol Handshake");
if (!response.getStatus().equals(status)) { if (!response.getStatus().equals(status)) {

View File

@ -182,7 +182,7 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker {
* @throws WebSocketHandshakeException * @throws WebSocketHandshakeException
*/ */
@Override @Override
public void finishHandshake(Channel channel, HttpResponse response) throws WebSocketHandshakeException { public void finishHandshake(Channel channel, HttpResponse response) {
final HttpResponseStatus status = HttpResponseStatus.SWITCHING_PROTOCOLS; final HttpResponseStatus status = HttpResponseStatus.SWITCHING_PROTOCOLS;
if (!response.getStatus().equals(status)) { if (!response.getStatus().equals(status)) {