@@ -345,12 +345,6 @@ public String toString() {
345
345
return name + " version " + versionStr ;
346
346
}
347
347
348
- /*
349
- * override the following methods to ensure that provider
350
- * information can only be changed if the caller has the appropriate
351
- * permissions.
352
- */
353
-
354
348
/**
355
349
* Clears this {@code Provider} so that it no longer contains the properties
356
350
* used to look up facilities implemented by the {@code Provider}.
@@ -359,7 +353,7 @@ public String toString() {
359
353
*/
360
354
@ Override
361
355
public synchronized void clear () {
362
- check ( "clearProviderProperties." + name );
356
+ checkInitialized ( );
363
357
if (debug != null ) {
364
358
debug .println ("Remove " + name + " provider properties" );
365
359
}
@@ -376,7 +370,7 @@ public synchronized void clear() {
376
370
*/
377
371
@ Override
378
372
public synchronized void load (InputStream inStream ) throws IOException {
379
- check ( "putProviderProperty." + name );
373
+ checkInitialized ( );
380
374
if (debug != null ) {
381
375
debug .println ("Load " + name + " provider properties" );
382
376
}
@@ -394,7 +388,7 @@ public synchronized void load(InputStream inStream) throws IOException {
394
388
*/
395
389
@ Override
396
390
public synchronized void putAll (Map <?,?> t ) {
397
- check ( "putProviderProperty." + name );
391
+ checkInitialized ( );
398
392
if (debug != null ) {
399
393
debug .println ("Put all " + name + " provider properties" );
400
394
}
@@ -461,7 +455,7 @@ public Collection<Object> values() {
461
455
*/
462
456
@ Override
463
457
public synchronized Object put (Object key , Object value ) {
464
- check ( "putProviderProperty." + name );
458
+ checkInitialized ( );
465
459
if (debug != null ) {
466
460
debug .println ("Set " + name + " provider property [" +
467
461
key + "/" + value +"]" );
@@ -478,7 +472,7 @@ public synchronized Object put(Object key, Object value) {
478
472
*/
479
473
@ Override
480
474
public synchronized Object putIfAbsent (Object key , Object value ) {
481
- check ( "putProviderProperty." + name );
475
+ checkInitialized ( );
482
476
if (debug != null ) {
483
477
debug .println ("Set " + name + " provider property [" +
484
478
key + "/" + value +"]" );
@@ -494,7 +488,7 @@ public synchronized Object putIfAbsent(Object key, Object value) {
494
488
*/
495
489
@ Override
496
490
public synchronized Object remove (Object key ) {
497
- check ( "removeProviderProperty." + name );
491
+ checkInitialized ( );
498
492
if (debug != null ) {
499
493
debug .println ("Remove " + name + " provider property " + key );
500
494
}
@@ -509,7 +503,7 @@ public synchronized Object remove(Object key) {
509
503
*/
510
504
@ Override
511
505
public synchronized boolean remove (Object key , Object value ) {
512
- check ( "removeProviderProperty." + name );
506
+ checkInitialized ( );
513
507
if (debug != null ) {
514
508
debug .println ("Remove " + name + " provider property " + key );
515
509
}
@@ -525,7 +519,7 @@ public synchronized boolean remove(Object key, Object value) {
525
519
@ Override
526
520
public synchronized boolean replace (Object key , Object oldValue ,
527
521
Object newValue ) {
528
- check ( "putProviderProperty." + name );
522
+ checkInitialized ( );
529
523
if (debug != null ) {
530
524
debug .println ("Replace " + name + " provider property " + key );
531
525
}
@@ -540,7 +534,7 @@ public synchronized boolean replace(Object key, Object oldValue,
540
534
*/
541
535
@ Override
542
536
public synchronized Object replace (Object key , Object value ) {
543
- check ( "putProviderProperty." + name );
537
+ checkInitialized ( );
544
538
if (debug != null ) {
545
539
debug .println ("Replace " + name + " provider property " + key );
546
540
}
@@ -558,7 +552,7 @@ public synchronized Object replace(Object key, Object value) {
558
552
@ Override
559
553
public synchronized void replaceAll (BiFunction <? super Object ,
560
554
? super Object , ? extends Object > function ) {
561
- check ( "putProviderProperty." + name );
555
+ checkInitialized ( );
562
556
if (debug != null ) {
563
557
debug .println ("ReplaceAll " + name + " provider property " );
564
558
}
@@ -575,8 +569,7 @@ public synchronized void replaceAll(BiFunction<? super Object,
575
569
@ Override
576
570
public synchronized Object compute (Object key , BiFunction <? super Object ,
577
571
? super Object , ? extends Object > remappingFunction ) {
578
- check ("putProviderProperty." + name );
579
- check ("removeProviderProperty." + name );
572
+ checkInitialized ();
580
573
if (debug != null ) {
581
574
debug .println ("Compute " + name + " provider property " + key );
582
575
}
@@ -594,8 +587,7 @@ public synchronized Object compute(Object key, BiFunction<? super Object,
594
587
@ Override
595
588
public synchronized Object computeIfAbsent (Object key ,
596
589
Function <? super Object , ? extends Object > mappingFunction ) {
597
- check ("putProviderProperty." + name );
598
- check ("removeProviderProperty." + name );
590
+ checkInitialized ();
599
591
if (debug != null ) {
600
592
debug .println ("ComputeIfAbsent " + name + " provider property " +
601
593
key );
@@ -613,8 +605,7 @@ public synchronized Object computeIfAbsent(Object key,
613
605
public synchronized Object computeIfPresent (Object key ,
614
606
BiFunction <? super Object , ? super Object , ? extends Object >
615
607
remappingFunction ) {
616
- check ("putProviderProperty." + name );
617
- check ("removeProviderProperty." + name );
608
+ checkInitialized ();
618
609
if (debug != null ) {
619
610
debug .println ("ComputeIfPresent " + name + " provider property " +
620
611
key );
@@ -635,8 +626,7 @@ public synchronized Object computeIfPresent(Object key,
635
626
public synchronized Object merge (Object key , Object value ,
636
627
BiFunction <? super Object , ? super Object , ? extends Object >
637
628
remappingFunction ) {
638
- check ("putProviderProperty." + name );
639
- check ("removeProviderProperty." + name );
629
+ checkInitialized ();
640
630
if (debug != null ) {
641
631
debug .println ("Merge " + name + " provider property " + key );
642
632
}
@@ -694,15 +684,6 @@ private void checkInitialized() {
694
684
}
695
685
}
696
686
697
- private void check (String directive ) {
698
- checkInitialized ();
699
- @ SuppressWarnings ("removal" )
700
- SecurityManager security = System .getSecurityManager ();
701
- if (security != null ) {
702
- security .checkSecurityAccess (directive );
703
- }
704
- }
705
-
706
687
// legacyMap changed since last call to getServices()
707
688
private transient volatile boolean legacyChanged ;
708
689
// serviceMap changed since last call to getServices()
@@ -789,8 +770,6 @@ private static boolean checkLegacy(Object key) {
789
770
790
771
/**
791
772
* Copies all the mappings from the specified Map to this provider.
792
- * Internal method to be called AFTER the security check has been
793
- * performed.
794
773
*/
795
774
private void implPutAll (Map <?,?> t ) {
796
775
for (Map .Entry <?,?> e : t .entrySet ()) {
@@ -1239,7 +1218,7 @@ public Set<Service> getServices() {
1239
1218
* @since 1.5
1240
1219
*/
1241
1220
protected void putService (Service s ) {
1242
- check ( "putProviderProperty." + name );
1221
+ checkInitialized ( );
1243
1222
if (debug != null ) {
1244
1223
debug .println (name + ".putService(): " + s );
1245
1224
}
@@ -1303,7 +1282,7 @@ Service getDefaultSecureRandomService() {
1303
1282
private void putPropertyStrings (Service s ) {
1304
1283
String type = s .getType ();
1305
1284
String algorithm = s .getAlgorithm ();
1306
- // use super() to avoid permission check and other processing
1285
+ // use super() to avoid other processing
1307
1286
super .put (type + "." + algorithm , s .getClassName ());
1308
1287
for (String alias : s .getAliases ()) {
1309
1288
super .put (ALIAS_PREFIX + type + "." + alias , algorithm );
@@ -1321,7 +1300,7 @@ private void putPropertyStrings(Service s) {
1321
1300
private void removePropertyStrings (Service s ) {
1322
1301
String type = s .getType ();
1323
1302
String algorithm = s .getAlgorithm ();
1324
- // use super() to avoid permission check and other processing
1303
+ // use super() to avoid other processing
1325
1304
super .remove (type + "." + algorithm );
1326
1305
for (String alias : s .getAliases ()) {
1327
1306
super .remove (ALIAS_PREFIX + type + "." + alias );
@@ -1346,7 +1325,7 @@ private void removePropertyStrings(Service s) {
1346
1325
* @since 1.5
1347
1326
*/
1348
1327
protected void removeService (Service s ) {
1349
- check ( "removeProviderProperty." + name );
1328
+ checkInitialized ( );
1350
1329
if (debug != null ) {
1351
1330
debug .println (name + ".removeService(): " + s );
1352
1331
}
0 commit comments