camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mills, Gary (GE Digital)" <gary.L.mi...@ge.com>
Subject RE: zipfile question - thank you
Date Tue, 01 Nov 2016 18:40:45 GMT
DefaultErrorHandler              | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133
| Failed delivery for (MessageId: ID-alphprdfuse2i-43262-1478008924653-2-36907 on ExchangeId:
ID-alphprdfuse2i-43262-1478008924653-2-36908). Exhausted after delivery attempt: 1 caught:
org.apache.camel.InvalidPayloadException: No body available of type: java.lang.String but
has value: org.apache.camel.dataformat.zipfile.ZipInputStreamWrapper@bcbe474 of type: org.apache.camel.dataformat.zipfile.ZipInputStreamWrapper
on: Message: [Body is instance of java.io.InputStream]. Caused by: Error during type conversion
from type: java.lang.String to the required type: java.lang.String with value [Body is instance
of java.io.InputStream] due java.util.zip.ZipException: invalid code lengths set. Exchange[Message:
[Body is instance of java.io.InputStream]]. Caused by: [org.apache.camel.TypeConversionException
- Error during type conversion from type: java.lang.String to the required type: java.lang.String
with value [Body is instance of java.io.InputStream] due java.util.zip.ZipException: invalid
code lengths set]

I am very confused.  If I take that zip file and simply drop it in the fileEntranceEndpoint
everything works fine. If I send it through email it doesn't work. The only thing I've noticed
is that the zip file appears to be corrupted after extracting the attachment and the above
is what error is thrown.

Thank you

From: Mills, Gary (GE Digital)
Sent: Tuesday, November 01, 2016 11:52 AM
To: Mills, Gary (GE Digital) <gary.L.mills@ge.com>
Subject: RE: zipfile question - thank you

Update:

When I send an email to the endpoint email address, with an zip file attachment, and I open
the zip file attachment directly from email endpoint mailbox, the zip file attachment opens
ok.  It appears to be related to the extraction of the attachment in Camel ?

?????



From: Mills, Gary (GE Digital)
Sent: Tuesday, November 01, 2016 10:34 AM
To: 'users-info@camel.apache.org' <users-info@camel.apache.org<mailto:users-info@camel.apache.org>>
Subject: RE: zipfile question - thank you

Here is the code used to unmarshall the zip file

       public void configure() throws Exception {

              ZipFileDataFormat zipFile = new ZipFileDataFormat();
              zipFile.setUsingIterator(true);

              from(fileEntranceEndpoint).id("cfi.zipfile.endpointListenerRoute").log("Message
received zip file: ${file:name}")
              .unmarshal(zipFile).split(body(Iterator.class)).streaming().convertBodyTo(String.class)
              .log("file names from ZipFile: ${file:name}").to("file://" + outDirectory);
       }



From: Mills, Gary (GE Digital)
Sent: Tuesday, November 01, 2016 10:58 AM
To: 'dev@camel.apache.org' <dev@camel.apache.org<mailto:dev@camel.apache.org>>
Subject: zipfile question - thank you

Camel users, ( thank you )
My project is to receive a zip compressed and encrypted file attachment from a customer, naturally,
decompress and decrypt the attachment via email transfer.

I am only focusing on the zip portion now because over email I can't get it to work.  Seems
that the compression size changes when sent over email.

It seems my logic works, if I take the zip file and simply drop it in the route from my Jboss
environment it works. I can zip, unzip, the file from command line and the camel route. However,
if I send the file as an attachment over email, the file size changes, and of course it does
not work and throws the error...
org.apache.camel.RuntimeCamelException: java.util.zip.ZipException: invalid code lengths set

which suggests the zip file attachment has been altered during its transfer over email. The
original file size is 9044 Bytes, after email xfr becomes, 15580 Bytes.  If I try opening
it from the OS with unzip, gunzip, it shows:

[root@alphprdfuse2i latest]# unzip ge-ip/core/tobeprocessed/archive/cfindustries.zip.ge
Archive:  ge-ip/core/tobeprocessed/archive/cfindustries.zip.ge
caution:  zipfile comment truncated
error [ge-ip/core/tobeprocessed/archive/cfindustries.zip.ge]:  missing 3282862893 bytes in
zipfile
  (attempting to process anyway)
error [ge-ip/core/tobeprocessed/archive/cfindustries.zip.ge]:  attempt to seek before beginning
of zipfile
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

I've tried changing the file extension to JPEG, PNG, ge, etc... with no success.

Does anyone know what I can do to get around this???

Thank you !!

Gary Mills


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message