|
31 | 31 | import java.time.ZoneId; |
32 | 32 | import java.time.format.DateTimeFormatter; |
33 | 33 | import java.util.HexFormat; |
34 | | -import java.util.regex.Pattern; |
35 | | -import java.util.regex.Matcher; |
36 | 34 | import java.util.Locale; |
37 | 35 |
|
38 | 36 | /** |
@@ -65,7 +63,7 @@ public class Debug { |
65 | 63 | } |
66 | 64 |
|
67 | 65 | if (args != null) { |
68 | | - args = marshal(args); |
| 66 | + args = args.toLowerCase(Locale.ENGLISH); |
69 | 67 | if (args.equals("help")) { |
70 | 68 | Help(); |
71 | 69 | } else if (args.contains("all")) { |
@@ -349,69 +347,6 @@ public static String toHexString(BigInteger b) { |
349 | 347 | return sb.toString(); |
350 | 348 | } |
351 | 349 |
|
352 | | - /** |
353 | | - * change a string into lower case except permission classes and URLs. |
354 | | - */ |
355 | | - private static String marshal(String args) { |
356 | | - if (args != null) { |
357 | | - StringBuilder target = new StringBuilder(); |
358 | | - StringBuilder source = new StringBuilder(args); |
359 | | - |
360 | | - // obtain the "permission=<classname>" options |
361 | | - // the syntax of classname: IDENTIFIER.IDENTIFIER |
362 | | - // the regular express to match a class name: |
363 | | - // "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*" |
364 | | - String keyReg = "[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn]="; |
365 | | - String keyStr = "permission="; |
366 | | - String reg = keyReg + |
367 | | - "[a-zA-Z_$][a-zA-Z0-9_$]*([.][a-zA-Z_$][a-zA-Z0-9_$]*)*"; |
368 | | - Pattern pattern = Pattern.compile(reg); |
369 | | - Matcher matcher = pattern.matcher(source); |
370 | | - StringBuilder left = new StringBuilder(); |
371 | | - while (matcher.find()) { |
372 | | - String matched = matcher.group(); |
373 | | - target.append(matched.replaceFirst(keyReg, keyStr)); |
374 | | - target.append(" "); |
375 | | - |
376 | | - // delete the matched sequence |
377 | | - matcher.appendReplacement(left, ""); |
378 | | - } |
379 | | - matcher.appendTail(left); |
380 | | - source = left; |
381 | | - |
382 | | - // obtain the "codebase=<URL>" options |
383 | | - // the syntax of URL is too flexible, and here assumes that the |
384 | | - // URL contains no space, comma(','), and semicolon(';'). That |
385 | | - // also means those characters also could be used as separator |
386 | | - // after codebase option. |
387 | | - // However, the assumption is incorrect in some special situation |
388 | | - // when the URL contains comma or semicolon |
389 | | - keyReg = "[Cc][Oo][Dd][Ee][Bb][Aa][Ss][Ee]="; |
390 | | - keyStr = "codebase="; |
391 | | - reg = keyReg + "[^, ;]*"; |
392 | | - pattern = Pattern.compile(reg); |
393 | | - matcher = pattern.matcher(source); |
394 | | - left = new StringBuilder(); |
395 | | - while (matcher.find()) { |
396 | | - String matched = matcher.group(); |
397 | | - target.append(matched.replaceFirst(keyReg, keyStr)); |
398 | | - target.append(" "); |
399 | | - |
400 | | - // delete the matched sequence |
401 | | - matcher.appendReplacement(left, ""); |
402 | | - } |
403 | | - matcher.appendTail(left); |
404 | | - source = left; |
405 | | - |
406 | | - // convert the rest to lower-case characters |
407 | | - target.append(source.toString().toLowerCase(Locale.ENGLISH)); |
408 | | - |
409 | | - return target.toString(); |
410 | | - } |
411 | | - |
412 | | - return null; |
413 | | - } |
414 | | - |
415 | 350 | public static String toString(byte[] b) { |
416 | 351 | if (b == null) { |
417 | 352 | return "(null)"; |
|
0 commit comments