You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Claire Salac (JIRA)" <ji...@apache.org> on 2011/06/23 19:47:47 UTC

[jira] [Created] (COMPRESS-135) Original file creation date is not retained when files are added to a zip archive

Original file creation date is not retained when files are added to a zip archive 
----------------------------------------------------------------------------------

                 Key: COMPRESS-135
                 URL: https://issues.apache.org/jira/browse/COMPRESS-135
             Project: Commons Compress
          Issue Type: Bug
          Components: Archivers
    Affects Versions: 1.1
         Environment: Windows XP & Server 2003
            Reporter: Claire Salac


I have a Java program using the Apache zip archives library to zip together files with a common create month. However, when the resulting zip archives are examined the create date of all the files in the archive has been changed to the date the archive was created. It is critical that we retain the create date in these archives as they will be used for troubleshooting at a future date. Is there a way that this can be done currently, or is it something that will need to be addressed in a future build?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (COMPRESS-135) Original file creation date is not retained when files are added to a zip archive

Posted by "Claire Salac (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COMPRESS-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claire Salac closed COMPRESS-135.
---------------------------------

    Resolution: Not A Problem

> Original file creation date is not retained when files are added to a zip archive 
> ----------------------------------------------------------------------------------
>
>                 Key: COMPRESS-135
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-135
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.1
>         Environment: Windows XP & Server 2003
>            Reporter: Claire Salac
>
> I have a Java program using the Apache zip archives library to zip together files with a common create month. However, when the resulting zip archives are examined the create date of all the files in the archive has been changed to the date the archive was created. It is critical that we retain the create date in these archives as they will be used for troubleshooting at a future date. Is there a way that this can be done currently, or is it something that will need to be addressed in a future build?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COMPRESS-135) Original file creation date is not retained when files are added to a zip archive

Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COMPRESS-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054431#comment-13054431 ] 

Stefan Bodewig commented on COMPRESS-135:
-----------------------------------------

I don't see any call to zippy.setTime() so you can't expect it to be the one of your original file - that would only be the case if you used new ZipArchiveEntry(InnerContents[i]) if InnerContents[i] is a File instance.

The way the code is written each entry will get the time the entry instance has been created as its time.  Given that ZIPs store time with two seconds granularity you will only see different time results if it takes more than two seconds to create the archive.

> Original file creation date is not retained when files are added to a zip archive 
> ----------------------------------------------------------------------------------
>
>                 Key: COMPRESS-135
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-135
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.1
>         Environment: Windows XP & Server 2003
>            Reporter: Claire Salac
>
> I have a Java program using the Apache zip archives library to zip together files with a common create month. However, when the resulting zip archives are examined the create date of all the files in the archive has been changed to the date the archive was created. It is critical that we retain the create date in these archives as they will be used for troubleshooting at a future date. Is there a way that this can be done currently, or is it something that will need to be addressed in a future build?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COMPRESS-135) Original file creation date is not retained when files are added to a zip archive

Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COMPRESS-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054369#comment-13054369 ] 

Stefan Bodewig commented on COMPRESS-135:
-----------------------------------------

You don't say how you are zipping your entries.

If you use the ZipArchiveEntry constructor accepting a file argument it should read the last modification time from the file instance.  If you use any of the other ZipArchiveEntry constructors you are responsible of setting the time yourself - see java.util.zip.ZipEntry#setTime.


> Original file creation date is not retained when files are added to a zip archive 
> ----------------------------------------------------------------------------------
>
>                 Key: COMPRESS-135
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-135
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.1
>         Environment: Windows XP & Server 2003
>            Reporter: Claire Salac
>
> I have a Java program using the Apache zip archives library to zip together files with a common create month. However, when the resulting zip archives are examined the create date of all the files in the archive has been changed to the date the archive was created. It is critical that we retain the create date in these archives as they will be used for troubleshooting at a future date. Is there a way that this can be done currently, or is it something that will need to be addressed in a future build?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COMPRESS-135) Original file creation date is not retained when files are added to a zip archive

Posted by "Claire Salac (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COMPRESS-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054386#comment-13054386 ] 

Claire Salac commented on COMPRESS-135:
---------------------------------------

I use the following:

...
dest = new FileOutputStream(zipFilePath);
zip = new ZipArchiveOutputStream(dest);
origin = new BufferedInputStream(new FileInputStream(InnerContents[i]));
ZipArchiveEntry zippy = new ZipArchiveEntry(InnerContents[i].getName());

zip.createArchiveEntry(InnerContents[i], InnerContents[i].getName());
zip.setEncoding(null);
zip.setUseLanguageEncodingFlag(false);
zip.putArchiveEntry(zippy);
while((count = origin.read(data)) != -1)
{
     zip.write(data, 0, count);
}
zip.closeArchiveEntry();
origin.close();
...

If what you say is the case then I should still be seeing different dates in the zip archive. Instead, I see all files have one uniform date: the date the archive was created.



> Original file creation date is not retained when files are added to a zip archive 
> ----------------------------------------------------------------------------------
>
>                 Key: COMPRESS-135
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-135
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.1
>         Environment: Windows XP & Server 2003
>            Reporter: Claire Salac
>
> I have a Java program using the Apache zip archives library to zip together files with a common create month. However, when the resulting zip archives are examined the create date of all the files in the archive has been changed to the date the archive was created. It is critical that we retain the create date in these archives as they will be used for troubleshooting at a future date. Is there a way that this can be done currently, or is it something that will need to be addressed in a future build?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COMPRESS-135) Original file creation date is not retained when files are added to a zip archive

Posted by "Claire Salac (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COMPRESS-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054439#comment-13054439 ] 

Claire Salac commented on COMPRESS-135:
---------------------------------------

Stefan,

InnerContents is an array of Files (File [] InnerContents;). Are you saying I could use zippy.setTime() to manually set the date stored in the archive for each file? I think I can make that work. Thank you so much!

> Original file creation date is not retained when files are added to a zip archive 
> ----------------------------------------------------------------------------------
>
>                 Key: COMPRESS-135
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-135
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.1
>         Environment: Windows XP & Server 2003
>            Reporter: Claire Salac
>
> I have a Java program using the Apache zip archives library to zip together files with a common create month. However, when the resulting zip archives are examined the create date of all the files in the archive has been changed to the date the archive was created. It is critical that we retain the create date in these archives as they will be used for troubleshooting at a future date. Is there a way that this can be done currently, or is it something that will need to be addressed in a future build?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira