Code Bye

MD5加密出现java.lang.StackOverflowError: stack size 1036KB错

先上代码:
    AlertDialog changePwdDialog;
    EditText etOldPwd, etNewPwd, etNewPwdSure;
    private void showChangePWDDialog(){
        View changePwdEdit = LayoutInflater.from(mContext).inflate(R.layout.dialog_change_password, null);
        etOldPwd = (EditText) changePwdEdit.findViewById(R.id.et_dialog_oldpwd);
        etNewPwd = (EditText) changePwdEdit.findViewById(R.id.et_dialog_newpwd);
        etNewPwdSure = (EditText) changePwdEdit.findViewById(R.id.et_dialog_newpwdSure);
        changePwdDialog = new AlertDialog.Builder(mContext)
                .setTitle("修改密码")
                .setView(changePwdEdit)
                .setNegativeButton("取消", null)
                .setPositiveButton("提交", null)
                .create();
        changePwdDialog.show();
        changePwdDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                verificationPwd(etOldPwd.getText().toString()
                        , etNewPwd.getText().toString()
                        , etNewPwdSure.getText().toString());
            }
        });
    }
    private void verificationPwd(final String oldPwdStr, final String newPwdStr, final String newPwdSureStr){
        if (CheckUtil.isBlank(oldPwdStr)){
            etOldPwd.setError("请填写旧密码");
            return;
        }
        if (CheckUtil.isBlank(newPwdStr)){
            etNewPwd.setError("请填写新密码");
            return;
        }
        if (CheckUtil.isBlank(newPwdSureStr)){
            etNewPwdSure.setError("请确认新密码");
            return;
        }
        if (!CheckUtil.equal(newPwdStr, newPwdSureStr)){
            etNewPwdSure.setError("两次新密码输入不一致");
            return;
        }
        if (CheckUtil.equal(oldPwdStr, newPwdStr)){
            etNewPwd.setError("新、旧密码不能相同");
            return;
        }
        DialogUtil.showProgressDialog(mContext, "正在修改...");
        StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                logger.i("SettingActivity : ChangePwd = " + response);
                DialogUtil.disMissProgress();
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                DialogUtil.disMissProgress();
                showToast("修改密码失败");
            }
        }){
            @Override
            protected Map<String, String> getParams() throws AuthFailureError{
                Map<String, String> paramMap = new HashMap<>();
                paramMap.put("_userId", CheckUtil.reform(mPrefHelper.read("_userId")));
                paramMap.put("password", getMd5PwdStr(oldPwdStr));
                paramMap.put("newpassword", getMd5PwdStr(newPwdStr));
                paramMap.put("confirmpassword", getMd5PwdStr(newPwdSureStr));
                return getParams();
            }
        };
        mRequestQueue.add(stringRequest);
    }
    private String getMd5PwdStr(String pwd){
        pwd = MD5.encrptMD5(pwd, MD5.UTF8);
        return pwd;
    }

报错:

 E/AndroidRuntime: FATAL EXCEPTION: Thread-1360
                                                                        Process: com.szfore.nwmlearning, PID: 26022
                                                                        java.lang.StackOverflowError: stack size 1036KB
                                                                            at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                            at java.lang.Class.newInstance(Class.java:1649)
                                                                            at java.security.Provider$Service.newInstanceNoParameter(Provider.java:1123)
                                                                            at java.security.Provider$Service.newInstance(Provider.java:1092)
                                                                            at org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:141)
                                                                            at java.security.MessageDigest.getInstance(MessageDigest.java:91)
                                                                            at com.szfore.nwmlearning.utils.MD5.encrptMD5(MD5.java:20)

代码有啥问题么?

解决方案

40

发MD5的源码啊,发这些没用

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明MD5加密出现java.lang.StackOverflowError: stack size 1036KB错