question: private boolean initializeAuthority ( String p_uriSpec ) { int index = 0 ; int start = 0 ; int end = p_uriSpec . length ( ) ; char testChar = '\0' ; String userinfo = null ; if ( p_uriSpec . indexOf ( '@' , start ) != - 1 ) { while ( index < end ) { testChar = p_uriSpec . charAt ( index ) ; if ( testChar == '@' ) { break ; } index ++ ; } userinfo = p_uriSpec . substring ( start , index ) ; index ++ ; } String host = null ; start = index ; boolean hasPort = false ; if ( index < end ) { if ( p_uriSpec . charAt ( start ) == '[' ) { int bracketIndex = p_uriSpec . indexOf ( ']' , start ) ; index = ( bracketIndex != - 1 ) ? bracketIndex : end ; if ( index + 1 < end && p_uriSpec . charAt ( index + 1 ) == ':' ) { ++ index ; hasPort = true ; } else { index = end ; } } else { int colonIndex = p_uriSpec . lastIndexOf ( ':' , end ) ; index = ( colonIndex > start ) ? colonIndex : end ; hasPort = ( index != end ) ; } } host = p_uriSpec . substring ( start , index ) ; int port = - 1 ; if ( host . length ( ) > 0 ) { if ( hasPort ) { index ++ ; start = index ; while ( index < end ) { index ++ ; } String portStr = p_uriSpec . substring ( start , index ) ; if ( portStr . length ( ) > 0 ) { try { port = Integer . parseInt ( portStr ) ; if ( port == - 1 ) -- port ; } catch ( NumberFormatException nfe ) { port = - 2 ; } } } } if ( isValidServerBasedAuthority ( host , port , userinfo ) ) { m_host = host ; m_port = port ; m_userinfo = userinfo ; return true ; } else if ( isValidRegistryBasedAuthority ( p_uriSpec ) ) { m_regAuthority = p_uriSpec ; return true ; } return false ; }
target:  Initialize the authority (either server or registry based) for this URI from a URI string spec.