summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgidijus Vaishnora2011-02-22 15:51:05 (EST)
committerEgidijus Vaishnora2011-02-22 15:51:05 (EST)
commit65e4365c34dbb2c48c3a36cee1768ba16756b570 (patch)
treee2f756da6599b223f63b0afabf36293394178c37
parentb552164e743c785ac3ed5279862a55cdee5d9ef9 (diff)
downloadcdo-65e4365c34dbb2c48c3a36cee1768ba16756b570.zip
cdo-65e4365c34dbb2c48c3a36cee1768ba16756b570.tar.gz
cdo-65e4365c34dbb2c48c3a36cee1768ba16756b570.tar.bz2
[337447] Bug fix https://bugs.eclipse.org/bugs/show_bug.cgi?id=337447
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferInputStream.java5
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferOutputStream.java5
2 files changed, 8 insertions, 2 deletions
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferInputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferInputStream.java
index 9228ee9..f0953e2 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferInputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferInputStream.java
@@ -38,6 +38,8 @@ public class BufferInputStream extends InputStream implements IBufferHandler
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_BUFFER_STREAM, BufferInputStream.class);
+ private final boolean tracerEnabled;
+
private BlockingQueue<IBuffer> buffers = new LinkedBlockingQueue<IBuffer>();
private IBuffer currentBuffer;
@@ -50,6 +52,7 @@ public class BufferInputStream extends InputStream implements IBufferHandler
public BufferInputStream()
{
+ tracerEnabled = TRACER.isEnabled();
}
public long getMillisBeforeTimeout()
@@ -121,7 +124,7 @@ public class BufferInputStream extends InputStream implements IBufferHandler
}
final int result = byteBuffer.get() & 0xFF;
- if (TRACER.isEnabled())
+ if (tracerEnabled)
{
TRACER.trace("<-- " + HexUtil.formatByte(result) //$NON-NLS-1$
+ (result >= 32 ? " " + Character.toString((char)result) : "")); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferOutputStream.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferOutputStream.java
index 0a43aec..7b62159 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferOutputStream.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/buffer/BufferOutputStream.java
@@ -33,6 +33,8 @@ public class BufferOutputStream extends OutputStream
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_BUFFER_STREAM, BufferOutputStream.class);
+ private final boolean tracerEnabled;
+
private IBufferProvider bufferProvider;
private IBufferHandler bufferHandler;
@@ -67,6 +69,7 @@ public class BufferOutputStream extends OutputStream
this.bufferHandler = bufferHandler;
this.bufferProvider = bufferProvider;
this.channelID = channelID;
+ tracerEnabled = TRACER.isEnabled();
}
public BufferOutputStream(IBufferHandler bufferHandler, short channelID)
@@ -102,7 +105,7 @@ public class BufferOutputStream extends OutputStream
// the implicit conversion prepended 24 leading 1's. We'll undo those.
b = b & 0xFF;
- if (TRACER.isEnabled())
+ if (tracerEnabled)
{
TRACER.trace("--> " + HexUtil.formatByte(b) //$NON-NLS-1$
+ (b >= 32 ? " " + Character.toString((char)b) : "")); //$NON-NLS-1$ //$NON-NLS-2$