@@ -345,12 +345,6 @@ public String toString() {
345345 return name + " version " + versionStr ;
346346 }
347347
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-
354348 /**
355349 * Clears this {@code Provider} so that it no longer contains the properties
356350 * used to look up facilities implemented by the {@code Provider}.
@@ -359,7 +353,7 @@ public String toString() {
359353 */
360354 @ Override
361355 public synchronized void clear () {
362- check ( "clearProviderProperties." + name );
356+ checkInitialized ( );
363357 if (debug != null ) {
364358 debug .println ("Remove " + name + " provider properties" );
365359 }
@@ -376,7 +370,7 @@ public synchronized void clear() {
376370 */
377371 @ Override
378372 public synchronized void load (InputStream inStream ) throws IOException {
379- check ( "putProviderProperty." + name );
373+ checkInitialized ( );
380374 if (debug != null ) {
381375 debug .println ("Load " + name + " provider properties" );
382376 }
@@ -394,7 +388,7 @@ public synchronized void load(InputStream inStream) throws IOException {
394388 */
395389 @ Override
396390 public synchronized void putAll (Map <?,?> t ) {
397- check ( "putProviderProperty." + name );
391+ checkInitialized ( );
398392 if (debug != null ) {
399393 debug .println ("Put all " + name + " provider properties" );
400394 }
@@ -461,7 +455,7 @@ public Collection<Object> values() {
461455 */
462456 @ Override
463457 public synchronized Object put (Object key , Object value ) {
464- check ( "putProviderProperty." + name );
458+ checkInitialized ( );
465459 if (debug != null ) {
466460 debug .println ("Set " + name + " provider property [" +
467461 key + "/" + value +"]" );
@@ -478,7 +472,7 @@ public synchronized Object put(Object key, Object value) {
478472 */
479473 @ Override
480474 public synchronized Object putIfAbsent (Object key , Object value ) {
481- check ( "putProviderProperty." + name );
475+ checkInitialized ( );
482476 if (debug != null ) {
483477 debug .println ("Set " + name + " provider property [" +
484478 key + "/" + value +"]" );
@@ -494,7 +488,7 @@ public synchronized Object putIfAbsent(Object key, Object value) {
494488 */
495489 @ Override
496490 public synchronized Object remove (Object key ) {
497- check ( "removeProviderProperty." + name );
491+ checkInitialized ( );
498492 if (debug != null ) {
499493 debug .println ("Remove " + name + " provider property " + key );
500494 }
@@ -509,7 +503,7 @@ public synchronized Object remove(Object key) {
509503 */
510504 @ Override
511505 public synchronized boolean remove (Object key , Object value ) {
512- check ( "removeProviderProperty." + name );
506+ checkInitialized ( );
513507 if (debug != null ) {
514508 debug .println ("Remove " + name + " provider property " + key );
515509 }
@@ -525,7 +519,7 @@ public synchronized boolean remove(Object key, Object value) {
525519 @ Override
526520 public synchronized boolean replace (Object key , Object oldValue ,
527521 Object newValue ) {
528- check ( "putProviderProperty." + name );
522+ checkInitialized ( );
529523 if (debug != null ) {
530524 debug .println ("Replace " + name + " provider property " + key );
531525 }
@@ -540,7 +534,7 @@ public synchronized boolean replace(Object key, Object oldValue,
540534 */
541535 @ Override
542536 public synchronized Object replace (Object key , Object value ) {
543- check ( "putProviderProperty." + name );
537+ checkInitialized ( );
544538 if (debug != null ) {
545539 debug .println ("Replace " + name + " provider property " + key );
546540 }
@@ -558,7 +552,7 @@ public synchronized Object replace(Object key, Object value) {
558552 @ Override
559553 public synchronized void replaceAll (BiFunction <? super Object ,
560554 ? super Object , ? extends Object > function ) {
561- check ( "putProviderProperty." + name );
555+ checkInitialized ( );
562556 if (debug != null ) {
563557 debug .println ("ReplaceAll " + name + " provider property " );
564558 }
@@ -575,8 +569,7 @@ public synchronized void replaceAll(BiFunction<? super Object,
575569 @ Override
576570 public synchronized Object compute (Object key , BiFunction <? super Object ,
577571 ? super Object , ? extends Object > remappingFunction ) {
578- check ("putProviderProperty." + name );
579- check ("removeProviderProperty." + name );
572+ checkInitialized ();
580573 if (debug != null ) {
581574 debug .println ("Compute " + name + " provider property " + key );
582575 }
@@ -594,8 +587,7 @@ public synchronized Object compute(Object key, BiFunction<? super Object,
594587 @ Override
595588 public synchronized Object computeIfAbsent (Object key ,
596589 Function <? super Object , ? extends Object > mappingFunction ) {
597- check ("putProviderProperty." + name );
598- check ("removeProviderProperty." + name );
590+ checkInitialized ();
599591 if (debug != null ) {
600592 debug .println ("ComputeIfAbsent " + name + " provider property " +
601593 key );
@@ -613,8 +605,7 @@ public synchronized Object computeIfAbsent(Object key,
613605 public synchronized Object computeIfPresent (Object key ,
614606 BiFunction <? super Object , ? super Object , ? extends Object >
615607 remappingFunction ) {
616- check ("putProviderProperty." + name );
617- check ("removeProviderProperty." + name );
608+ checkInitialized ();
618609 if (debug != null ) {
619610 debug .println ("ComputeIfPresent " + name + " provider property " +
620611 key );
@@ -635,8 +626,7 @@ public synchronized Object computeIfPresent(Object key,
635626 public synchronized Object merge (Object key , Object value ,
636627 BiFunction <? super Object , ? super Object , ? extends Object >
637628 remappingFunction ) {
638- check ("putProviderProperty." + name );
639- check ("removeProviderProperty." + name );
629+ checkInitialized ();
640630 if (debug != null ) {
641631 debug .println ("Merge " + name + " provider property " + key );
642632 }
@@ -694,15 +684,6 @@ private void checkInitialized() {
694684 }
695685 }
696686
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-
706687 // legacyMap changed since last call to getServices()
707688 private transient volatile boolean legacyChanged ;
708689 // serviceMap changed since last call to getServices()
@@ -789,8 +770,6 @@ private static boolean checkLegacy(Object key) {
789770
790771 /**
791772 * 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.
794773 */
795774 private void implPutAll (Map <?,?> t ) {
796775 for (Map .Entry <?,?> e : t .entrySet ()) {
@@ -1239,7 +1218,7 @@ public Set<Service> getServices() {
12391218 * @since 1.5
12401219 */
12411220 protected void putService (Service s ) {
1242- check ( "putProviderProperty." + name );
1221+ checkInitialized ( );
12431222 if (debug != null ) {
12441223 debug .println (name + ".putService(): " + s );
12451224 }
@@ -1303,7 +1282,7 @@ Service getDefaultSecureRandomService() {
13031282 private void putPropertyStrings (Service s ) {
13041283 String type = s .getType ();
13051284 String algorithm = s .getAlgorithm ();
1306- // use super() to avoid permission check and other processing
1285+ // use super() to avoid other processing
13071286 super .put (type + "." + algorithm , s .getClassName ());
13081287 for (String alias : s .getAliases ()) {
13091288 super .put (ALIAS_PREFIX + type + "." + alias , algorithm );
@@ -1321,7 +1300,7 @@ private void putPropertyStrings(Service s) {
13211300 private void removePropertyStrings (Service s ) {
13221301 String type = s .getType ();
13231302 String algorithm = s .getAlgorithm ();
1324- // use super() to avoid permission check and other processing
1303+ // use super() to avoid other processing
13251304 super .remove (type + "." + algorithm );
13261305 for (String alias : s .getAliases ()) {
13271306 super .remove (ALIAS_PREFIX + type + "." + alias );
@@ -1346,7 +1325,7 @@ private void removePropertyStrings(Service s) {
13461325 * @since 1.5
13471326 */
13481327 protected void removeService (Service s ) {
1349- check ( "removeProviderProperty." + name );
1328+ checkInitialized ( );
13501329 if (debug != null ) {
13511330 debug .println (name + ".removeService(): " + s );
13521331 }
0 commit comments