@@ -35,16 +35,12 @@ public class Util {
35
35
public static boolean enableLog = true ;
36
36
private static Pattern evalReg = Pattern .compile ("\\ beval\\ (([^),]*)\\ )" );
37
37
38
- private static Pattern BracketsReg = Pattern .compile ("\\ {[^}]*\\ }" );
39
-
40
38
private static Pattern escapeAssertionRegex = Pattern .compile ("\\ b(r|p)[0-9]*\\ ." );
41
39
42
40
private static Logger LOGGER = LoggerFactory .getLogger ("org.casbin.jcasbin" );
43
41
44
42
private static final String md5AlgorithmName = "MD5" ;
45
43
46
- private static final String MEDIAN = "||" ;
47
-
48
44
/**
49
45
* logPrint prints the log.
50
46
*
@@ -274,13 +270,12 @@ public static String[] splitCommaDelimited(String s) {
274
270
String [] records = null ;
275
271
if (s != null ) {
276
272
try {
277
- s = replaceCommaInBrackets (s );
278
273
CSVFormat csvFormat = CSVFormat .Builder .create ().setIgnoreSurroundingSpaces (true ).build ();
279
274
CSVParser csvParser = csvFormat .parse (new StringReader (s ));
280
275
List <CSVRecord > csvRecords = csvParser .getRecords ();
281
276
records = new String [csvRecords .get (0 ).size ()];
282
277
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 ();
284
279
}
285
280
} catch (IOException e ) {
286
281
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) {
318
313
return true ;
319
314
}
320
315
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
-
333
316
public static boolean hasEval (String exp ) {
334
317
return evalReg .matcher (exp ).matches ();
335
318
}
0 commit comments