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

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

Exception 強(qiáng)轉(zhuǎn) BusinessException 不成功 java.lang.ClassCastException: java.lang.NullPointerException cannot be cast to com.dmsc.error.BusinessException at com.dmsc.conrtoller.UserConrtoller.handlerException(UserConrtoller.java:46) ~[classes/:na]

@ExceptionHandler(Exception.class)??

@ResponseStatus(HttpStatus.OK)

@ResponseBody

public Object handlerException(HttpServletRequest repuest,Exception ex){

BusinessException businessException = (BusinessException) ex;

CommonReyurnType type = new CommonReyurnType();

/* Map<String, Object> map? = new HashMap<>();?

map.put("errcode", businessException.getErrCode());

map.put("errmsg", businessException.getErrMsg());*/

type.setStatus("fail");

type.setData(ex);

return type;

}


正在回答

5 回答

UserServiceImpl.java的改成這樣就行了
UserDo?userDo?=?userDoMapper.selectByPrimaryKey(id);
if(userDo==null){
????return?null;
}
UserPasswordDo?userPasswordDo?=?userPasswordDoMapper.selectByUserId(userDo.getId());
if?(userPasswordDo==null){
????return?null;
}
return?convertFromDataobject(userDo,userPasswordDo);}


2 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_忘了怎樣灑脫_KLVX57

BusinessException businessException = (BusinessException)ex; 我這一步獲得的ex一直是null,就一直很納悶,找了好久,在impl里面加了像你一樣的兩個(gè)判空,就不會(huì)了,非常感謝?。。。?!
2020-03-08 回復(fù) 有任何疑惑可以回復(fù)我~
#2

qq_忘了怎樣灑脫_KLVX57

可是我還有一個(gè)疑惑,為什么第一個(gè)判空注釋了,但是第二個(gè)判空留著了,為什么ex還是null呢
2020-03-08 回復(fù) 有任何疑惑可以回復(fù)我~
#3

qq_忘了怎樣灑脫_KLVX57 回復(fù) qq_忘了怎樣灑脫_KLVX57

我已經(jīng)知道了,哈哈,只注釋第一個(gè),到了查詢密碼的時(shí)候,那就是空指針異常了
2020-03-08 回復(fù) 有任何疑惑可以回復(fù)我~

我也是這個(gè)問題

0 回復(fù) 有任何疑惑可以回復(fù)我~

同樣問題

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

瑾涼丶

convertFromModel方法中Model轉(zhuǎn)換成viewObject方法中,Model當(dāng)空時(shí)候沒有判空,導(dǎo)致轉(zhuǎn)換報(bào)錯(cuò),并沒有走到下面拋異常方法。報(bào)錯(cuò)報(bào)的也是轉(zhuǎn)換異常造成的
2019-07-09 回復(fù) 有任何疑惑可以回復(fù)我~

解決問題了么?

同樣這個(gè)問題

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

瑾涼丶

convertFromModel方法中Model轉(zhuǎn)換成viewObject方法中,Model當(dāng)空時(shí)候沒有判空,導(dǎo)致轉(zhuǎn)換報(bào)錯(cuò),并沒有走到下面拋異常方法。報(bào)錯(cuò)報(bào)的也是轉(zhuǎn)換異常造成的
2019-07-09 回復(fù) 有任何疑惑可以回復(fù)我~

傳參的時(shí)候沒傳ex,你看看ex是不是null

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

Exception 強(qiáng)轉(zhuǎn) BusinessException 不成功 java.lang.ClassCastException: java.lang.NullPointerException cannot be cast to com.dmsc.error.BusinessException at com.dmsc.conrtoller.UserConrtoller.handlerException(UserConrtoller.java:46) ~[classes/:na]

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)