long latestRev = -1; if (isInvalidRevision(startRevision)) { startRevision = latestRev = getLatestRevision(); } if (isInvalidRevision(endRevision)) { endRevision = latestRev != -1 ? latestRev : getLatestRevision(); }
    public long log(String[] targetPaths, long startRevision, long endRevision,            boolean changedPaths, boolean strictNode, long limit,            ISVNLogEntryHandler handler) throws SVNException {        long count = 0;        try {            openConnection();            String[] repositoryPaths = getRepositoryPaths(targetPaths);            if (repositoryPaths == null || repositoryPaths.length == 0) {                repositoryPaths = new String[]{""};            }            Object[] buffer = new Object[] { "log",                    repositoryPaths,                    getRevisionObject(startRevision),                    getRevisionObject(endRevision),                    Boolean.valueOf(changedPaths), Boolean.valueOf(strictNode),                    limit > 0 ? new Long(limit) : null };            write("(w((*s)(n)(n)wwn))", buffer);            authenticate();            while (true) {                try {                    read("((", buffer, false);                    Map changedPathsMap = null;                    if (changedPaths) {                        changedPathsMap = handler != null ? new HashMap() : null;                        while (true) {                            try {                                read("(SW(?S?N))", buffer, false);                                if (changedPathsMap != null) {                                    String path = SVNReader.getString(buffer, 0);                                    if (path != null && !"".equals(path.trim())) {                                        String type = SVNReader.getString(buffer, 1);                                        String copyPath = SVNReader.getString(buffer, 2);                                        long copyRev = SVNReader.getLong(buffer, 3);                                        changedPathsMap.put(path, new SVNLogEntryPath(path, type.charAt(0), copyPath, copyRev));                                    }                                }                            } catch (SVNException e) {                                break;                            }                        }                    }                    read(")N(?S)(?S)(?S))", buffer, false);                    count++;                    if (handler != null && (limit <= 0 || count <= limit)) {                        long revision = SVNReader.getLong(buffer, 0);                        String author = SVNReader.getString(buffer, 1);                        Date date = SVNReader.getDate(buffer, 2);                        String message = SVNReader.getString(buffer, 3);                        // remove all                            handler.handleLogEntry(new SVNLogEntry(                                    changedPathsMap, revision, author, date,                                    message));                    }                } catch (SVNException e) {                    if (e instanceof SVNCancelException || e instanceof SVNAuthenticationException) {                        throw e;                    }                    read("x", buffer, true);                    if (limit <= 0 || (limit > 0 && count <= limit)) {                        read("[()]", buffer, true);                    }                    return count;                }            }        } catch (SVNException e) {            closeSession();            throw e;        } finally {            closeConnection();        }    }