diff options
author | Tobias Holgers <tholgers@users.sourceforge.net> | 2009-04-22 17:37:20 +0000 |
---|---|---|
committer | Tobias Holgers <tholgers@users.sourceforge.net> | 2009-04-22 17:37:20 +0000 |
commit | 54b03e4b3ce8ef1a294c23c4369579c7043f2287 (patch) | |
tree | 560fbd0c67f3a64c77af645b2c228f71de7203a8 | |
parent | 423b9acc47e05b6574e46665633352d8b42fea9a (diff) |
Do not encode suffix in encodeSearchKeyPrefix
-rw-r--r-- | pom.xml | 7 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java | 8 |
2 files changed, 12 insertions, 3 deletions
@@ -127,6 +127,13 @@ <email>peter_carbon@users.sourceforge.net</email>
<organization>Amazon Technologies, Inc.</organization>
</developer>
+
+ <developer>
+ <name>Tobias Holgers</name>
+ <id>tholgers</id>
+ <email>tholgers@users.sourceforge.net</email>
+ <organization>Amazon Technologies, Inc.</organization>
+ </developer>
</developers>
<contributors>
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<S extends Storable> { }
}
- 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<S extends Storable> { // 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;
|