第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

提交表單之后報空指針異常?

提交表單之后報空指針異常?

慕數(shù)據(jù)017433 2018-12-29 17:57:09
@Transactional(rollbackFor?=?Exception.class) public?boolean?addAccount(User?account)?{ ????//密碼加鹽MD5 ????account.setPasswd(HashUtils.encryPassword(account.getPasswd())); ????//頭像保存到本地 ????List<String>?imageList?=?fileService.getImagePath(Lists.newArrayList(account.getAvatorFile())); ????if?(!imageList.isEmpty()){ ?????account.setAvator(imageList.get(0));//將相對路徑設置進去 ????} ????BeanHelper.setDefaultProp(account,User.class); ????BeanHelper.onInsert(account); ????userMapper.insert(account); ????account.setEnable(0); ????mailService.registerNotify(account.getEmail()); ????return?true; } file: ??path:?D:/pic@Value("${file.path:}") private?String?filePath; /** ?*?將上傳文件返回一個列表路徑,因為我們存儲到數(shù)據(jù)庫里面知識一個路徑,不是一個文件,我們的文件是要保存到本地的 ?*/ public?List<String>?getImagePath(List<MultipartFile>?files){ ????List<String>?paths?=?Lists.newArrayList(); ????//對每個上傳的每個文件進行操作 ????files.forEach(file?->?{ ????????File?localFile?=?null; ????????if?(!file.isEmpty()){ ????????????try?{ ????????????localFile?=?saveToLocal(file,filePath); ????????????String?path?=?StringUtils.substringAfterLast(localFile.getAbsolutePath(),filePath); ????????????paths.add(path); ????????????}catch(IOException?e){ ????????????????throw?new?IllegalArgumentException(e); ????????????} ????????} ????}); ????return?paths; } 2018-12-29?17:55:52.617??INFO?12720?---?[?qtp98801744-35]?com.yxs.house.web.filter.LogFilter???????: ?request---coming...2018-12-29?17:55:52.743?ERROR?12720?---?[?qtp98801744-35]?c.yxs.house.web.controller.ErrorHandler??: ??nulljava.lang.NullPointerException:?null at?com.yxs.house.biz.service.FileService.lambda$getImagePath$0(FileService.java:31)?~[classes/:na] ?? at?com.yxs.house.biz.service.FileService$$Lambda$17/1558917749.accept(Unknown?Source)?~[na:na] at?java.util.ArrayList.forEach(ArrayList.java:1249)? ?? ~[na:1.8.0_25] at?com.yxs.house.biz.service.FileService.getImagePath(FileService.java:29)?~[classes/:na] ?? at?com.yxs.house.biz.service.UserService.addAccount(UserService.java:56)?~[classes/:na]
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 1295 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號