protected boolean setKey ( String uri , int line , int col , boolean encode ) { if ( key == null ) { key = new DocumentURIWithSourceInfo ( uri , srcId ) ; } // apply prefix, suffix and replace for URI if ( uri != null && ! uri . isEmpty ( ) ) { uri = URIUtil . applyUriReplace ( uri , conf ) ; key . setSkipReason ( "" ) ; if ( encode ) { try { URI uriObj = new URI ( null , null , null , 0 , uri , null , null ) ; uri = uriObj . toString ( ) ; } catch ( URISyntaxException e ) { uri = null ; key . setSkipReason ( e . getMessage ( ) ) ; } } uri = URIUtil . applyPrefixSuffix ( uri , conf ) ; } else { key . setSkipReason ( "empty uri value" ) ; } key . setUri ( uri ) ; key . setSrcId ( srcId ) ; key . setSubId ( subId ) ; key . setColNumber ( col ) ; key . setLineNumber ( line ) ; if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "Set key: " + key ) ; } return key . isSkip ( ) ; }
Apply URI replace option encode URI if specified apply URI prefix and suffix configuration options and set the result as DocumentURI key .