summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-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);
}