Issue Details (XML | Word | Printable)

Key: MULE-1668
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Dirk Olmes
Reporter: Brian Kalbfus
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Mule

GZipUncompressTransformer and compressed data

Created: 24/Apr/07 01:07 PM   Updated: 13/Dec/07 10:05 AM
Component/s: Core: Transformers, Documentation / Website
Affects Version/s: 1.4.3, 2.0.0-RC1
Fix Version/s: 1.4.4, 2.0.0-RC2

Time Tracking:
Not Specified

File Attachments: 1. Text File stackdump.txt (18 kB)
2. Text File stackdump.txt (10 kB)

Issue Links:
Duplicate
 

Labels:
User impact: Medium


 Description  « Hide
It seems to me that I could take up a compressed file, run it through the GZipUncompressTransformer, and have the decompressed contents of the file as output. Looking at the code, it now seems to me that GZipUncompressTransformer only works on serialized java objects. Please document this on http://mule.codehaus.org/display/MULE/Transformers . Also, the class name of the Transformer is not correct on this page - I had to do a java search in eclipse to guess the correct class name.

If you can get the transformer to recognize a byte array that isn't a serialized java object and return that instead, that would be good, too. Perhaps a catch on org.apache.commons.lang.SerializationException . . .



 All   Comments   Work Log   Change History   Transitions   FishEye      Sort Order: Ascending order - Click to sort in descending order
Dirk Olmes added a comment - 25/Apr/07 05:01 AM
I have updated the class names on the wiki.

As for the implementation of the gzip transformers I'd suggest dropping the serialization functionality. As transformers can be chained I would vote for much finer grained transformers. As with unix toosl - have one tool (transformer) perform one task correctly and chain them together to achieve what you're trying to do.


Holger Hoffstaette added a comment - 25/Apr/07 05:19 AM
According to the source in trunk the deserializaton is only attempted when the returnClass is not the default byte[]. By default no deserialization should be attempted; if it is that's a bug. Still, by default it should handle non-object byte[]s just fine. See GZipTransformerTestCase where this is used.

Holger Hoffstaette added a comment - 25/Apr/07 06:39 AM
I added another test case explicitly for a regular raw byte[] in r6167. Brian, please let us know how to proceed with this since it does not seem to be a bug, at least not in 1.4.0 or trunk/1.4.1.

Brian Kalbfus added a comment - 25/Apr/07 10:41 AM
My source was a text document compressed by cygwin's gzip command. Here is the stacktrace. Stepping through the debug in eclipse, I see that getReturnClass() returns "java.lang.Object". buffer.getClass() returns "class [B". I'm using the latest released 1.4 - I downloaded it yesterday.

My config is:
<code>
<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mule-configuration PUBLIC "-//MuleSource //DTD mule-configuration XML V1.0//EN"
"http://mule.mulesource.org/dtds/mule-configuration.dtd">

<mule-configuration id="Mule_Echo_Sample" version="1.0">

<description>
This is a simple component example that demostrates how to
expose a component over multiple transports.

To invoke the EchoUMO component as a webservice hit the
following URL -
http://localhost:8081/services/EchoUMO?method=echo&amp;param=Is
there an echo? (remember to replace the '&' with an
ampersand)

To view the WSDL for the EchoUMO service go to -
http://localhost:8081/services/EchoUMO?wsdl
</description>

<!--
The system stream connector is used to send and receive information via the
System.in and System.out. Note this connector is only really useful for testing
purposes.
promptMessage - is what is written to the console
messageDelayTime - is the time in milliseconds before the user is prompted again.
These properties are set as bean properties on the connector.
-->
<connector name="SystemStreamConnector"
className="org.mule.providers.stream.SystemStreamConnector">
<properties>
<property name="promptMessage"
value="Please enter something: " />
<property name="messageDelayTime" value="1000" />
</properties>
</connector>

<transformers>
<!-- <transformer name="HttpRequestToSoapRequest" className="org.mule.providers.soap.transformers.HttpRequestToSoapRequest"/> -->
<transformer name="zip"
className="org.mule.transformers.compression.GZipCompressTransformer">
</transformer>
<transformer name="unzip"
className="org.mule.transformers.compression.GZipUncompressTransformer">
</transformer>
</transformers>

<!--
The Mule model initialises and manages your UMO components
-->
<model name="echoSample">
<!--
A Mule descriptor defines all the necessary information about how your components will
interact with the framework, other components in the system and external sources.
Please refer to the Configuration Guide for a full description of all the parameters.
-->
<mule-descriptor name="EchoUMO"
implementation="org.mule.components.simple.EchoComponent">
<!-- any number of endpoints can be added to an inbound router -->
<inbound-router>
<endpoint address="stream://System.in" />
<endpoint address="file://sample_data" transformers="unzip">
<filter
className="org.mule.providers.file.filters.FilenameWildcardFilter"
pattern="*.gz" />
</endpoint>
<!-- <endpoint address="xfire:http://localhost:8081/services" transformers="HttpRequestToSoapRequest" /> -->
</inbound-router>
<!-- An outbound router can have one or more router configurations
that can be invoked depending on business rules, message contents, headers
or ant other criteria.
The OutboundPassthroughRouter is a router that automically sends every
message it receives -->
<outbound-router>
<router
className="org.mule.routing.outbound.OutboundPassThroughRouter">
<endpoint address="stream://System.out" />
</router>
</outbound-router>
</mule-descriptor>
</model>
</mule-configuration>
]]>
</code>


Brian Kalbfus added a comment - 25/Apr/07 10:46 AM
The binary characters clogged up the windows clipboard. Here is the rest the stacktrace with offending characters left out.

Holger Hoffstaette added a comment - 29/Apr/07 09:43 AM
Please run with org.mule.* set to DEBUG so that we see where and why Object is set as return type. There is something else going on but that is missing from the stack trace. Please also try to put a breakpoint on setReturnClass.

Dirk Olmes added a comment - 12/Jun/07 06:21 AM
Brian, please provide the debugging output Holger requests. I'm afraid without your input we won't be able to help you.

Dirk Olmes added a comment - 04/Jul/07 04:46 AM
No feedback for a long time - closing.

Adriaan Wisse added a comment - 13/Dec/07 09:02 AM
I've got the same problem at this moment.

In the mule-configuration.dtd I found the following:

<!--
The returnClass attribute represents the full qualified class name
of the expected return Object of the Transformer implementation. if none is
specified java.lang.Object is used by default. However, by suppling a returnClass
the transformer can validate that the returnObject is of expected type before return
to the callee.
-->
<!ATTLIST transformer returnClass CDATA "java.lang.Object">

This makes clear why not the byte[] (as specified in the transformers constructor) is used but the java.lang.Object.


Holger Hoffstaette added a comment - 13/Dec/07 09:56 AM
Wow - you are right, the bug does show up when used in a configuration as the DTD default value is plastered over the transformer. Thanks for finding this.
Right away I am not entirely sure what to do as Object is the default returnClass anyway - maybe just removing the default from the DTD will leave the poor transformer instance alone, but I don't know if there are any side effects to this.
In any case we'll look into it.

Holger Hoffstaette added a comment - 13/Dec/07 09:57 AM
Changing from task to bug since that's what it is.

Holger Hoffstaette added a comment - 13/Dec/07 10:04 AM
moving updates to new issue