From 63c4173987c902ded477d3abd1af1a66aca9364d Mon Sep 17 00:00:00 2001 From: gongzhenkun <1658878546@qq.com> Date: Sat, 27 Aug 2022 14:09:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9app=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/web/controller/api/AppController.java | 2 +- .../src/main/java/com/ruoyi/common/utils/file/FileUtils.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index 8bf69e2..5d663f8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -717,7 +717,7 @@ public class AppController extends BaseController @GetMapping("/version/info") public AjaxResult queryVersionInformation(){ String localPath = RuoYiConfig.getAppInfoPath(); - String file = FileUtils.readJsonFile(localPath + "appVersion.json"); + String file = FileUtils.readJsonFile(localPath +"/" + "appVersion.json"); return AjaxResult.success(JSONObject.parseObject(file)); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java index 8768ecf..a4b9eba 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java @@ -347,7 +347,7 @@ public class FileUtils * @return {@code String} */ public static String readJsonFile(String Filename) { - String jsonStr = ""; + String jsonStr; try { File jsonFile = new File(Filename); FileReader fileReader = new FileReader(jsonFile); @@ -362,8 +362,7 @@ public class FileUtils jsonStr = sb.toString(); return jsonStr; } catch (IOException e) { - e.printStackTrace(); - return null; + throw new ServiceException(e.getMessage()); } } }