Browse Source

key file错误信息

wangpenghui 1 year ago
parent
commit
d1550ca0d7

+ 5 - 1
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/service/impl/VppKeyFileServiceImpl.java

@@ -3,6 +3,7 @@ package cn.kdan.pdf.tech.core.service.impl;
 import cn.kdan.pdf.tech.core.model.*;
 import cn.kdan.pdf.tech.core.service.*;
 import cn.kdan.pdf.tech.core.utils.KeyFileParseUtils;
+import exception.BackendRuntimeException;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -39,7 +40,10 @@ public class VppKeyFileServiceImpl implements VppKeyFileService {
             fileContent = KeyFileParseUtils.parseKeyFile(inputStream, updateOrInit);
         } catch (Exception e) {
             log.error("解析key文件失败, "+ e.getMessage(), e);
-            throw new RuntimeException("The key file signature is invalid.");
+            if (e instanceof BackendRuntimeException) {
+                throw (BackendRuntimeException) e;
+            }
+            throw new RuntimeException("Verily Failed, please try again");
         }
         if (!updateOrInit) {
             VppCompany vppCompany = fileContent.getVppCompany();

+ 2 - 2
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/utils/KeyFileParseUtils.java

@@ -45,13 +45,13 @@ public class KeyFileParseUtils {
         String users = properties.getProperty("Users");
         Sign sign = JsonUtils.jsonStringToBean(signJsonStr, Sign.class);
         if (!Objects.deepEquals(ServerUtils.getDeviceId(),serverID)) {
-            throw new BackendRuntimeException("The key file signature is invalid.");
+            throw new BackendRuntimeException("Server ID Error. Please check your Key File.");
         }
         if (!(Objects.deepEquals(sign.getServerID(),serverID)
                 && Objects.deepEquals(sign.getLicenseDate(),licenseDate)
                 && Objects.deepEquals(sign.getExpireDate(),expireDate)
                 && Objects.deepEquals(sign.getUsers(),users))) {
-            throw new BackendRuntimeException("The key file signature is invalid.");
+            throw new BackendRuntimeException("Signature invalid. Please check your Key File.");
         }
         FileContent fileContent = new FileContent();
         // 是否是更新?