23
23
24
24
/*
25
25
* @test
26
- * @bug 5097015 8130181 8279222
26
+ * @bug 5097015 8130181 8279222 8292739
27
27
* @summary make sure we correctly treat Provider string entries as case insensitive
28
28
* @author Andreas Sterbenz
29
29
*/
@@ -42,15 +42,23 @@ public class CaseSensitiveServices extends Provider {
42
42
put ("MESSAGEDIGEST.BAZ" , "com.Baz" );
43
43
// reassign the DEF alias to algorithm Bar
44
44
put ("ALg.aliaS.MESSAGEdigest.DEF" , "Bar" );
45
+ // invalid entry since it misses the corresponding impl class info
46
+ // e.g. put("MessageDigest.Invalid", "implClass");
47
+ put ("MessageDigest.Invalid xYz" , "aBc" );
45
48
}
46
49
47
50
public static void main (String [] args ) throws Exception {
48
51
Provider p = new CaseSensitiveServices ();
49
- System .out .println (p .getServices ());
52
+
53
+ System .out .println ("Services: " + p .getServices ());
54
+
50
55
if (p .getServices ().size () != 3 ) {
51
56
throw new Exception ("services.size() should be 3" );
52
57
}
53
58
59
+ if (p .getService ("MessageDigest" , "Invalid" ) != null ) {
60
+ throw new Exception ("Invalid service returned" );
61
+ }
54
62
Service s = testService (p , "MessageDigest" , "fOO" );
55
63
String val = s .getAttribute ("Xyz" );
56
64
if ("aBc" .equals (val ) == false ) {
@@ -70,7 +78,8 @@ public static void main(String[] args) throws Exception {
70
78
System .out .println ("OK" );
71
79
}
72
80
73
- private static Service testService (Provider p , String type , String alg ) throws Exception {
81
+ private static Service testService (Provider p , String type , String alg )
82
+ throws Exception {
74
83
System .out .println ("Getting " + type + "." + alg + "..." );
75
84
Service s = p .getService (type , alg );
76
85
System .out .println (s );
0 commit comments