Fix buffer handling; decrease logger verbosity
diff --git a/src/main/java/com/intel/jndn/mock/MockTransport.java b/src/main/java/com/intel/jndn/mock/MockTransport.java
index ee9c4e3..f8ed15e 100644
--- a/src/main/java/com/intel/jndn/mock/MockTransport.java
+++ b/src/main/java/com/intel/jndn/mock/MockTransport.java
@@ -13,6 +13,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import net.named_data.jndn.Data;
import net.named_data.jndn.encoding.ElementListener;
@@ -47,15 +48,15 @@
}
/**
- *
+ *
*/
public void clear() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
- *
- * @return
+ *
+ * @return
*/
public List<Data> getSentDataPackets() {
return outputPackets;
@@ -113,7 +114,7 @@
@Override
public void send(ByteBuffer data) throws IOException {
logger.debug("Sending " + (data.capacity() - data.position()) + " bytes");
-
+
// add to sent bytes
outputBuffer.put(data);
data.flip();
@@ -142,11 +143,15 @@
return;
}
+ logger.trace(String.format("Sending buffer (position: %s, limit: %s, capacity: %s): %s", inputBuffer.position(), inputBuffer.limit(), inputBuffer.capacity(), Arrays.toString(inputBuffer.array())));
+
// pass data up to face
- inputBuffer.limit(inputBuffer.capacity());
+ inputBuffer.limit(inputBuffer.position());
inputBuffer.position(0);
elementReader.onReceivedData(inputBuffer);
+ logger.trace(String.format("Sending buffer (position: %s, limit: %s, capacity: %s): %s", inputBuffer.position(), inputBuffer.limit(), inputBuffer.capacity(), Arrays.toString(inputBuffer.array())));
+
// reset buffer
inputBuffer = ByteBuffer.allocate(BUFFER_CAPACITY);
}
diff --git a/src/main/resources/log4j2-test.xml b/src/main/resources/log4j2-test.xml
index 9e29cc3..602b5ab 100644
--- a/src/main/resources/log4j2-test.xml
+++ b/src/main/resources/log4j2-test.xml
@@ -6,7 +6,7 @@
</Console>
</Appenders>
<Loggers>
- <Root level="trace">
+ <Root level="info">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 8f7a167..0dac33a 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -6,7 +6,7 @@
</Console>
</Appenders>
<Loggers>
- <Root level="error">
+ <Root level="warn">
<AppenderRef ref="Console"/>
</Root>
</Loggers>