ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47373] Zip.java patch to support setting last modified date
Date Fri, 19 Jun 2009 17:48:49 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47373





--- Comment #11 from Mark Farnsworth <farnsworth2008@gmail.com>  2009-06-19 10:48:44
PST ---
I will look at TAR and add the changes to my patch if we are going forward with
this.  I will also make sure that the code changes are covered by unit tests
and that the docs are appropriately updated.

I am also open to ideas on syntax.

I was thinking of calling the attribute "lastmodified" and allowing the user to
set it with any value that can be parsed via the standard java date format
instance.  If the property is set it would control the output.  Ommiting the
property, setting to empty string, or using "auto" would produce the current
behavior. 

<zip 
lastmodified="2009-06-19 01:36 PM"
destfile="out.zip"
basedir="input"
/>

The following is pseudo code for the prop include the options for supporting
"auto".  I have not done ANT coding in the past so bear with me a bit.  I will
format and document all the code in the next patch update as per the exiting
ANT standards page on the wiki.

public void setLastModified(final String dateString) {
  lastModifedSet = false;
  if(dateString.equals("")) return;
  if(dateString.equals("default")) return;
  try {
    lastModifed = DateFormat.getInstance().parse(dateString).getTime();
    lastModifedSet = true;
  } catch (final ParseException e) {
    throw new RuntimeException(e);
  }
}


We could change the terms if someone has a better idea then the using
"lastmodified".  I notice that ANT often uses shorter names (i.e. destfile). 
We could use "modified" or we could use "contentdate".   

The parsing of the date string respects the local where ANT is running.  I
think that is a good thing but others might want it to force support for a
given style of dates.  I am neutral on the issue.

Taking the patch from where it is to completion will be a little bit of work. 
I am happy to do the grunt if someone assures me that they will review the
feature and that it has at least a reasonable chance of making the cut for the
next release.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message