File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
src/main/java/org/casbin/jcasbin/util Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -146,19 +146,25 @@ public static String escapeAssertion(String s) {
146146 * @return the 'include' expression.
147147 */
148148 public static String convertInSyntax (String expString ) {
149- Matcher matcher = IN_SYNTAX_PATTERN .matcher (expString );
150- if (matcher .find ()) {
151- StringBuffer sb = new StringBuffer ();
152- do {
153- matcher .appendReplacement (sb , "include($2, $1)" );
154- } while (matcher .find ());
155- matcher .appendTail (sb );
156- return sb .toString ();
149+ if (expString .contains (" in " )) {
150+ Matcher matcher = IN_SYNTAX_PATTERN .matcher (expString );
151+ if (matcher .find ()) {
152+ return replaceInSyntaxWithInclude (matcher );
153+ }
157154 }
158155
159156 return expString ;
160157 }
161158
159+ private static String replaceInSyntaxWithInclude (Matcher matcher ) {
160+ StringBuffer sb = new StringBuffer ();
161+ do {
162+ matcher .appendReplacement (sb , "include($2, $1)" );
163+ } while (matcher .find ());
164+ matcher .appendTail (sb );
165+ return sb .toString ();
166+ }
167+
162168 /**
163169 * removeComments removes the comments starting with # in the text.
164170 *
You can’t perform that action at this time.
0 commit comments