You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "Claudio Miranda (JIRA)" <ji...@apache.org> on 2008/05/30 01:47:46 UTC

[jira] Created: (IVY-823) Set the last modified attribute of files downloaded from repositories

Set the last modified attribute of files downloaded from repositories
---------------------------------------------------------------------

                 Key: IVY-823
                 URL: https://issues.apache.org/jira/browse/IVY-823
             Project: Ivy
          Issue Type: Improvement
          Components: Core
            Reporter: Claudio Miranda
            Priority: Minor
             Fix For: 2.0-RC1


A small modification, to allow the downloaded resource to have the same date timestamp as the file in remote repo. 

    At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File dest, CopyProgressListener l)
    Add

dest.setLastModified(srcConn.getLastModified());

    However this modification is intended to be configurable, see below

Quoting Gilles Scokart from the discussion thread 
http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-td17526130.html

> I think it should better be a parameter of the retrieve task, or maybe
> an attribute of the resolver in the settings file.
> preservelastmodified sounds a good name (like the ant copy task). 
> 
> Note that if you put it in the resolver settings, that should maybe
> also impact the publish and the install task.
> If you put it in both the settings and the task, then the task should
> have the priority. 

Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java
===================================================================
--- src/java/org/apache/ivy/util/url/BasicURLHandler.java       (revision 661197)
+++ src/java/org/apache/ivy/util/url/BasicURLHandler.java       (working copy)
@@ -131,6 +131,10 @@
                         "Downloaded file size doesn't match expected Content Length for " + src
                                 + ". Please retry.");
             }
+            boolean remoteTimestamp = true;
+            if (remoteTimestamp) {
+                dest.setLastModified(srcConn.getLastModified());
+            }
         } finally {
             disconnect(srcConn); 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (IVY-823) Set the last modified attribute of files downloaded from repositories

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

Maarten Coene reassigned IVY-823:
---------------------------------

    Assignee: Maarten Coene

> Set the last modified attribute of files downloaded from repositories
> ---------------------------------------------------------------------
>
>                 Key: IVY-823
>                 URL: https://issues.apache.org/jira/browse/IVY-823
>             Project: Ivy
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Claudio Miranda
>            Assignee: Maarten Coene
>            Priority: Minor
>             Fix For: 2.0-RC1
>
>
> A small modification, to allow the downloaded resource to have the same date timestamp as the file in remote repo. 
>     At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File dest, CopyProgressListener l)
>     Add
> dest.setLastModified(srcConn.getLastModified());
>     However this modification is intended to be configurable, see below
> Quoting Gilles Scokart from the discussion thread 
> http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-td17526130.html
> > I think it should better be a parameter of the retrieve task, or maybe
> > an attribute of the resolver in the settings file.
> > preservelastmodified sounds a good name (like the ant copy task). 
> > 
> > Note that if you put it in the resolver settings, that should maybe
> > also impact the publish and the install task.
> > If you put it in both the settings and the task, then the task should
> > have the priority. 
> Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java
> ===================================================================
> --- src/java/org/apache/ivy/util/url/BasicURLHandler.java       (revision 661197)
> +++ src/java/org/apache/ivy/util/url/BasicURLHandler.java       (working copy)
> @@ -131,6 +131,10 @@
>                          "Downloaded file size doesn't match expected Content Length for " + src
>                                  + ". Please retry.");
>              }
> +            boolean remoteTimestamp = true;
> +            if (remoteTimestamp) {
> +                dest.setLastModified(srcConn.getLastModified());
> +            }
>          } finally {
>              disconnect(srcConn); 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (IVY-823) Set the last modified attribute of files downloaded from repositories

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

Maarten Coene resolved IVY-823.
-------------------------------

    Resolution: Fixed

I've changed the code so that the last modified attribute is set when downloading artifacts from a HTTP repository (also when using Jakarta Commons HttpClient for the download).
This way, the behaviour is the same as for the FileSystemResolver which also preserves the dates from files in the repository.

If there is a need to add extra features to Ant tasks to control the behaviour of this timestamp, additional JIRA issues should be created.

> Set the last modified attribute of files downloaded from repositories
> ---------------------------------------------------------------------
>
>                 Key: IVY-823
>                 URL: https://issues.apache.org/jira/browse/IVY-823
>             Project: Ivy
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Claudio Miranda
>            Assignee: Maarten Coene
>            Priority: Minor
>             Fix For: 2.0-RC1
>
>
> A small modification, to allow the downloaded resource to have the same date timestamp as the file in remote repo. 
>     At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File dest, CopyProgressListener l)
>     Add
> dest.setLastModified(srcConn.getLastModified());
>     However this modification is intended to be configurable, see below
> Quoting Gilles Scokart from the discussion thread 
> http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-td17526130.html
> > I think it should better be a parameter of the retrieve task, or maybe
> > an attribute of the resolver in the settings file.
> > preservelastmodified sounds a good name (like the ant copy task). 
> > 
> > Note that if you put it in the resolver settings, that should maybe
> > also impact the publish and the install task.
> > If you put it in both the settings and the task, then the task should
> > have the priority. 
> Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java
> ===================================================================
> --- src/java/org/apache/ivy/util/url/BasicURLHandler.java       (revision 661197)
> +++ src/java/org/apache/ivy/util/url/BasicURLHandler.java       (working copy)
> @@ -131,6 +131,10 @@
>                          "Downloaded file size doesn't match expected Content Length for " + src
>                                  + ". Please retry.");
>              }
> +            boolean remoteTimestamp = true;
> +            if (remoteTimestamp) {
> +                dest.setLastModified(srcConn.getLastModified());
> +            }
>          } finally {
>              disconnect(srcConn); 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IVY-823) Set the last modified attribute of files downloaded from repositories

Posted by "Claudio Miranda (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602680#action_12602680 ] 

Claudio Miranda commented on IVY-823:
-------------------------------------

I just want to know if this improvement is going to be commited anywhere, because this is critical for us to make ivy usage abroad on every project. And I don't want to provide a separate ivy bundle to our customer with this little improvement.

Thanks for such a great product.

> Set the last modified attribute of files downloaded from repositories
> ---------------------------------------------------------------------
>
>                 Key: IVY-823
>                 URL: https://issues.apache.org/jira/browse/IVY-823
>             Project: Ivy
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Claudio Miranda
>            Priority: Minor
>             Fix For: 2.0-RC1
>
>
> A small modification, to allow the downloaded resource to have the same date timestamp as the file in remote repo. 
>     At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File dest, CopyProgressListener l)
>     Add
> dest.setLastModified(srcConn.getLastModified());
>     However this modification is intended to be configurable, see below
> Quoting Gilles Scokart from the discussion thread 
> http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-td17526130.html
> > I think it should better be a parameter of the retrieve task, or maybe
> > an attribute of the resolver in the settings file.
> > preservelastmodified sounds a good name (like the ant copy task). 
> > 
> > Note that if you put it in the resolver settings, that should maybe
> > also impact the publish and the install task.
> > If you put it in both the settings and the task, then the task should
> > have the priority. 
> Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java
> ===================================================================
> --- src/java/org/apache/ivy/util/url/BasicURLHandler.java       (revision 661197)
> +++ src/java/org/apache/ivy/util/url/BasicURLHandler.java       (working copy)
> @@ -131,6 +131,10 @@
>                          "Downloaded file size doesn't match expected Content Length for " + src
>                                  + ". Please retry.");
>              }
> +            boolean remoteTimestamp = true;
> +            if (remoteTimestamp) {
> +                dest.setLastModified(srcConn.getLastModified());
> +            }
>          } finally {
>              disconnect(srcConn); 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.