mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
fix there is no error on missing revision
This commit is contained in:
@@ -65,6 +65,9 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -128,10 +131,11 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
if (Util.isNotEmpty(request.getRevision()))
|
||||
{
|
||||
logger.error("could not find revision {}", request.getRevision());
|
||||
throw notFound(entity("Revision", request.getRevision()).in(this.repository));
|
||||
}
|
||||
else if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("coul not find head of repository, empty?");
|
||||
logger.warn("could not find head of repository, empty?");
|
||||
}
|
||||
|
||||
result = new BrowserResult(Constants.HEAD, createEmtpyRoot());
|
||||
|
||||
@@ -79,6 +79,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
*/
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(GitLogCommand.class);
|
||||
public static final String REVISION = "Revision";
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
@@ -143,6 +144,10 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
{
|
||||
logger.error("could not open repository", ex);
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
throw notFound(entity(REVISION, revision).in(this.repository));
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(converter);
|
||||
@@ -208,7 +213,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
if (!Strings.isNullOrEmpty(request.getAncestorChangeset())) {
|
||||
ancestorId = repository.resolve(request.getAncestorChangeset());
|
||||
if (ancestorId == null) {
|
||||
throw notFound(entity("Revision", request.getAncestorChangeset()).in(this.repository));
|
||||
throw notFound(entity(REVISION, request.getAncestorChangeset()).in(this.repository));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +255,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
}
|
||||
}
|
||||
} else if (ancestorId != null) {
|
||||
throw notFound(entity("Revision", request.getBranch()).in(this.repository));
|
||||
throw notFound(entity(REVISION, request.getBranch()).in(this.repository));
|
||||
}
|
||||
|
||||
if (branch != null) {
|
||||
@@ -267,7 +272,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
}
|
||||
catch (MissingObjectException e)
|
||||
{
|
||||
throw notFound(entity("Revision", e.getObjectId().getName()).in(repository));
|
||||
throw notFound(entity(REVISION, e.getObjectId().getName()).in(repository));
|
||||
}
|
||||
catch (NotFoundException e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user