mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-22 00:09:47 +01:00
Create error response for already existing entities
This commit is contained in:
@@ -49,7 +49,6 @@ import org.tmatesoft.svn.core.internal.util.SVNEncodingUtil;
|
||||
import org.tmatesoft.svn.core.internal.util.SVNXMLUtil;
|
||||
import org.tmatesoft.svn.core.io.SVNRepository;
|
||||
import org.tmatesoft.svn.core.wc.SVNClientManager;
|
||||
import sonia.scm.NotFoundException;
|
||||
import sonia.scm.util.HttpUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
@@ -60,6 +59,9 @@ import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -114,7 +116,7 @@ public final class SvnUtil
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw NotFoundException.notFound("Revision", v).in(repository).build();
|
||||
throw notFound(entity("Revision", v).in(repository));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +354,7 @@ public final class SvnUtil
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw NotFoundException.notFound("Revision", revision).in(repository).build();
|
||||
throw notFound(entity("Revision", revision).in(repository));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.tmatesoft.svn.core.SVNProperties;
|
||||
import org.tmatesoft.svn.core.io.SVNRepository;
|
||||
import org.tmatesoft.svn.core.wc.SVNClientManager;
|
||||
import org.tmatesoft.svn.core.wc.admin.SVNLookClient;
|
||||
import sonia.scm.NotFoundException;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.SvnUtil;
|
||||
@@ -53,6 +52,9 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -131,9 +133,9 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
|
||||
private void handleSvnException(CatCommandRequest request, SVNException ex) {
|
||||
int svnErrorCode = ex.getErrorMessage().getErrorCode().getCode();
|
||||
if (SVNErrorCode.FS_NOT_FOUND.getCode() == svnErrorCode) {
|
||||
throw NotFoundException.notFound("Path", request.getPath()).in("Revision", request.getRevision()).in(repository).build();
|
||||
throw notFound(entity("Path", request.getPath()).in("Revision", request.getRevision()).in(repository));
|
||||
} else if (SVNErrorCode.FS_NO_SUCH_REVISION.getCode() == svnErrorCode) {
|
||||
throw NotFoundException.notFound("Revision", request.getRevision()).in(repository).build();
|
||||
throw notFound(entity("Revision", request.getRevision()).in(repository));
|
||||
} else {
|
||||
throw new InternalRepositoryException("could not get content from revision", ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user