-
Notifications
You must be signed in to change notification settings - Fork 49
Add fixedEntryModificationTime attribute to AbstractZipArchiver #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
zipEntry.setTime( lastModified + ( isJava7OrLower ? 1999 : 0 ) ); | ||
|
||
if (fixedEntryModificationTime != null) { | ||
zipEntry.setTime(Math.max(MIN_MS_DOS_TIME, fixedEntryModificationTime)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lower values like 0L produce weird Dates when reading (seen something like 8. Nov 1979, which normally cannot be expressed by MS-DOS time). Not sure if we should do the round-up here.
…erride zipEntry times globally. closes codehaus-plexus#48
return fixedEntryModificationTime; | ||
} | ||
|
||
public void setFixedEntryModificationTime(Long fixedEntryModificationTime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really think this should be some kind of Date object, not a long. I am also contemplating if this setter should be on AbstractArchiver, others could just throw UnsupportedOepratiionException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually wouldn't it be even better if it works the same way as forced file/dir modes? I mean they are logically related - forced file/dir modes are options to override the file permissions. This is option to override the last modified date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summarizing:
- a method
setModificationTime(Date modificationTime)
(+getter) onArchiver
- a field
private Date forcedModificationTime = null
onAbstractArchiver
- The field is only used by TarArchiver, AbstractZipArchiver and DirArchiver. Other implementations would just ignore it (like with filemode)
- Question then: do we also need overloaded methods for addFile/addResource to allow overriding the modificationTime on an entry basis (and having a
modificationTime
field inArchiveEntry
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me like ArchiveEntry needs modifcationTime with that is overridden much the same way as the "mode" field. As for per-entry modifiers I suggest you only add the ones you need for the patch. So please do like @plamentotev suggests
Pre-Java 7 is gone, please re-evaluate this issue. |
@michael-o I can spontaniously not see why this issue should be pre-java 7 related. Can you help me out? :) |
zipEntry.setTime( lastModified + ( isJava7OrLower ? 1999 : 0 ) ); Now Java 7 is the minimum require version so |
@danielwegener For instance stuff like |
@danielwegener @michael-o you're right. My bad, I didn't paid enough
attention, sorry about that. `isJava7OrLower` is still used of course.
…On May 26, 2017 11:24, "Michael Osipov" ***@***.***> wrote:
@danielwegener <https://github.com/danielwegener> For instance stuff like
isJava7OrLower.
@plamentotev <https://github.com/plamentotev> On the second thought, this
is less or equal than. This still might be necessary with Java 7+, isn't it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#49 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMLobe7dyb6iBU4x0H7gB2Q2lypjM->fkks5r9oxGgaJpZM4JDFC1>
.
|
I confused it with 'isAtLeastJava7'.
…On May 26, 2017 11:45, "Plamen Totev" ***@***.***> wrote:
@danielwegener @michaelo you're right. My bad, I didn't paid enough
attention, sorry about that. 'isJava7OrLower' is still used of course.
On May 26, 2017 11:24, "Michael Osipov" ***@***.***> wrote:
@danielwegener <https://github.com/danielwegener> For instance stuff like
isJava7OrLower.
@plamentotev <https://github.com/plamentotev> On the second thought, this
is less or equal than. This still might be necessary with Java 7+, isn't it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#49 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMLobe7dyb6iBU4x0H7gB2Q2lypjM-fkks5r9oxGgaJpZM4JDFC1>
.
|
job done in #118 |
... to override zipEntry times globally. closes #48