Skip to content

Commit

Permalink
* 修改配置加载异常提示
Browse files Browse the repository at this point in the history
  • Loading branch information
qiwiwi committed Mar 17, 2022
1 parent 1e012d4 commit bb16f00
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions jndc_client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<artifactId>jfoenix</artifactId>
<version>8.0.10</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
7 changes: 7 additions & 0 deletions jndc_client/src/main/java/jndc_client/start/ClientStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jndc_client.core.JNDCClient;
import jndc_client.core.JNDCClientConfig;
import jndc_client.http_support.ClientHttpManagement;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -58,12 +59,18 @@ public static void main(String[] args) {
JNDCClientConfig jndcClientConfig = null;
try {
jndcClientConfig = ymlParser.parseFile(file, JNDCClientConfig.class);
if (jndcClientConfig == null) {
String configContent = FileUtils.readFileToString(file, "utf-8");
logger.error("please check the content:\n=====content_start=====\n" + configContent + "\n=====content_end=====\n on config.yml" + file);
ApplicationExit.exit();
}
jndcClientConfig.performParameterVerification();
jndcClientConfig.setRuntimeDir(file.getParent());
jndcClientConfig.loadClientId();
logger.info(tag + CLIENT_ID);
logger.info("client time out--->" + jndcClientConfig.getAutoReleaseTimeOut());
} catch (Exception e) {
e.printStackTrace();
logger.error("parse config file:" + file + "fail" + e);
ApplicationExit.exit();
}
Expand Down
1 change: 0 additions & 1 deletion jndc_server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>

Expand Down
6 changes: 6 additions & 0 deletions jndc_server/src/main/java/jndc_server/start/ServerStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jndc.utils.YmlParser;
import jndc_server.core.JNDCServer;
import jndc_server.core.JNDCServerConfig;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -61,6 +62,11 @@ public static void main(String[] args) {
JNDCServerConfig jndcServerConfig = null;
try {
jndcServerConfig = ymlParser.parseFile(file, JNDCServerConfig.class);
if (jndcServerConfig == null) {
String configContent = FileUtils.readFileToString(file, "utf-8");
logger.error("please check the content:\n=====content_start=====\n" + configContent + "\n=====content_end=====\n on config.yml" + file);
ApplicationExit.exit();
}
jndcServerConfig.setRuntimeDir(file.getParent());
jndcServerConfig.performParameterVerification();
jndcServerConfig.lazyInitAfterVerification();
Expand Down
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>


Expand All @@ -44,6 +54,8 @@
<version>1.18.16</version>
<scope>provided</scope>
</dependency>


</dependencies>

<build>
Expand Down

0 comments on commit bb16f00

Please sign in to comment.