throw new XPathException(getASTNode(), "Could not store file " + files[j].getAbsolutePath() +
LOG.warn("Could not store file " + files[j].getAbsolutePath() +
	protected Sequence evalWithCollection(Collection collection, Sequence[] args,			Sequence contextSequence) throws XPathException {		File baseDir = new File(args[1].getStringValue());		LOG.debug("Loading files from directory: " + baseDir);		Sequence patterns = args[2];		String resourceType = "XMLResource";        String mimeType = "text/xml";		if(getSignature().getArgumentCount() == 4) {			mimeType = args[3].getStringValue();			if(!("text/xml".equals(mimeType) || "application/xml".equals(mimeType)))				resourceType = "BinaryResource";		}		 		ValueSequence stored = new ValueSequence();		for(SequenceIterator i = patterns.iterate(); i.hasNext(); ) {			String pattern = i.nextItem().getStringValue();			File[] files = DirectoryScanner.scanDir(baseDir, pattern);			for(int j = 0; j < files.length; j++) {				try {					Resource resource =						collection.createResource(files[j].getName(), resourceType);					resource.setContent(files[j]);                    if("BinaryResource".equals(resourceType))                        ((EXistResource)resource).setMimeType(mimeType);					collection.storeResource(resource);                    //TODO : use dedicated function in XmldbURI					stored.add(new StringValue(collection.getName() + "/" + resource.getId()));				} catch (XMLDBException e) {					throw new XPathException(getASTNode(), "Could not store file " + files[j].getAbsolutePath() + 							": " + e.getMessage(), e);				}			}		}		return stored;	}