@Override public int handleMessage(ISession aSession, IRequestMessage aReqMsg, IResponsePackage aResPkg) { mLog.debug("[GET_AVATARS]: Catch"); MessageFactory msgFactory = aSession.getMessageFactory(); GetChooseAvatarResponse resBuyAvatar = (GetChooseAvatarResponse) msgFactory.getResponseMessage(aReqMsg.getID()); resBuyAvatar.session = aSession; try { GetChooseAvatarRequest rqBuyAvatar = (GetChooseAvatarRequest) aReqMsg; long uid = rqBuyAvatar.uid; String res = AvatarManager.getChooseAvatarForUser(uid, aSession.isMobileDevice()); resBuyAvatar.setSuccess(res); } catch (Throwable t) { t.printStackTrace(); resBuyAvatar.setFailure("Có lỗi xảy ra với avatar bạn muốn mua."); } finally { if ((resBuyAvatar != null)) { aResPkg.addMessage(resBuyAvatar); } } return 1; }