problems with download() method when extending BasicResolver
------------------------------------------------------------

                 Key: IVY-615
                 URL: https://issues.apache.org/jira/browse/IVY-615
             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.

Reply via email to