/** * Incompatible resources are doublets with different content. * * @return doublet resources with different content */ @Override public String[] getIncompatibleResources() { List<String> incompatibleResources = new ArrayList<>(); for (String rsc : this.getDoublets()) { Enumeration<URL> doubletURLs = this.getResourcesFor(rsc); try { URL url = doubletURLs.nextElement(); ArchivEntry archivEntry = new ArchivEntry(url); while (doubletURLs.hasMoreElements()) { url = doubletURLs.nextElement(); ArchivEntry doubletEntry = new ArchivEntry(url); if (archivEntry.equals(doubletEntry)) { incompatibleResources.add(rsc); break; } } } catch (NoSuchElementException nse) { LOG.warn("{} is not added to incompatible resource list:", rsc, nse); } } return incompatibleResources.toArray(new String[incompatibleResources.size()]); }
/** * Looks for each doublet if it has a different doublets. For the * performance reason it looks in the incompatibleClassList from the last * time if it is already found. This is done because normally the number of * incompatible classed does not decrease. * * @return a sorted list of incompatible classes */ @ProfileMe public synchronized List<Class<?>> getIncompatibleClassList() { List<Class<?>> doublets = this.getDoubletList(); for (Class<?> clazz : doublets) { if (incompatibleClassList.contains(clazz)) { continue; } String resource = Converter.classToResource(clazz.getName()); Enumeration<URL> resources = getResources(resource); URL url = (URL) resources.nextElement(); ArchivEntry archivEntry = new ArchivEntry(url); while (resources.hasMoreElements()) { url = (URL) resources.nextElement(); ArchivEntry doubletEntry = new ArchivEntry(url); if (archivEntry.equals(doubletEntry)) { incompatibleClassList.add(clazz); break; } } } return incompatibleClassList; }
try { URL url = resources.nextElement(); ArchivEntry archivEntry = new ArchivEntry(url); while (resources.hasMoreElements()) { url = resources.nextElement(); ArchivEntry doubletEntry = new ArchivEntry(url); if (!archivEntry.equals(doubletEntry)) { incompatibleClassList.add(clazz);