private static URI createBare ( final URI link ) { final URI uri ; if ( link . getRawQuery ( ) == null && link . getRawFragment ( ) == null ) { uri = link ; } else { final String href = link . toString ( ) ; final int idx ; if ( link . getRawQuery ( ) == null ) { idx = href . indexOf ( ' ' ) ; } else { idx = href . indexOf ( ' ' ) ; } uri = URI . create ( href . substring ( 0 , idx ) ) ; } return uri ; }
Remove query and fragment parts from the provided URI and return the resulting URI .