排查读取文件异常

develop
PL 4 months ago
parent c6e51008f1
commit 472ad1589b

@ -306,14 +306,19 @@ public class ChatMessageServiceImpl implements ChatMessageService {
List<ChatModelDto> chatModels = new ArrayList<>();
ChatModelDto chatModel = null;
//验证获取模型数据 异常问题
File file = null;
try {
File file = new File(ClassLoader.getSystemResource("Json/ChatModel.json").getPath()); //相对路径获取文件信息
file = new File(ClassLoader.getSystemResource("Json/ChatModel.json").getPath()); //相对路径获取文件信息
//File file = new File("src/main/resources/Json/ChatModel.json"); //绝对路径获取文件信息
} catch (Exception e) {
throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), "读取文件" + Arrays.toString(e.getStackTrace()));
}
try {
//chatModel = readerMethod(file);
chatModels = readerMethod(file);
} catch (Exception e) {
throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), e.getMessage());
throw new ServiceException(ErrorCode.OPERATION_ERROR.getCode(), "读取文件并转换实体类" + Arrays.toString(e.getStackTrace()));
}
//循环查找对应的模型数据

Loading…
Cancel
Save