diff options
Diffstat (limited to 'qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java')
-rw-r--r-- | qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java index a8a4997ae7..09ce6a7eb1 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/transport/codec/AbstractDecoder.java @@ -143,10 +143,18 @@ abstract class AbstractDecoder implements Decoder short size = readUint8(); Binary bin = get(size); String str = str8cache.get(bin); + if (str == null) { str = decode(bin.array(), bin.offset(), bin.size(), "UTF-8"); - str8cache.put(bin, str); + if(bin.hasExcessCapacity()) + { + str8cache.put(bin.copy(), str); + } + else + { + str8cache.put(bin, str); + } } return str; } |