protected String resolveAlias ( final String value ) { final StringBuilder result = new StringBuilder ( value . length ( ) ) ; int i = 0 ; int len = value . length ( ) ; while ( i < len ) { int ndx = value . indexOf ( ' ' , i ) ; if ( ndx == - 1 ) { // alias markers not found if ( i == 0 ) { // try whole string as an alias String alias = lookupAlias ( value ) ; return ( alias != null ? alias : value ) ; } else { result . append ( value . substring ( i ) ) ; } break ; } // alias marked found result . append ( value . substring ( i , ndx ) ) ; ndx ++ ; int ndx2 = value . indexOf ( ' ' , ndx ) ; String aliasName = ( ndx2 == - 1 ? value . substring ( ndx ) : value . substring ( ndx , ndx2 ) ) ; // process alias String alias = lookupAlias ( aliasName ) ; if ( alias != null ) { result . append ( alias ) ; } else { // alias not found if ( log . isWarnEnabled ( ) ) { log . warn ( "Alias not found: " + aliasName ) ; } } i = ndx2 + 1 ; } // fix prefix '//' - may happened when aliases are used i = 0 ; len = result . length ( ) ; while ( i < len ) { if ( result . charAt ( i ) != ' ' ) { break ; } i ++ ; } if ( i > 1 ) { return result . substring ( i - 1 , len ) ; } return result . toString ( ) ; }
Returns resolved alias result value or passed on if alias doesn t exist .