if (useOrigin) {
if (useOrigin && artifactRef.getResource().isLocal()) {
    public DownloadReport download(Artifact[] artifacts, Ivy ivy, File cache, boolean useOrigin) {        clearArtifactAttempts();        DownloadReport dr = new DownloadReport();        for (int i = 0; i < artifacts.length; i++) {        	final ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);        	dr.addArtifactReport(adr);            ivy.fireIvyEvent(new NeedArtifactEvent(ivy, this, artifacts[i]));            ArtifactOrigin origin = ivy.getSavedArtifactOrigin(cache, artifacts[i]);            // if we can use origin file, we just ask ivy for the file in cache, and it will return             // the original one if possible. If we are not in useOrigin mode, we use the getArchivePath            // method which always return a path in the actual cache        	File archiveFile = ivy.getArchiveFileInCache(cache, artifacts[i], origin, useOrigin);        			        	if (archiveFile.exists()) {        		Message.verbose("\t[NOT REQUIRED] "+artifacts[i]);        		adr.setDownloadStatus(DownloadStatus.NO);                  adr.setSize(archiveFile.length());                adr.setArtifactOrigin(origin);        	} else {                Artifact artifact = fromSystem(artifacts[i]);                if (!artifact.equals(artifacts[i])) {                    Message.verbose("\t"+getName()+"looking for artifact "+artifact+ " (is "+artifacts[i]+" in system namespace)");                }                long start = System.currentTimeMillis();                try {                	ResolvedResource artifactRef = getArtifactRef(artifact, null);                	if (artifactRef != null) {                		origin = new ArtifactOrigin(artifactRef.getResource().isLocal(), artifactRef.getResource().getName());                		if (useOrigin) {                    		Message.verbose("\t[NOT REQUIRED] "+artifacts[i]);            				ivy.saveArtifactOrigin(cache, artifacts[i], origin);                    		archiveFile = ivy.getArchiveFileInCache(cache, artifacts[i], origin);                    		adr.setDownloadStatus(DownloadStatus.NO);                              adr.setSize(archiveFile.length());                            adr.setArtifactOrigin(origin);                		} else {                			// refresh archive file now that we better now its origin                			archiveFile = ivy.getArchiveFileInCache(cache, artifacts[i], origin, useOrigin);                			if (ResourceHelper.equals(artifactRef.getResource(),                 					archiveFile)) {                				Message.error("invalid configuration for resolver '"+getName()+"': pointing artifacts to ivy cache is forbidden !");                				return null;                			}                			Message.info("downloading "+artifactRef.getResource()+" ...");                			ivy.fireIvyEvent(new StartArtifactDownloadEvent(ivy, this, artifacts[i], origin));                			File tmp = ivy.getArchiveFileInCache(cache,                 					new DefaultArtifact(                							artifacts[i].getModuleRevisionId(),                 							artifacts[i].getPublicationDate(),                 							artifacts[i].getName(),                 							artifacts[i].getType(),                 							artifacts[i].getExt()+".part",                							artifacts[i].getExtraAttributes()),                							origin, useOrigin);                			// deal with artifact with url special case                			if (artifactRef.getResource().getName().equals(String.valueOf(artifacts[i].getUrl()))) {                				Message.verbose("\t"+getName()+": downloading "+artifactRef.getResource().getName());                				Message.debug("\t\tto "+tmp);                				if (tmp.getParentFile() != null) {                					tmp.getParentFile().mkdirs();                				}                				_extartifactrep.get(artifactRef.getResource().getName(), tmp);                				adr.setSize(tmp.length());                			} else {                				adr.setSize(getAndCheck(artifactRef.getResource(), tmp));                			}                			if (!tmp.renameTo(archiveFile)) {                				Message.warn("\t[FAILED     ] "+artifacts[i]+" impossible to move temp file to definitive one ("+(System.currentTimeMillis()-start)+"ms)");                				adr.setDownloadStatus(DownloadStatus.FAILED);                			} else {                				ivy.saveArtifactOrigin(cache, artifacts[i], origin);                				Message.info("\t[SUCCESSFUL ] "+artifacts[i]+" ("+(System.currentTimeMillis()-start)+"ms)");                				adr.setDownloadStatus(DownloadStatus.SUCCESSFUL);                				adr.setArtifactOrigin(origin);                			}                		}                	} else {                		logArtifactNotFound(artifacts[i]);                		adr.setDownloadStatus(DownloadStatus.FAILED);                                	}                } catch (Exception ex) {                	Message.warn("\t[FAILED     ] "+artifacts[i]+" : "+ex.getMessage()+" ("+(System.currentTimeMillis()-start)+"ms)");                	adr.setDownloadStatus(DownloadStatus.FAILED);                }                checkInterrupted();        	}        	ivy.fireIvyEvent(new EndArtifactDownloadEvent(ivy, this, artifacts[i], adr, archiveFile));        }        return dr;    }