Package org.tmatesoft.svn.core

Examples of org.tmatesoft.svn.core.SVNErrorMessage


        SubversionUtils svn = new SubversionUtils(trunk + tag + url, destinationDirectory);

        try {
            svn.export();
        } catch (SVNException e) {
            SVNErrorMessage err = e.getErrorMessage();

            /*
             * Display all tree of error messages.
             * Utility method SVNErrorMessage.getFullMessage() may be used instead of the loop.
             */
            while (err != null) {
                getLog()
                    .error(err.getErrorCode().getCode() + " : " +
                    err.getMessage());
                err = err.getChildErrorMessage();
            }

            throw new MojoExecutionException(e.getMessage());
        }
    }
View Full Code Here


        SubversionUtils svn = new SubversionUtils(trunk + tag + url, destinationDirectory);

        try {
            svn.export();
        } catch (SVNException e) {
            SVNErrorMessage err = e.getErrorMessage();

            /*
             * Display all tree of error messages.
             * Utility method SVNErrorMessage.getFullMessage() may be used instead of the loop.
             */
            while (err != null) {
                getLog()
                        .error(err.getErrorCode().getCode() + " : " +
                                err.getMessage());
                err = err.getChildErrorMessage();
            }

            throw new MojoExecutionException(e.getMessage());
        }
    }
View Full Code Here

        // Check if the default workspace is a folder.
        SVNNodeKind nodeKind = null;
        try {
            nodeKind = defaultWorkspace.checkPath("", -1);
            if (nodeKind == SVNNodeKind.NONE) {
                SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                                                               "No entry at URL ''{0}''",
                                                               defaultWorkspace.getLocation().getPath());
                throw new SVNException(error);
            } else if (nodeKind == SVNNodeKind.UNKNOWN) {
                SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                                                               "Entry at URL ''{0}'' is a file while directory was expected",
                                                               defaultWorkspace.getLocation().getPath());
                throw new SVNException(error);
            } else if (nodeKind == SVNNodeKind.FILE) {
                SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                                                               "Entry at URL ''{0}'' is a file while directory was expected",
                                                               defaultWorkspace.getLocation().getPath());
                throw new SVNException(error);
            }
        } catch (SVNException e) {
View Full Code Here

                                String child,
                                String message ) throws SVNException {
        assert root.trim().length() != 0;
        SVNNodeKind rootKind = repository.checkPath(root, -1);
        if (rootKind == SVNNodeKind.UNKNOWN) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                                                         "path with name '{0}' is unknown in the repository",
                                                         root);
            throw new SVNException(err);
        } else if (rootKind == SVNNodeKind.NONE) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                                                         "path with name '{0}' is missing in the repository",
                                                         root);
            throw new SVNException(err);
        } else if (rootKind == SVNNodeKind.FILE) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                                                         "path with name '{0}' is a file, you need a directory",
                                                         root);
            throw new SVNException(err);
        } else if (rootKind == SVNNodeKind.DIR) {
            ISVNEditor editor = repository.getCommitEditor(message, null, true, null);
View Full Code Here

        if (childKind == SVNNodeKind.NONE) {
            ScmAction addNodeAction = addDirectory(root, childName);
            SVNActionExecutor executor = new SVNActionExecutor(repos);
            executor.execute(addNodeAction, message);
        } else {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "Item with name '{0}' can't be created", childName);
            throw new SVNException(err);
        }
    }
View Full Code Here

        if (childKind == SVNNodeKind.NONE) {
            ScmAction addFileNodeAction = addFile(path, file, content);
            SVNActionExecutor executor = new SVNActionExecutor(defaultWorkspace);
            executor.execute(addFileNodeAction, message);
        } else {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                                                         "Item with name '{0}' can't be created (already exist)",
                                                         file);
            throw new SVNException(err);
        }
    }
View Full Code Here

        ISVNEditor editor = this.repository.getCommitEditor(message, null);
        editor.openRoot(-1);
        try {
            action.applyAction(editor);
        } catch (Exception e) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "This error is appeared: '{0}'", e.getMessage());
            throw new SVNException(err);
        }
        editor.closeDir();
        editor.closeEdit();
View Full Code Here

    public long replicateRepository(SVNRepository src, SVNRepository dst, long fromRevision, long toRevision) throws SVNException {
        fromRevision = fromRevision <= 0 ? 1 : fromRevision;
        long dstLatestRevision = dst.getLatestRevision();

        if (dstLatestRevision != fromRevision - 1) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "The target repository''s latest revision must be ''{0}''", new Long(fromRevision - 1));
            SVNErrorManager.error(err, SVNLogType.FSFS);
        }

        if (!src.getRepositoryRoot(true).equals(src.getLocation())) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Source repository location must be at repository root ({0}), not at {1}",
                    new Object[]{src.getRepositoryRoot(true), src.getLocation()});
            SVNErrorManager.error(err, SVNLogType.FSFS);
        }
        if (!dst.getRepositoryRoot(true).equals(dst.getLocation())) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Target repository location must be at repository root ({0}), not at {1}",
                    new Object[]{dst.getRepositoryRoot(true), dst.getLocation()});
            SVNErrorManager.error(err, SVNLogType.FSFS);
        }

        long latestRev = src.getLatestRevision();
        toRevision = toRevision > 0 && toRevision <= latestRev ? toRevision : latestRev;

        final SVNLogEntry[] currentRevision = new SVNLogEntry[1];

        long count = toRevision - fromRevision + 1;
        if (dstLatestRevision == 0) {
            SVNProperties zeroRevisionProperties = src.getRevisionProperties(0, null);
            updateRevisionProperties(dst, 0, zeroRevisionProperties);
        }

        for (long i = fromRevision; i <= toRevision; i++) {
            SVNProperties revisionProps = src.getRevisionProperties(i, null);
            String commitMessage = revisionProps.getStringValue(SVNRevisionProperty.LOG);

            currentRevision[0] = null;

            checkCancelled();
            src.log(new String[]{""}, i, i, true, false, 1, new ISVNLogEntryHandler() {
                public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
                    currentRevision[0] = logEntry;
                }
            });
            checkCancelled();

            if (currentRevision[0] == null || currentRevision[0].getChangedPaths() == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "Revision ''{0}'' does not contain information on changed paths; probably access is denied", new Long(i));
                SVNErrorManager.error(err, SVNLogType.FSFS);
            } else if (currentRevision[0].getDate() == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "Revision ''{0}'' does not contain commit date; probably access is denied", new Long(i));
                SVNErrorManager.error(err, SVNLogType.FSFS);
            }

            fireReplicatingEvent(currentRevision[0]);

            commitMessage = commitMessage == null ? "" : commitMessage;
            ISVNEditor commitEditor = SVNCancellableEditor.newInstance(dst.getCommitEditor(commitMessage, null), this, src.getDebugLog());

            SVNReplicationEditor bridgeEditor = null;
            try {
                bridgeEditor = new SVNReplicationEditor(src, commitEditor, currentRevision[0]);
                final long previousRev = i - 1;

                src.update(i, null, true, new ISVNReporterBaton() {
                    public void report(ISVNReporter reporter) throws SVNException {
                        reporter.setPath("", null, previousRev, SVNDepth.INFINITY, false);
                        reporter.finishReport();
                    }
                }, SVNCancellableEditor.newInstance(bridgeEditor, this, src.getDebugLog()));
            } catch (SVNException svne) {
                try {
                    bridgeEditor.abortEdit();
                } catch (SVNException e) {
                }

                throw svne;
            } catch (Throwable th) {
                try {
                    bridgeEditor.abortEdit();
                } catch (SVNException e) {
                }

                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, th.getMessage());
                SVNErrorManager.error(err, th, SVNLogType.FSFS);
            }

            SVNCommitInfo commitInfo = bridgeEditor.getCommitInfo();
            try {
View Full Code Here

        MessageDigest digest = null;
        if (computeChecksum) {
            try {
                digest = MessageDigest.getInstance("MD5");
            } catch (NoSuchAlgorithmException e) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "MD5 implementation not found: {0}", e.getLocalizedMessage());
                SVNErrorManager.error(err, e, SVNLogType.DEFAULT);
                return null;
            }
        }
        boolean windowSent = false;
        while(true) {
            int targetLength;
            int sourceLength;
            try {
                targetLength = readToBuffer(target, myTargetBuffer);
            } catch (IOExceptionWrapper ioew) {
                throw ioew.getOriginalException();
            } catch (IOException e) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
                SVNErrorManager.error(err, e, SVNLogType.DEFAULT);
                return null;
            }
            if (targetLength <= 0) {
                // send empty window, needed to create empty file.
                // only when no windows was sent at all.
                if (!windowSent && consumer != null) {
                    consumer.textDeltaChunk(path, SVNDiffWindow.EMPTY);
                }
                break;
            }
            try {
                sourceLength = readToBuffer(source, mySourceBuffer);
            } catch (IOExceptionWrapper ioew) {
                throw ioew.getOriginalException();
            } catch (IOException e) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
                SVNErrorManager.error(err, e, SVNLogType.DEFAULT);
                return null;
            }
            if (sourceLength < 0) {
                sourceLength = 0;
View Full Code Here

                deletedPath.getType() == SVNLogEntryPath.TYPE_REPLACED)) {
            if (deletedPath.getType() == SVNLogEntryPath.TYPE_DELETED) {
                myChangedPaths.remove(absPath);
            }
        } else {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
                    "Expected that path ''{0}'' is deleted in revision {1}",
                    new Object[]{absPath, new Long(myPreviousRevision)});
            SVNErrorManager.error(err, SVNLogType.FSFS);
        }
        myCommitEditor.deleteEntry(path, myPreviousRevision);
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.SVNErrorMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.