incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maarten Coene (JIRA)" <>
Subject [jira] Commented: (IVY-615) problems with download() method when extending BasicResolver
Date Wed, 03 Oct 2007 19:41:51 GMT


Maarten Coene commented on IVY-615:

The getAndCheck method calls the check method. This check method does the following:

    private boolean check(Resource resource, File dest, String algorithm) throws IOException
        Resource csRes = resource.clone(resource.getName() + "." + algorithm);
        if (csRes.exists()) {
        } else {
            return false;

If you say an IOException is thrown because of trying to download a .sha1 artifact, this would
mean that the csRes.exists() in the code above returned true for a resource (the .sha1 resource)
that doesn't exist. 

Can you verify the following:
- Did you create your own SvnResource class?
- Does the exists() method returns false for the .sha1 resource?


> problems with download() method when extending BasicResolver
> ------------------------------------------------------------
>                 Key: IVY-615
>                 URL:
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-alpha-2
>            Reporter: Adrian Woodhead
> When trying to create a SvnResolver I have run into an issue which seems to originate
in BasicResolver. I extend RepositoryResolver which ultimately extends BasicResolver. I implement
various methods in my classes to have dependent files downloaded from subversion over the
svn+ssh protocol  which works OK, however files are downloaded into the local ivy repository
as FILENAME.EXT.part and never renamed to have the .part removed even though they are completely
downloaded. I tracked the issue down to this method in BasicResolver:
> public DownloadReport download(Artifact[] artifacts, DownloadOptions options)
> The code on line 808 is executed:
> adr.setSize(getAndCheck(artifactRef.getResource(), tmp));
> This in turn tries to download a .sha1 file for my resource which fails (there isn't
one) which throws an IOException. This means that the code following where the file is renamed
to have the .part removed is never executed. I don't know enough about the internals of Ivy
to say what the best way to fix this is so I did the following which almost certainly is not
the best solution:
>     try {
>          adr.setSize(getAndCheck(artifactRef.getResource(), tmp));
>     } catch (IOException e) {
>         Message.warn(e.getMessage());
>     }
> I didn't want to change the Ivy code so I moved the entire download method into my class
and then noticed it wouldn't compile due to the object defined at line 104:
>     private URLRepository extartifactrep = new URLRepository(); // used only to download
> I'm not sure why URLRepository is hardcoded here, surely this should use a method like
getRepository() in RepositoryResolver to get the actual repository in use, which in my case
is not a URLRepository but my own SvnRepository. My suggestion would be to move the Repository
member variable and getter and setter from RepositoryResolver up into BasicResolver and change
line 805 in BasicResolver from
>     extartifactrep.get(artifactRef.getResource().getName(), tmp);
> to 
>     getRepository().get(artifactRef.getResource().getName(), tmp);

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

View raw message