if (!path.equals("")) {
if (path.equals("")) { ret = folder; } else {
    public MailItem getItemByPath(OperationContext octxt, String path, int fid, boolean getFolder) throws ServiceException {        boolean success = true;        MailItem ret = null;        if (path == null)            throw MailServiceException.INVALID_NAME(path);        boolean preferFolder = path.endsWith("/");        try {            beginTransaction("getItemByPath", octxt);            if (path.startsWith("/")) {                path = path.substring(1);                fid = ID_FOLDER_USER_ROOT;            }            Folder folder = getFolderById(fid);            if (!path.equals("")) {                StringTokenizer tok = new StringTokenizer(path, "/");                String lastToken = null;                Folder lastFolder = null;                // tokenize the path, traverse the folders until                // we can't find the subfolder, or run out of tokens.                while (folder != null && tok.hasMoreTokens()) {                    lastToken = tok.nextToken();                    lastFolder = folder;                    folder = lastFolder.findSubfolder(lastToken);                }                boolean matchedAllButLastToken = lastFolder != null && lastToken != null && !tok.hasMoreTokens();                // if the caller prefers a folder, and a folder is found, then                // we are golden.  if the caller does not prefer a folder,                // or if there is no folder by that path, then search the                // last matched folder for a document or wiki item that matches                // the last token in the path.                MailItem wikiItem = null;                if ((!preferFolder || folder == null) && matchedAllButLastToken) {                	try {                		List<Document> wikis = getWikiList(octxt, lastFolder.getId(), (byte)(DbMailItem.SORT_BY_SUBJECT | DbMailItem.SORT_ASCENDING));                		int wikiPos = Document.binarySearch(wikis, lastToken);                		if (wikiPos >= 0)                			wikiItem = wikis.get(wikiPos);                	} catch (ServiceException se) {                		wikiItem = null;                	}                }                // either the caller prefers a document, or folder is not found.                ret = (wikiItem == null) ? folder : wikiItem;            }            if (ret == null)                throw MailServiceException.NO_SUCH_ITEM(path);            success = (checkAccess(ret) != null);            return ret;        } finally {            endTransaction(success);        }    }