You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by zhurlik <zh...@gmail.com> on 2017/02/05 21:03:52 UTC

camel-zipfile

Hi,
I am dealing with *.odt/*.ott file as a zip file using *camel-zipfile*
component and faced with an issue.
I am looking at  ZipFileDataFormat.java
<https://github.com/apache/camel/blob/master/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java>  
that uses  ZipIterator.java
<https://github.com/apache/camel/blob/master/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java>  
but in the line 130
<https://github.com/apache/camel/blob/master/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipIterator.java#L130>  
I see that ZipIterator skips empty directories in the zip file (in my case
*.odt/*.ott).

Is it possible to have an ability to handle this case via options in either
ZipFileDataFormat or ZipIterator to be able to say when I want to go through
all entities in the zip file, I mean files and folders.

_____________________
Thanks,
 Vlad



--
View this message in context: http://camel.465427.n5.nabble.com/camel-zipfile-tp5793495.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: camel-zipfile

Posted by onders <on...@gmail.com>.
i think i missed that. i'll try to look and will do another PR. 



--
View this message in context: http://camel.465427.n5.nabble.com/camel-zipfile-tp5793495p5795492.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: camel-zipfile

Posted by onders <on...@gmail.com>.
Hi,

As per my observations, unless zipdataformat does not get the filename of
such empty directory from the file consumer. that's there is no need any
such change in ZipAggregationStrategy. 

However, with a bit of hacking on file consumer in camel-core as well and i
could have passed empty folder'sfilename to zipdataformat and zip dataformat
could process the iterator and created the empty folder on output with file
producer endpoint.(for example in my initial PR, i had a change in
camel-core GenericFileProducer which Claus did not accept. (it was
reasonable.)

To sum, no code change required. please try running
AggregationStrategyWithPreservationTest which passes already. 

However, i understand what you are trying to do with the zipfile component
in case of empty directories. there may be option in component only if file
consuming and producing endpoints support handling empty directories. right
now, as far as i can see file component does not support it.

So it is another issue. I will give a try to create test case for it and
raise an issue. Let's see how we will move forward.

Cheers.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-zipfile-tp5793495p5795494.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: camel-zipfile

Posted by zhurlik <zh...@gmail.com>.
Hi,

Looks like you have fixed https://issues.apache.org/jira/browse/CAMEL-10791
What about second part of issue related with ZipAggregationStrategy.

Thanks a lot




--
View this message in context: http://camel.465427.n5.nabble.com/camel-zipfile-tp5793495p5795488.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: camel-zipfile

Posted by zhurlik <zh...@gmail.com>.
Hi,

Thanks, I have raised https://issues.apache.org/jira/browse/CAMEL-10791



--
View this message in context: http://camel.465427.n5.nabble.com/camel-zipfile-tp5793495p5793504.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: camel-zipfile

Posted by zhurlik <zh...@gmail.com>.
Hi,

Sure, let me try to explain the issue.
So I am working on LibreOffice files: *.odt/*.ott, they are zip archives
that contain xml files and empty folder (I don't know the reason of having
empty folders, but in any case I think that a potential zip file can have a
structure with empty folders). 
Here is a sample of structure from simple odt file:  
where you can see that Configurations2/* consists of empty folder.

My idea is to make changes with xml files and save the same structure after
updating a *.odt file. I am using camel-xslt and camel-zipfile components. I
ran to the problem that camel-zipfile doesn't work with empty folder within
zip file.

ZipIterator can not read empty folders and ZipAggregator can not put them
back into zip file.
I am attaching a simple odt file  hello.odt
<http://camel.465427.n5.nabble.com/file/n5793812/hello.odt>  
If you want I can try to create a pull request with changes in java code and
unit tests. I just need to figure out a little bit how to make a clone of
camel-zipfile and try to build it locally. Or else I can try to create a
patch with diffs.

Thanks,
Vlad



--
View this message in context: http://camel.465427.n5.nabble.com/camel-zipfile-tp5793495p5793812.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: camel-zipfile

Posted by Willem Jiang <wi...@gmail.com>.
Hi zhurlik,

It could save us some time to help you if you can upload a simple test case
to show the issue.
I also want to know about why you need to deal with the empty file
directory in the Zip file.   It could help us to polish the options (maybe
we need to support empty directory by default.)


Willem Jiang

Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com  (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem

On Sun, Feb 12, 2017 at 5:09 AM, zhurlik <zh...@gmail.com> wrote:

> Hi,
> Looks like the same issue with  ZipAggregationStrategy
> <https://github.com/apache/camel/blob/master/components/
> camel-zipfile/src/main/java/org/apache/camel/processor/aggregate/zipfile/
> ZipAggregationStrategy.java>
> there is no way to add empty folder (ZipEnty is a directory entry when name
> ends with a '/').
> At least will be an exception  in this code
> <https://github.com/apache/camel/blob/master/components/
> camel-zipfile/src/main/java/org/apache/camel/processor/aggregate/zipfile/
> ZipAggregationStrategy.java#L187-L193>
> Thanks.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/camel-zipfile-tp5793495p5793793.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>

Re: camel-zipfile

Posted by zhurlik <zh...@gmail.com>.
Hi,
Looks like the same issue with  ZipAggregationStrategy
<https://github.com/apache/camel/blob/master/components/camel-zipfile/src/main/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategy.java>  
there is no way to add empty folder (ZipEnty is a directory entry when name
ends with a '/').
At least will be an exception  in this code
<https://github.com/apache/camel/blob/master/components/camel-zipfile/src/main/java/org/apache/camel/processor/aggregate/zipfile/ZipAggregationStrategy.java#L187-L193>  
Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-zipfile-tp5793495p5793793.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: camel-zipfile

Posted by Willem Jiang <wi...@gmail.com>.
We could add an option in the ZipFileDataFormat to let the iterator support
the empty directory.
Please feel free to log a JIRA[1] for it.

[1]https://issues.apache.org/jira/browse/CAMEL


Willem Jiang

Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com  (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem

On Mon, Feb 6, 2017 at 5:03 AM, zhurlik <zh...@gmail.com> wrote:

> Hi,
> I am dealing with *.odt/*.ott file as a zip file using *camel-zipfile*
> component and faced with an issue.
> I am looking at  ZipFileDataFormat.java
> <https://github.com/apache/camel/blob/master/components/
> camel-zipfile/src/main/java/org/apache/camel/dataformat/
> zipfile/ZipFileDataFormat.java>
> that uses  ZipIterator.java
> <https://github.com/apache/camel/blob/master/components/
> camel-zipfile/src/main/java/org/apache/camel/dataformat/
> zipfile/ZipIterator.java>
> but in the line 130
> <https://github.com/apache/camel/blob/master/components/
> camel-zipfile/src/main/java/org/apache/camel/dataformat/
> zipfile/ZipIterator.java#L130>
> I see that ZipIterator skips empty directories in the zip file (in my case
> *.odt/*.ott).
>
> Is it possible to have an ability to handle this case via options in either
> ZipFileDataFormat or ZipIterator to be able to say when I want to go
> through
> all entities in the zip file, I mean files and folders.
>
> _____________________
> Thanks,
>  Vlad
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/camel-zipfile-tp5793495.html
> Sent from the Camel Development mailing list archive at Nabble.com.