if (separatorIndex != -1)
{
// match folder name
String folderName = path.substring(0,separatorIndex);
String folderPath = (folder.getPath().endsWith(Folder.PATH_SEPARATOR) ? folder.getPath() : folder.getPath() + Folder.PATH_SEPARATOR) + folderName;
NodeSet matchedFolders = null;
if (regexp)
{
// get regexp matched folders
matchedFolders = ((FolderImpl)folder).getFolders(false).inclusiveSubset(folderPath);
}
else
{
// get single matched folder
Folder matchedFolder = getFolder(folderPath);
if (matchedFolder != null)
{
matchedFolders = new NodeSetImpl(folder.getPath());
matchedFolders.add(matchedFolder);
}
}
if ((matchedFolders == null) || (matchedFolders.size() == 0))
{
throw new FolderNotFoundException("Cannot find folder" + folderName + " in " + folder.getPath());
}
// match recursively over matched folders
path = path.substring(separatorIndex);
Iterator matchedFoldersIter = matchedFolders.iterator();
while (matchedFoldersIter.hasNext())
{
Folder matchedFolder = (Folder) matchedFoldersIter.next();
getNodes(matchedFolder, path, regexp, matched);
}