summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2011-03-19 20:00:48 +0000
committerBrian S. O'Neill <bronee@gmail.com>2011-03-19 20:00:48 +0000
commit84fcfe9ab82e3399380dae70eee7c0d7649e98db (patch)
tree4bbf6c3322c2a28463c4b90ead39717d11bc0912 /src/main
parent65f63701e0f7406d5121a5c0114329f9c075d193 (diff)
Fixes for compression options.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/amazon/carbonado/raw/CompressedStorableCodecFactory.java7
-rw-r--r--src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java12
2 files changed, 16 insertions, 3 deletions
diff --git a/src/main/java/com/amazon/carbonado/raw/CompressedStorableCodecFactory.java b/src/main/java/com/amazon/carbonado/raw/CompressedStorableCodecFactory.java
index 0913102..27d8de4 100644
--- a/src/main/java/com/amazon/carbonado/raw/CompressedStorableCodecFactory.java
+++ b/src/main/java/com/amazon/carbonado/raw/CompressedStorableCodecFactory.java
@@ -66,9 +66,12 @@ public class CompressedStorableCodecFactory extends GenericStorableCodecFactory
{
CompressionType compType;
if (options == null) {
- compType = getCompressionType(type);
+ // No options means no compression.
+ compType = CompressionType.NONE;
} else {
- compType = CompressionType.valueOf(options.getCompressionType());
+ String compTypeString = options.getCompressionType();
+ compType = compTypeString == null ? CompressionType.NONE
+ : CompressionType.valueOf(compTypeString);
}
return new CompressedEncodingStrategy<S>(type, pkIndex, compType);
diff --git a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java
index 22f36ea..bc272da 100644
--- a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java
+++ b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java
@@ -48,6 +48,7 @@ import com.amazon.carbonado.info.StorableIntrospector;
import com.amazon.carbonado.info.StorableProperty;
import com.amazon.carbonado.layout.Layout;
+import com.amazon.carbonado.layout.LayoutOptions;
import com.amazon.carbonado.gen.CodeBuilderUtil;
import com.amazon.carbonado.gen.StorableGenerator;
@@ -745,8 +746,17 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S
GenericEncodingStrategy<? extends Storable> altStrategy;
try {
Layout altLayout = mLayout.getGeneration(generation);
+
altStorable = altLayout.reconstruct(mStorableClass.getClassLoader());
- altStrategy = mFactory.createStrategy(altStorable, null, altLayout.getOptions());
+
+ LayoutOptions options = altLayout.getOptions();
+ if (options == null) {
+ // Explictly specify no options, to prevent the factory from
+ // trying to infer what null options means.
+ options = new LayoutOptions();
+ }
+
+ altStrategy = mFactory.createStrategy(altStorable, null, options);
} catch (RepositoryException e) {
throw new CorruptEncodingException(e);
}