private void processSpecialSubjects ( ConfigurationAdmin configAdmin , String roleName , Dictionary < String , Object > roleProps , Set < String > pids ) { String [ ] specialSubjectPids = ( String [ ] ) roleProps . get ( CFG_KEY_SPECIAL_SUBJECT ) ; if ( specialSubjectPids == null || specialSubjectPids . length == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "No special subjects in role " + roleName ) ; } } else { Set < String > badSpecialSubjects = new HashSet < String > ( ) ; for ( int i = 0 ; i < specialSubjectPids . length ; i ++ ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "special subject pid " + i + ": " + specialSubjectPids [ i ] ) ; } pids . add ( specialSubjectPids [ i ] ) ; Configuration specialSubjectConfig = null ; try { specialSubjectConfig = configAdmin . getConfiguration ( specialSubjectPids [ i ] , bundleLocation ) ; } catch ( IOException ioe ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Invalid special subject entry " + specialSubjectPids [ i ] ) ; } continue ; } if ( specialSubjectConfig == null || specialSubjectConfig . getProperties ( ) == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Null special subject element" , specialSubjectPids [ i ] ) ; } continue ; } Dictionary < String , Object > specialSubjectProps = specialSubjectConfig . getProperties ( ) ; final String type = ( String ) specialSubjectProps . get ( "type" ) ; if ( type == null || type . trim ( ) . isEmpty ( ) ) { continue ; } if ( badSpecialSubjects . contains ( type ) ) { // This special subject is already flagged as a duplicate continue ; } // TODO: check for invalid type if ( type . trim ( ) . isEmpty ( ) ) { // Empty entry, ignoring continue ; } if ( ! specialSubjects . add ( type ) ) { Tr . error ( tc , "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER" , getRoleName ( ) , CFG_KEY_SPECIAL_SUBJECT , type ) ; badSpecialSubjects . add ( type ) ; specialSubjects . remove ( type ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Role " + roleName + " has special subjects:" , specialSubjects ) ; } } }
Read and process all the specialSubject elements