@@ -35,16 +35,12 @@ public class Util {
3535 public static boolean enableLog = true ;
3636 private static Pattern evalReg = Pattern .compile ("\\ beval\\ (([^),]*)\\ )" );
3737
38- private static Pattern BracketsReg = Pattern .compile ("\\ {[^}]*\\ }" );
39-
4038 private static Pattern escapeAssertionRegex = Pattern .compile ("\\ b(r|p)[0-9]*\\ ." );
4139
4240 private static Logger LOGGER = LoggerFactory .getLogger ("org.casbin.jcasbin" );
4341
4442 private static final String md5AlgorithmName = "MD5" ;
4543
46- private static final String MEDIAN = "||" ;
47-
4844 /**
4945 * logPrint prints the log.
5046 *
@@ -274,13 +270,12 @@ public static String[] splitCommaDelimited(String s) {
274270 String [] records = null ;
275271 if (s != null ) {
276272 try {
277- s = replaceCommaInBrackets (s );
278273 CSVFormat csvFormat = CSVFormat .Builder .create ().setIgnoreSurroundingSpaces (true ).build ();
279274 CSVParser csvParser = csvFormat .parse (new StringReader (s ));
280275 List <CSVRecord > csvRecords = csvParser .getRecords ();
281276 records = new String [csvRecords .get (0 ).size ()];
282277 for (int i = 0 ; i < csvRecords .get (0 ).size (); i ++) {
283- records [i ] = csvRecords .get (0 ).get (i ).replace ( MEDIAN , "," ). trim ();
278+ records [i ] = csvRecords .get (0 ).get (i ).trim ();
284279 }
285280 } catch (IOException e ) {
286281 Util .logPrintfError ("CSV parser failed to parse this line: " + s , e );
@@ -318,18 +313,6 @@ public static boolean setEquals(List<String> a, List<String> b) {
318313 return true ;
319314 }
320315
321- public static String replaceCommaInBrackets (String s ){
322- Matcher matcher = BracketsReg .matcher (s );
323- StringBuffer sb = new StringBuffer ();
324- while (matcher .find ()) {
325- String match = matcher .group ();
326- String replaced = match .replaceAll ("," , MEDIAN );
327- matcher .appendReplacement (sb , replaced );
328- }
329- matcher .appendTail (sb );
330- return sb .length () > 0 ? sb .toString () : s ;
331- }
332-
333316 public static boolean hasEval (String exp ) {
334317 return evalReg .matcher (exp ).matches ();
335318 }
0 commit comments