Skip to content

Commit 5d17a28

Browse files
koushikthirupatturseanjmullan
authored andcommitted
8353001: Remove leftover Security Manager parsing code in sun.security.util.Debug
Reviewed-by: mullan
1 parent 08dd4a7 commit 5d17a28

File tree

2 files changed

+1
-125
lines changed

2 files changed

+1
-125
lines changed

src/java.base/share/classes/sun/security/util/Debug.java

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
import java.time.ZoneId;
3232
import java.time.format.DateTimeFormatter;
3333
import java.util.HexFormat;
34-
import java.util.regex.Pattern;
35-
import java.util.regex.Matcher;
3634
import java.util.Locale;
3735

3836
/**
@@ -65,7 +63,7 @@ public class Debug {
6563
}
6664

6765
if (args != null) {
68-
args = marshal(args);
66+
args = args.toLowerCase(Locale.ENGLISH);
6967
if (args.equals("help")) {
7068
Help();
7169
} else if (args.contains("all")) {
@@ -349,69 +347,6 @@ public static String toHexString(BigInteger b) {
349347
return sb.toString();
350348
}
351349

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-
415350
public static String toString(byte[] b) {
416351
if (b == null) {
417352
return "(null)";

test/jdk/sun/security/util/Debug/MultiOptions.java

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)