From fb4121548fcbd904db954f171989686a46291dab Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Mon, 5 Nov 2012 19:05:24 +0000 Subject: Use proper key for alt generation decoder. --- .../com/amazon/carbonado/raw/GenericStorableCodec.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/main/java/com/amazon') diff --git a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java index 92a6473..e443f18 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java @@ -522,19 +522,16 @@ public class GenericStorableCodec implements StorableCodec decoder = (Decoder) decoders.get(generation); if (decoder == null) { synchronized (cCodecDecoders) { - Object key = KeyFactory.createKey(new Object[] {mCodecKey, generation}); + Object altLayoutKey = new LayoutKey(mLayout.getGeneration(generation)); + Object key = KeyFactory.createKey + // Note: Generation is still required in the key + // because an equivalent layout (with different generation) + // might have been supplied by Layout.getGeneration. + (new Object[] {mCodecKey, generation, altLayoutKey}); decoder = (Decoder) cCodecDecoders.get(key); if (decoder == null) { decoder = generateDecoder(generation); cCodecDecoders.put(key, decoder); - } else { - // Confirm that layout still exists. - try { - mLayout.getGeneration(generation); - } catch (FetchNoneException e) { - cCodecDecoders.remove(key); - throw e; - } } } mDecoders.put(generation, decoder); -- cgit v1.2.3