Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 4e5a045

Browse files
committed
refactor: optimize code
1 parent 0ff2cd0 commit 4e5a045

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
<artifactId>maven-compiler-plugin</artifactId>
9696
<version>${maven.compiler.plugin.version}</version>
9797
<configuration>
98+
<skip>true</skip>
9899
<forceJavacCompilerUse>true</forceJavacCompilerUse>
99100
<annotationProcessorPaths>
100101
<path>

src/main/java/org/code4everything/wetool/service/HttpFileBrowserService.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import javafx.event.EventHandler;
1010
import javafx.scene.control.TextInputDialog;
1111
import org.code4everything.wetool.handler.HttpFileBrowserHandler;
12+
import org.code4everything.wetool.plugin.support.exception.ToDialogException;
1213
import org.code4everything.wetool.plugin.support.http.HttpService;
1314
import org.code4everything.wetool.plugin.support.util.FxDialogs;
1415
import org.code4everything.wetool.plugin.support.util.FxUtils;
@@ -49,7 +50,7 @@ public void browse(int port, String apiPattern) {
4950
public synchronized void browse(int port, String apiPattern, String rootPath) {
5051
HttpFileBrowserHandler handler = new HttpFileBrowserHandler(port, apiPattern, rootPath);
5152
if (handlerSet.contains(handler)) {
52-
WeUtils.throwInterruptDialog("接口已存在:{}", apiPattern);
53+
throw ToDialogException.ofError("接口已存在:{}", apiPattern);
5354
}
5455

5556
handler.export();
@@ -79,12 +80,12 @@ public void httpFileBrowserDialog() {
7980
private void handleExportCmd(String cmd) {
8081
String[] segment = StrUtil.split(StrUtil.trim(cmd), " ");
8182
if (ArrayUtil.isEmpty(segment)) {
82-
WeUtils.throwInterruptDialog("命令格式错误!");
83+
throw ToDialogException.ofError("命令格式错误!");
8384
}
8485

8586
String[] api = StrUtil.split(segment[0], ":");
8687
if (ArrayUtil.isEmpty(segment)) {
87-
WeUtils.throwInterruptDialog("命令格式错误!");
88+
throw ToDialogException.ofError("命令格式错误!");
8889
}
8990

9091
int port = HttpService.getDefaultPort();
@@ -104,7 +105,7 @@ private void handleExportCmd(String cmd) {
104105
}
105106

106107
if (!FileUtil.exist(rootPath.get())) {
107-
WeUtils.throwInterruptDialog("根目录未设置");
108+
throw ToDialogException.ofError("根目录未设置");
108109
}
109110

110111
browse(port, apiPattern, rootPath.get());

src/main/java/org/code4everything/wetool/service/UpdateService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class UpdateService {
3838
public void checkUpdate() {
3939
String history = HttpUtil.get("https://gitee.com/code4everything/wetool/raw/master/history.md");
4040
if (StrUtil.isEmpty(history)) {
41-
WeUtils.throwInterruptDialog("网络异常");
41+
throw ToDialogException.ofError("网络异常");
4242
}
4343

4444
VersionInfo versionInfo = getNewestVersionInfo(history);

0 commit comments

Comments
 (0)