File tree 1 file changed +4
-4
lines changed
src/main/java/org/casbin/jcasbin/persist
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 18
18
import org .casbin .jcasbin .model .Model ;
19
19
20
20
import java .util .Arrays ;
21
+ import java .util .List ;
21
22
22
23
import static org .casbin .jcasbin .util .Util .splitCommaDelimited ;
23
24
@@ -40,9 +41,8 @@ public static void loadPolicyLine(String line, Model model) {
40
41
String key = tokens [0 ];
41
42
String sec = key .substring (0 , 1 );
42
43
Assertion ast = model .model .get (sec ).get (key );
43
- ast .policy .add (Arrays .asList (Arrays .copyOfRange (tokens , 1 , tokens .length )));
44
- for (int i = 0 ; i < ast .policy .size (); ++i ) {
45
- ast .policyIndex .put (ast .policy .get (i ).toString (), i );
46
- }
44
+ List <String > policy = Arrays .asList (Arrays .copyOfRange (tokens , 1 , tokens .length ));
45
+ ast .policy .add (policy );
46
+ ast .policyIndex .put (policy .toString (), ast .policy .size () - 1 );
47
47
}
48
48
}
You can’t perform that action at this time.
0 commit comments