/** * Fulfill the ResourceCollection contract. The Iterator returned * will throw ConcurrentModificationExceptions if ResourceCollections * are added to this container while the Iterator is in use. * @return a "fail-fast" Iterator. */ @Override public final synchronized Iterator<Resource> iterator() { if (isReference()) { return ((Path) getCheckedRef()).iterator(); } dieOnCircularReference(); if (getPreserveBC()) { return new FileResourceIterator(getProject(), null, list()); } return union == null ? Collections.<Resource> emptySet().iterator() : assertFilesystemOnly(union).iterator(); }
private void initTCCL() { try { List<URL> classPathUrls = new ArrayList<URL>(Collections.singletonList(getClassDir().toURI().toURL())); Path classpath = getCommandLine().getClasspath(); @SuppressWarnings("unchecked") Iterator<FileResource> iterator = classpath.iterator(); while (iterator.hasNext()) { FileResource next = iterator.next(); classPathUrls.add(next.getFile().toURI().toURL()); } Thread.currentThread().setContextClassLoader( URLClassLoader.newInstance(classPathUrls.toArray(new URL[] {}), getClass().getClassLoader())); } catch (Exception e) { throw new BuildException(e.getMessage(), e); } }
private void validateArgs() { if (getDestdir() == null) { throw new BuildException("Destination directory 'destdir' is required."); } Path srcDirs = getSrcdir(); if (srcDirs == null) { throw new BuildException("Sources directory 'srcdir' is required."); } Iterator<?> pathIter = srcDirs.iterator(); while (pathIter.hasNext()) { Object next = pathIter.next(); if (!(next instanceof Resource && ((Resource) next).isDirectory())) { throw new BuildException("Source directory must be a directory. Check 'srcdir' entry: " + next); } } }
for (Iterator<Resource> i = compileClasspath.iterator(); i.hasNext();) { FileResource resource = (FileResource)i.next(); classPath.add( resource.getFile().toURI().toURL() );
for (final Iterator<Resource> i = compileClasspath.iterator(); i.hasNext();) { final FileResource resource = (FileResource)i.next(); classPath.add( resource.getFile().toURI().toURL() );
while (fileItr.hasNext()) { String filename = (String) fileItr.next(); Iterator pathItr = sourcepath.iterator(); while (pathItr.hasNext()){ FileResource fileRes = (FileResource) pathItr.next();
private void apply( ClassFileVisitor v ) throws IOException { for ( Path path : paths ) { final String[] files = path.list(); for ( int j = 0; j < files.length; j++ ) { log( "Ignoring the signatures from file to be checked: " + files[j], Project.MSG_INFO ); v.process( new File( files[j] ) ); } } if ( classpath != null ) { Iterator<?> i = classpath.iterator(); while ( i.hasNext() ) { Object next = i.next(); if ( next instanceof FileResource ) { final File file = ( (FileResource) next ).getFile(); log( "Ignoring the signatures from classpath: " + file, Project.MSG_INFO ); v.process( file ); } } } } }
Iterator<?> i = sourcepath.iterator(); while ( i.hasNext() )