public static void insertProviderAt ( Provider newProvider , int slot ) { Provider [ ] provider_list = Security . getProviders ( ) ; if ( null == provider_list || 0 == provider_list . length ) { return ; } // add the new provider to the new list at the correct slot #. Provider [ ] newList = new Provider [ provider_list . length + 2 ] ; newList [ slot ] = newProvider ; int newListIndex = 1 ; // add the rest of the providers for ( int i = 0 ; i < provider_list . length ; i ++ ) { Provider currentProvider = provider_list [ i ] ; if ( currentProvider != null && ! currentProvider . getName ( ) . equals ( newProvider . getName ( ) ) ) { // keep incrementing until we find the first available slot. while ( newList [ newListIndex ] != null ) { newListIndex ++ ; } newList [ newListIndex ] = currentProvider ; newListIndex ++ ; } } removeAllProviders ( ) ; // add the rest of the providers to the list. for ( int i = 0 ; i < newList . length ; i ++ ) { Provider currentProvider = newList [ i ] ; if ( currentProvider != null ) { int position = Security . insertProviderAt ( currentProvider , ( i + 1 ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , currentProvider . getName ( ) + " provider added at position " + position ) ; } } }
Insert a provider into Security at the provided slot number .