From 2f07cfc0e1b00b76e0b73884fffd959750a7dfe8 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Wed, 4 May 2011 02:29:25 +0000 Subject: Fallback to original value if decompression fails. --- src/main/java/com/amazon/carbonado/raw/GzipCompressor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/amazon/carbonado/raw/GzipCompressor.java b/src/main/java/com/amazon/carbonado/raw/GzipCompressor.java index 3dacf23..075ca91 100644 --- a/src/main/java/com/amazon/carbonado/raw/GzipCompressor.java +++ b/src/main/java/com/amazon/carbonado/raw/GzipCompressor.java @@ -25,6 +25,7 @@ import java.util.zip.Deflater; import java.util.zip.DeflaterOutputStream; import java.util.zip.Inflater; import java.util.zip.InflaterOutputStream; +import java.util.zip.ZipException; import com.amazon.carbonado.CorruptEncodingException; import com.amazon.carbonado.SupportException; @@ -92,6 +93,9 @@ public class GzipCompressor { ios.write(value, prefix, value.length - prefix); ios.close(); return bos.toByteArray(); + } catch (ZipException e) { + // Assume it wasn't compressed. + return value; } catch (IOException e) { throw new CorruptEncodingException(e); } finally { -- cgit v1.2.3