Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Fix a few eclipse-reported warnings"
[controller.git]
/
opendaylight
/
netconf
/
netconf-util
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
util
/
handler
/
NetconfMessageAggregator.java
diff --git
a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
index 131c3d71a57c9df779302ca4ff352e10f53841e6..a2486050f9368e7ff37314a1e65e38e7134406ed 100644
(file)
--- a/
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
+++ b/
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
@@
-8,26
+8,26
@@
package org.opendaylight.controller.netconf.util.handler;
package org.opendaylight.controller.netconf.util.handler;
-import java.util.List;
-
+import com.google.common.base.Charsets;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
-import org.opendaylight.controller.netconf.util.messages.NetconfMessage
Factory
;
+import org.opendaylight.controller.netconf.util.messages.NetconfMessage
Constants
;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.ByteToMessageDecoder;
+import java.util.List;
public class NetconfMessageAggregator extends ByteToMessageDecoder {
private final static Logger logger = LoggerFactory.getLogger(NetconfMessageAggregator.class);
public class NetconfMessageAggregator extends ByteToMessageDecoder {
private final static Logger logger = LoggerFactory.getLogger(NetconfMessageAggregator.class);
- private byte[] eom = NetconfMessage
Factory
.endOfMessage;
+ private byte[] eom = NetconfMessage
Constants
.endOfMessage;
public NetconfMessageAggregator(FramingMechanism framingMechanism) {
if (framingMechanism == FramingMechanism.CHUNK) {
public NetconfMessageAggregator(FramingMechanism framingMechanism) {
if (framingMechanism == FramingMechanism.CHUNK) {
- eom = NetconfMessage
Factory
.endOfChunk;
+ eom = NetconfMessage
Constants
.endOfChunk;
}
}
}
}
@@
-35,13
+35,17
@@
public class NetconfMessageAggregator extends ByteToMessageDecoder {
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
int index = indexOfSequence(in, eom);
if (index == -1) {
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
int index = indexOfSequence(in, eom);
if (index == -1) {
- logger.debug("Message is not complete, read agian.");
+ logger.debug("Message is not complete, read again.");
+ if (logger.isTraceEnabled()) {
+ String str = in.toString(Charsets.UTF_8);
+ logger.trace("Message read so far: {}", str);
+ }
ctx.read();
} else {
ByteBuf msg = in.readBytes(index);
in.readBytes(eom.length);
in.discardReadBytes();
ctx.read();
} else {
ByteBuf msg = in.readBytes(index);
in.readBytes(eom.length);
in.discardReadBytes();
- logger.debug("Message is complete.
{}", msg.readableBytes()
);
+ logger.debug("Message is complete.
"
);
out.add(msg);
}
}
out.add(msg);
}
}