if (rmr.getDescriptor().isDefault() && rmr.getResolver() != this && isResolved(data, resolvedMrid)) {
if (rmr.getDescriptor().isDefault() && rmr.getResolver() != this) {
    public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException {        DependencyDescriptor systemDd = dd;        dd = fromSystem(dd);                clearIvyAttempts();        boolean downloaded = false;        boolean searched = false;        Date cachedPublicationDate = null;        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;        }    	        boolean isChangingRevision = getChangingMatcher().matches(mrid.getRevision());                boolean isChangingDependency = isChangingRevision || dd.isChanging();        // if we do not have to check modified and if the revision is exact and not changing,          // we first search for it in cache        if (mrid.isExactRevision() && !isCheckmodified() && !isChangingDependency) {            ResolvedModuleRevision rmr = findModuleInCache(data, mrid);            if (rmr != null) {                if (rmr.getDescriptor().isDefault() && rmr.getResolver() != this && isResolved(data, mrid)) {                    Message.verbose("\t"+getName()+": found revision in cache: "+mrid+" (resolved by "+rmr.getResolver().getName()+"): but it's a default one, maybe we can find a better one");                } else {                    Message.verbose("\t"+getName()+": revision in cache: "+mrid);                    return toSystem(rmr);                }            }        }        URL cachedIvyURL = null;        ResolvedResource ivyRef = findIvyFileRef(dd, data);        searched = true;                // get module descriptor        ModuleDescriptorParser parser;        ModuleDescriptor md;        ModuleDescriptor systemMd = null;        if (ivyRef == null) {            parser = XmlModuleDescriptorParser.getInstance();            md = DefaultModuleDescriptor.newDefaultInstance(mrid, dd.getAllDependencyArtifactsIncludes());            ResolvedResource artifactRef = findFirstArtifactRef(md, dd, data);            if (artifactRef == null) {                Message.verbose("\t"+getName()+": no ivy file nor artifact found for "+mrid);                logIvyNotFound(mrid);                String[] conf = md.getConfigurationsNames();                for (int i = 0; i < conf.length; i++) {                    Artifact[] artifacts = md.getArtifacts(conf[i]);                    for (int j = 0; j < artifacts.length; j++) {                        logArtifactNotFound(artifacts[j]);                    }                }                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(), artifactRef.getRevision()));    	        }            }        } else {            parser = ModuleDescriptorParserRegistry.getInstance().getParser(ivyRef.getResource());            if (parser == null) {                Message.warn("no module descriptor parser available for "+ivyRef.getResource());                return null;            }            Message.verbose("\t"+getName()+": found md file for "+mrid);            Message.verbose("\t\t=> "+ivyRef);            Message.debug("\tparser = "+parser);            ModuleRevisionId resolvedMrid = mrid;            // first check if this dependency has not yet been resolved            if (!mrid.isExactRevision() && ModuleRevisionId.isExactRevision(ivyRef.getRevision())) {                resolvedMrid = new ModuleRevisionId(mrid.getModuleId(), ivyRef.getRevision());                IvyNode node = getSystemNode(data, resolvedMrid);                if (node != null && node.getModuleRevision() != null) {                    // this revision has already be resolved : return it                    if (node.getDescriptor() != null && node.getDescriptor().isDefault()) {                        Message.verbose("\t"+getName()+": found already resolved revision: "+resolvedMrid+": but it's a default one, maybe we can find a better one");                    } else {                        Message.verbose("\t"+getName()+": revision already resolved: "+resolvedMrid);                        return toSystem(searchedRmr(node.getModuleRevision()));                    }                }            }                        // now let's see if we can find it in cache and if it is up to date            ResolvedModuleRevision rmr = findModuleInCache(data, resolvedMrid);            if (rmr != null) {                if (rmr.getDescriptor().isDefault() && rmr.getResolver() != this && isResolved(data, resolvedMrid)) {                    Message.verbose("\t"+getName()+": found revision in cache: "+mrid+" (resolved by "+rmr.getResolver().getName()+"): but it's a default one, maybe we can find a better one");                } else {                    if (!isCheckmodified() && !isChangingDependency) {                        Message.verbose("\t"+getName()+": revision in cache: "+mrid);                        return toSystem(searchedRmr(rmr));                    }                    long repLastModified = ivyRef.getLastModified();                    long cacheLastModified = rmr.getDescriptor().getLastModified();                     if (!rmr.getDescriptor().isDefault() && repLastModified <= cacheLastModified) {                        Message.verbose("\t"+getName()+": revision in cache (not updated): "+resolvedMrid);                        return toSystem(searchedRmr(rmr));                    } else {                        Message.verbose("\t"+getName()+": revision in cache is not up to date: "+resolvedMrid);                        if (isChangingDependency) {                            // ivy file has been updated, we should see if it has a new publication date                            // to see if a new download is required (in case the dependency is a changing one)                            cachedPublicationDate = rmr.getDescriptor().getResolvedPublicationDate();                        }                    }                }            }                        // now download ivy file and parse it            try {                // first check if source file is not cache file itself                if (ResourceHelper.equals(ivyRef.getResource(),                         data.getIvy().getIvyFileInCache(data.getCache(), toSystem(resolvedMrid)))) {                    Message.error("invalid configuration for resolver '"+getName()+"': pointing ivy files to ivy cache is forbidden !");                    return null;                }                                // temp file is used to prevent downloading twice                File ivyTempFile = File.createTempFile("ivy", "xml");                 ivyTempFile.deleteOnExit();                Message.debug("\t"+getName()+": downloading "+ivyRef.getResource());                get(ivyRef.getResource(), ivyTempFile);                downloaded = true;                try {                    cachedIvyURL = ivyTempFile.toURL();                } catch (MalformedURLException ex) {                    Message.warn("malformed url exception for temp file: "+ivyTempFile+": "+ex.getMessage());                    return null;                }            } catch (IOException ex) {                Message.warn("problem while downloading ivy file: "+ivyRef.getResource()+": "+ex.getMessage());                return null;            }            try {                md = parser.parseDescriptor(data.getIvy(), cachedIvyURL, ivyRef.getResource(), doValidate(data));                Message.debug("\t"+getName()+": parsed downloaded md file for "+mrid+" parsed="+md.getModuleRevisionId());                                // check descriptor data is in sync with resource revision and names                systemMd = toSystem(md);                if (_checkconsistency) {                    checkDescriptorConsistency(mrid, md, ivyRef);                    checkDescriptorConsistency(systemDd.getDependencyRevisionId(), systemMd, ivyRef);                } else {                    if (md instanceof DefaultModuleDescriptor) {                        ((DefaultModuleDescriptor)md).setModuleRevisionId(ModuleRevisionId.newInstance(mrid.getOrganisation(), mrid.getName(), ivyRef.getRevision()));                    } else {                        Message.warn("consistency disabled with non default module descriptor... module info can't be updated, so consistency check will be done");                        checkDescriptorConsistency(mrid, md, ivyRef);                        checkDescriptorConsistency(systemDd.getDependencyRevisionId(), systemMd, ivyRef);                    }                }                                // check if we should delete old artifacts                boolean deleteOldArtifacts = false;                if (cachedPublicationDate != null && !cachedPublicationDate.equals(md.getResolvedPublicationDate())) {                    // artifacts have changed, they should be downloaded again                    Message.verbose(dd+" has changed: deleting old artifacts");                    deleteOldArtifacts = true;                }                if (deleteOldArtifacts) {                    String[] confs = rmr.getDescriptor().getConfigurationsNames();                    for (int i = 0; i < confs.length; i++) {                        Artifact[] arts = rmr.getDescriptor().getArtifacts(confs[i]);                        for (int j = 0; j < arts.length; j++) {                            File artFile = data.getIvy().getArchiveFileInCache(data.getCache(), toSystem(arts[j]));                            if (artFile.exists()) {                                Message.debug("deleting "+artFile);                                artFile.delete();                            }                            File originFile = data.getIvy().getOriginFileInCache(data.getCache(), toSystem(arts[j]));                            if (originFile.exists()) {                                Message.debug("deleting " + originFile);                                originFile.delete();                            }                        }                    }                } else if (isChangingDependency){                    Message.verbose(dd+" is changing, but has not changed: will trust cached artifacts if any");                }             } catch (IOException ex) {                Message.warn("io problem while parsing ivy file: "+ivyRef.getResource()+": "+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;        }                if (systemMd == null) {            systemMd = toSystem(md);        }                // resolve revision        ModuleRevisionId resolvedMrid = mrid;        if (!resolvedMrid.isExactRevision()) {            resolvedMrid = md.getResolvedModuleRevisionId();            if (resolvedMrid.getRevision() == null || resolvedMrid.getRevision().length() == 0) {                if (ivyRef.getRevision() == null || ivyRef.getRevision().length() == 0 || !ModuleRevisionId.isExactRevision(ivyRef.getRevision())) {                    resolvedMrid = new ModuleRevisionId(resolvedMrid.getModuleId(), (_envDependent?"##":"")+DATE_FORMAT.format(data.getDate())+"@"+_workspaceName);                } else {                    resolvedMrid = new ModuleRevisionId(resolvedMrid.getModuleId(), ivyRef.getRevision());                }            }            Message.verbose("\t\t["+resolvedMrid.getRevision()+"] "+mrid.getModuleId());        }        md.setResolvedModuleRevisionId(resolvedMrid);        systemMd.setResolvedModuleRevisionId(toSystem(resolvedMrid)); // keep system md in sync with md                // resolve and check publication date        if (data.getDate() != null) {            long pubDate = getPublicationDate(md, dd, data);            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));            systemMd.setResolvedPublicationDate(new Date(pubDate)); // keep system md in sync with md        }            try {            File ivyFile = data.getIvy().getIvyFileInCache(data.getCache(), systemMd.getResolvedModuleRevisionId());	        if (ivyRef == null) {                // a basic ivy file is written containing default data	            XmlModuleDescriptorWriter.write(systemMd, ivyFile);	        } else {                if (md instanceof DefaultModuleDescriptor) {                    DefaultModuleDescriptor dmd = (DefaultModuleDescriptor)md;                    if (data.getIvy().logNotConvertedExclusionRule() && dmd.isNamespaceUseful()) {                        Message.warn("the module descriptor "+ivyRef.getResource()+" has information which can't be converted into the system namespace. It will require the availability of the namespace '"+getNamespace().getName()+"' to be fully usable.");                    }                }                // copy and update ivy file from source to cache                parser.toIvyFile(cachedIvyURL, ivyRef.getResource(), ivyFile, systemMd);                long repLastModified = ivyRef.getLastModified();                if (repLastModified > 0) {                    ivyFile.setLastModified(repLastModified);                }	        }        } catch (Exception e) {            Message.warn("impossible to copy ivy file to cache : "+ivyRef.getResource());        }                data.getIvy().saveResolver(data.getCache(), systemMd, getName());        return new DefaultModuleRevision(this, systemMd, searched, downloaded);    }