return new DefaultModuleRevision(this, md, true, downloaded);
return new DefaultModuleRevision(this, this, md, true, downloaded);
    public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {        _ivyattempts.clear();        boolean downloaded = false;        ModuleRevisionId mrid = dd.getDependencyRevisionId();    	// check revision		int index = mrid.getRevision().indexOf("@");		if (index != -1 && !mrid.getRevision().substring(index+1).equals(_workspaceName)) {            Message.verbose("\t"+getName()+": unhandled revision => "+mrid.getRevision());            return null;		}                if (!mrid.isExactRevision() && !acceptLatest()) {            Message.error("latest revisions not handled by "+getClass().getName()+". impossible to resolve "+mrid);            return null;        }    	        // look for ivy file    	ResolvedURL ivyURL = getIvyURL(mrid, data.getDate());    	URL cachedIvyURL = null;        // get module descriptor        ModuleDescriptor md;        if (ivyURL == null) {            md = DefaultModuleDescriptor.newDefaultInstance(mrid, dd.getAllDependencyArtifactsIncludes());            ResolvedURL artifactURL = findFirstArtifact(md, mrid, data.getDate());            if (artifactURL == null) {                Message.verbose("\t"+getName()+": no ivy file nor artifact found for "+mrid);                logIvyNotFound(mrid);                return null;            } else {                Message.verbose("\t"+getName()+": no ivy file found for "+mrid+": using default data");                            logIvyNotFound(mrid);    	        if (!mrid.isExactRevision()) {    	            md.setResolvedModuleRevisionId(new ModuleRevisionId(mrid.getModuleId(), artifactURL.getRevision()));    	        }            }        } else {            Message.verbose("\t"+getName()+": found ivy file for "+mrid);            Message.verbose("\t\t=> "+ivyURL);            // first check if this dependency has not yet been resolved            if (!mrid.isExactRevision()) {                ModuleRevisionId resolvedMrid = new ModuleRevisionId(mrid.getModuleId(), ivyURL.getRevision());                IvyNode node = data.getNode(resolvedMrid);                if (node != null) {                    // this revision has already be resolved : return it                    Message.verbose("\t"+getName()+": revision already resolved: "+resolvedMrid);                    return node.getModuleRevision();                }                                // now let's see if we can find it in cache                ResolvedModuleRevision rmr = data.getIvy().findModuleInCache(resolvedMrid, data.getCache(), doValidate(data));                if (rmr != null) {                    Message.verbose("\t"+getName()+": revision in cache: "+resolvedMrid);                    return rmr;                }            }                                    // now download ivy file and parse it              cachedIvyURL = ivyURL.getURL(); // default value: the source itself            try {                // temp file is used to prevent downloading twice                File ivyTempFile = File.createTempFile("ivy", "xml");                 ivyTempFile.deleteOnExit();                Message.debug("\t"+getName()+": downloading "+ivyURL.getURL());                FileUtil.copy(ivyURL.getURL(), ivyTempFile, null);                downloaded = true;                try {                    cachedIvyURL = ivyTempFile.toURL();                } catch (MalformedURLException ex) {                    // ignored, will not used temp file                    Message.warn("malformed url exception for temp file: "+ivyTempFile+": "+ex.getMessage());                }            } catch (IOException ex) {                // ignored, will not used temp file                Message.warn("problem while downloading ivy file: "+ivyURL+": "+ex.getMessage());            }            try {                md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(data.getIvy(), cachedIvyURL, new URLResource(ivyURL.getURL()), doValidate(data));                Message.debug("\t"+getName()+": parsed downloaded ivy file for "+mrid+" parsed="+md.getModuleRevisionId());            } catch (IOException ex) {                Message.warn("io problem while parsing ivy file: "+ivyURL+": "+ex.getMessage());                return null;            }        }                // check module descriptor revision        if (mrid.getRevision().startsWith("latest.")) {            String askedStatus = mrid.getRevision().substring("latest.".length());            if (Status.getPriority(askedStatus) < Status.getPriority(md.getStatus())) {                Message.info("\t"+getName()+": unacceptable status => was="+md.getStatus()+" required="+askedStatus);                return null;            }        } else if (!mrid.acceptRevision(md.getModuleRevisionId().getRevision())) {            Message.info("\t"+getName()+": unacceptable revision => was="+md.getModuleRevisionId().getRevision()+" required="+mrid.getRevision());            return null;        }                // resolve revision        ModuleRevisionId resolvedMrid = mrid;        if (!resolvedMrid.isExactRevision()) {            resolvedMrid = md.getResolvedModuleRevisionId();            if (resolvedMrid.getRevision() == null || resolvedMrid.getRevision().length() == 0) {                if (ivyURL.getRevision() == null || ivyURL.getRevision().length() == 0) {                    resolvedMrid = new ModuleRevisionId(resolvedMrid.getModuleId(), (_envDependent?"##":"")+DATE_FORMAT.format(data.getDate())+"@"+_workspaceName);                } else {                    resolvedMrid = new ModuleRevisionId(resolvedMrid.getModuleId(), ivyURL.getRevision());                }            }            Message.verbose("\t\t["+resolvedMrid.getRevision()+"] "+mrid.getModuleId());        }        md.setResolvedModuleRevisionId(resolvedMrid);                // resolve and check publication date        if (data.getDate() != null) {            long pubDate = getPublicationDate(md, resolvedMrid, data.getDate());            if (pubDate > data.getDate().getTime()) {                Message.info("\t"+getName()+": unacceptable publication date => was="+new Date(pubDate)+" required="+data.getDate());                return null;            } else if (pubDate == -1) {                Message.info("\t"+getName()+": impossible to guess publication date: artifact missing for "+mrid);                return null;            }            md.setResolvedPublicationDate(new Date(pubDate));        }            try {	        if (ivyURL == null) {                // a basic ivy file is written containing default data	            XmlModuleDescriptorWriter.write(md, data.getIvy().getIvyFileInCache(data.getCache(), md.getResolvedModuleRevisionId()));	        } else {	            // copy and update ivy file from source to cache                XmlModuleDescriptorUpdater.update(                        cachedIvyURL != null?cachedIvyURL:ivyURL.getURL(),                         data.getIvy().getIvyFileInCache(data.getCache(), md.getResolvedModuleRevisionId()),                         Collections.EMPTY_MAP,                         md.getStatus(),                         md.getResolvedModuleRevisionId().getRevision(),                         md.getResolvedPublicationDate());	        }        } catch (Exception e) {            Message.warn("impossible to copy ivy file to cache : "+ivyURL.getURL());        }                return new DefaultModuleRevision(this, md, true, downloaded);    }