Fix checkstyle

This commit is contained in:
Trustin Lee 2013-03-13 17:07:47 +09:00
parent f7f6e69bb6
commit 067a0a8a78

View File

@ -15,8 +15,10 @@
*/ */
package org.jboss.netty.handler.codec.protobuf; package org.jboss.netty.handler.codec.protobuf;
import com.google.protobuf.ExtensionRegistry;
import com.google.protobuf.Message;
import com.google.protobuf.MessageLite;
import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBufferInputStream;
import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandler.Sharable; import org.jboss.netty.channel.ChannelHandler.Sharable;
import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelHandlerContext;
@ -27,10 +29,6 @@ import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.LengthFieldPrepender; import org.jboss.netty.handler.codec.frame.LengthFieldPrepender;
import org.jboss.netty.handler.codec.oneone.OneToOneDecoder; import org.jboss.netty.handler.codec.oneone.OneToOneDecoder;
import com.google.protobuf.ExtensionRegistry;
import com.google.protobuf.Message;
import com.google.protobuf.MessageLite;
/** /**
* Decodes a received {@link ChannelBuffer} into a * Decodes a received {@link ChannelBuffer} into a
* <a href="http://code.google.com/p/protobuf/">Google Protocol Buffers</a> * <a href="http://code.google.com/p/protobuf/">Google Protocol Buffers</a>
@ -110,26 +108,26 @@ public class ProtobufDecoder extends OneToOneDecoder {
final int offset; final int offset;
final int length = buf.readableBytes(); final int length = buf.readableBytes();
if (buf.hasArray()){ if (buf.hasArray()) {
array = buf.array(); array = buf.array();
offset = buf.arrayOffset() + buf.readerIndex(); offset = buf.arrayOffset() + buf.readerIndex();
}else { } else {
array = new byte[length]; array = new byte[length];
buf.getBytes(buf.readerIndex(),array,0,length); buf.getBytes(buf.readerIndex(), array, 0, length);
offset = 0; offset = 0;
} }
if (extensionRegistry == null){ if (extensionRegistry == null) {
if(HAS_PARSER){ if (HAS_PARSER) {
return prototype.getParserForType().parseFrom(array,offset,length); return prototype.getParserForType().parseFrom(array, offset, length);
}else{ } else {
return prototype.newBuilderForType().mergeFrom(array,offset,length).build(); return prototype.newBuilderForType().mergeFrom(array, offset, length).build();
} }
}else { } else {
if(HAS_PARSER){ if (HAS_PARSER) {
return prototype.getParserForType().parseFrom(array,offset,length,extensionRegistry); return prototype.getParserForType().parseFrom(array, offset, length, extensionRegistry);
}else{ } else {
return prototype.newBuilderForType().mergeFrom(array,offset,length,extensionRegistry).build(); return prototype.newBuilderForType().mergeFrom(array, offset, length, extensionRegistry).build();
} }
} }
} }