mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-01 19:38:09 +08:00
🔨 perf(server): Git 仓库地址不正确相关提示更准确
This commit is contained in:
parent
d11dff24ca
commit
fa9c8e7516
@ -1,5 +1,14 @@
|
||||
# 🚀 版本日志
|
||||
|
||||
## 2.11.4.1
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】优化 构建相关页面无法正常打开
|
||||
2. 【server】优化 Git 仓库地址不正确相关提示更准确(感谢@易自玉)
|
||||
|
||||
------
|
||||
|
||||
## 2.11.4.0
|
||||
|
||||
### 🐣 新增功能
|
||||
|
@ -13,6 +13,7 @@ import cn.hutool.core.collection.CollStreamUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.comparator.VersionComparator;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Tuple;
|
||||
@ -26,6 +27,9 @@ import org.eclipse.jgit.api.errors.CheckoutConflictException;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.api.errors.NoHeadException;
|
||||
import org.eclipse.jgit.api.errors.TransportException;
|
||||
import org.eclipse.jgit.errors.NoRemoteRepositoryException;
|
||||
import org.eclipse.jgit.errors.NotSupportedException;
|
||||
import org.eclipse.jgit.errors.RepositoryNotFoundException;
|
||||
import org.eclipse.jgit.internal.JGitText;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
@ -450,6 +454,21 @@ public class JGitUtil {
|
||||
*/
|
||||
public static void checkTransportException(Exception ex, File gitFile, PrintWriter printWriter) throws Exception {
|
||||
println(printWriter, "");
|
||||
Throwable causedBy = ExceptionUtil.getCausedBy(ex, NotSupportedException.class);
|
||||
if (causedBy != null) {
|
||||
println(printWriter, "当前地址可能不是 git 仓库地址:" + causedBy.getMessage());
|
||||
throw new IllegalStateException("当前地址可能不是 git 仓库地址:" + causedBy.getMessage(), ex);
|
||||
}
|
||||
causedBy = ExceptionUtil.getCausedBy(ex, NoRemoteRepositoryException.class);
|
||||
if (causedBy != null) {
|
||||
println(printWriter, "当前地址远程不存在仓库:" + causedBy.getMessage());
|
||||
throw new IllegalStateException("当前地址远程不存在仓库:" + causedBy.getMessage(), ex);
|
||||
}
|
||||
causedBy = ExceptionUtil.getCausedBy(ex, RepositoryNotFoundException.class);
|
||||
if (causedBy != null) {
|
||||
println(printWriter, "当前地址不存在仓库:" + causedBy.getMessage());
|
||||
throw new IllegalStateException("当前地址不存在仓库:" + causedBy.getMessage(), ex);
|
||||
}
|
||||
if (ex instanceof TransportException) {
|
||||
String msg = ex.getMessage();
|
||||
if (StrUtil.containsAny(msg, JGitText.get().notAuthorized, JGitText.get().authenticationNotSupported)) {
|
||||
|
Loading…
Reference in New Issue
Block a user