Coverage Report - org.mule.transformers.compression.GZipUncompressTransformer
 
Classes in this File Line Coverage Branch Coverage Complexity
GZipUncompressTransformer
80%
8/10
100%
4/4
3
 
 1  
 /*
 2  
  * $Id: GZipUncompressTransformer.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.transformers.compression;
 12  
 
 13  
 import org.mule.config.i18n.MessageFactory;
 14  
 import org.mule.umo.transformer.TransformerException;
 15  
 
 16  
 import java.io.IOException;
 17  
 
 18  
 import org.apache.commons.lang.SerializationUtils;
 19  
 
 20  
 /**
 21  
  * <code>GZipCompressTransformer</code> TODO
 22  
  */
 23  
 public class GZipUncompressTransformer extends GZipCompressTransformer
 24  
 {
 25  
 
 26  
     public GZipUncompressTransformer()
 27  
     {
 28  24
         super();
 29  24
     }
 30  
 
 31  
     // @Override
 32  
     public Object doTransform(Object src, String encoding) throws TransformerException
 33  
     {
 34  10
         byte[] buffer = null;
 35  
 
 36  
         try
 37  
         {
 38  10
             buffer = getStrategy().uncompressByteArray((byte[]) src);
 39  
         }
 40  0
         catch (IOException e)
 41  
         {
 42  0
             throw new TransformerException(MessageFactory.createStaticMessage("Failed to uncompress message."),
 43  
                 this, e);
 44  10
         }
 45  
 
 46  12
         if (!getReturnClass().equals(byte[].class))
 47  
         {
 48  6
             return SerializationUtils.deserialize(buffer);
 49  
         }
 50  
 
 51  4
         return buffer;
 52  
     }
 53  
 
 54  
 }