From 54b03e4b3ce8ef1a294c23c4369579c7043f2287 Mon Sep 17 00:00:00 2001 From: Tobias Holgers Date: Wed, 22 Apr 2009 17:37:20 +0000 Subject: Do not encode suffix in encodeSearchKeyPrefix --- .../java/com/amazon/carbonado/raw/GenericEncodingStrategy.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/amazon/carbonado') diff --git a/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java b/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java index d89aca5..b7356d7 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java @@ -738,8 +738,10 @@ public class GenericEncodingStrategy { } } - boolean doPartial = mode == Mode.SERIAL - || mode == Mode.KEY && (partialStartVar != null || partialEndVar != null); + boolean doPartial = + mode == Mode.SERIAL || + (mode == Mode.KEY && partialStartVar != null) || + (mode == Mode.KEY && (properties.length == 0 || partialEndVar != null)); // Calculate exactly how many bytes are needed to encode. The length // is composed of a static and a variable amount. The variable amount @@ -751,7 +753,7 @@ public class GenericEncodingStrategy { // against runtime partial start value. staticLength += prefix + generationPrefix; } - if (mode != Mode.KEY || partialEndVar == null) { + if (mode != Mode.KEY || (properties.length != 0 && partialEndVar == null)) { // Only include suffix as static if no runtime check is needed // against runtime partial end value. staticLength += suffix; -- cgit v1.2.3