Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRPC调用报空指针 #744

Open
degnbo opened this issue Feb 25, 2025 · 0 comments
Open

GRPC调用报空指针 #744

degnbo opened this issue Feb 25, 2025 · 0 comments

Comments

@degnbo
Copy link

degnbo commented Feb 25, 2025

使用版本:

Sa-Token v1.40.0

报错信息:

Caused by: java.lang.NullPointerException
at cn.dev33.satoken.stp.StpLogic.setTokenValue(StpLogic.java:207) ~[sa-token-core-1.40.0.jar:?]
at cn.dev33.satoken.stp.StpLogic.setTokenValue(StpLogic.java:172) ~[sa-token-core-1.40.0.jar:?]
at cn.dev33.satoken.stp.StpUtil.setTokenValue(StpUtil.java:103) ~[sa-token-core-1.40.0.jar:?]

希望结果:

不报错误

复现步骤:

代码中new SaLoginModel() isWriteHeader 为null 导致loginModel.getIsWriteHeader()为null 报错

public void setTokenValue(String tokenValue) {
this.setTokenValue(tokenValue, (new SaLoginModel()).setTimeout(this.getConfigOrGlobal().getTimeout()));
}

public void setTokenValue(String tokenValue, int cookieTimeout) {
    this.setTokenValue(tokenValue, (new SaLoginModel()).setTimeout((long)cookieTimeout));
}

public void setTokenValue(String tokenValue, SaLoginModel loginModel) {
    if (!SaFoxUtil.isEmpty(tokenValue)) {
        this.setTokenValueToStorage(tokenValue);
        if (this.getConfigOrGlobal().getIsReadCookie()) {
            this.setTokenValueToCookie(tokenValue, loginModel.getCookieTimeout());
        }

        if (loginModel.getIsWriteHeader()) {
            this.setTokenValueToResponseHeader(tokenValue);
        }

    }
}

< 备注:如果复现步骤比较复杂,请将 demo 上传到 gitee 并留下地址 >

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant