Closed xiaodong2077 closed 3 years ago
@Yienlilu the latest code has fixed this issue:
You can see: if (model.model.containsKey("g")) {
Please use latest release.
@Yienlilu the latest code has fixed this issue:
You can see:
if (model.model.containsKey("g")) {
Please use latest release.
Fine. I just see the newest version is 1.5.
I am using 1.2version beacuse I see it at the website: casbin.org
https://casbin.org/docs/zh-CN/get-started
I think this need to be updated.
@Yienlilu actually latest version is 1.6.0: https://github.com/casbin/jcasbin/releases
Website has been updated: https://github.com/casbin/casbin-website/commit/015df152ec1aab51d592050f79e4052fc514e823
@Yienlilu actually latest version is 1.6.0: https://github.com/casbin/jcasbin/releases
Website has been updated: casbin/casbin-website@015df15
Thank you!
Original Code of the function
Why I meet the NPE
I choose a keymatch_model.conf and a keymatch_policy.csv. Then I try to save a policy in my project. Here is my code:
Policy
class is a packaged class ofsub、obj、act
for me to use casbin more conveniently.Everytime I call this funtion, I will meet the NPE.
Where I meet the NPE
I use breakpoint to trace where it happened. And I found it at the function I gave out at the first paragraph.
The key line is:
The model file I download, in fact, doesn't have a
g
part.And the usage
model.model.get("g").entrySet()
is not suitable for this situation since my model file lost theg
part.I don't think the
g
part should be forced to use because I don't use the RBAC partten and I don't need a role.