private void adjustReplicationFactorForURI ( HttpPut httpPut ) throws URISyntaxException { String queryString = httpPut . getURI ( ) . getQuery ( ) ; if ( ! StringUtils . isEmpty ( queryString ) && queryString . contains ( "op=CREATE" ) && ( queryString . contains ( "replication=" ) || ! StringUtils . isEmpty ( m_blockReplication ) ) ) { rateLimitedLogWarn ( m_logger , "Set block replication factor in the target system." ) ; if ( ! StringUtils . isEmpty ( m_blockReplication ) && ! queryString . contains ( "replication=" ) ) { StringBuilder builder = new StringBuilder ( 128 ) ; builder . append ( queryString ) . append ( "&replication=" ) . append ( m_blockReplication ) ; URI oldUri = httpPut . getURI ( ) ; URI newUri = new URI ( oldUri . getScheme ( ) , oldUri . getAuthority ( ) , oldUri . getPath ( ) , builder . toString ( ) , oldUri . getFragment ( ) ) ; httpPut . setURI ( newUri ) ; } } }
append replication factor to the URI for CREATE operation if the factor is not in URI