summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2011-05-04 02:29:25 +0000
committerBrian S. O'Neill <bronee@gmail.com>2011-05-04 02:29:25 +0000
commit2f07cfc0e1b00b76e0b73884fffd959750a7dfe8 (patch)
tree9c897d55fa38136b7f675f70c1490bb255135667 /src/main/java/com/amazon
parent121886bc0c92389610408e3b415abb992ad8a212 (diff)
Fallback to original value if decompression fails.
Diffstat (limited to 'src/main/java/com/amazon')
-rw-r--r--src/main/java/com/amazon/carbonado/raw/GzipCompressor.java4
1 files changed, 4 insertions, 0 deletions
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 {