public static URI normalize(final URI uri, final boolean strict) throws NormalizationException {
        if (isNormalized(uri, strict)) {
            return uri;
        }
        return URI.create(toRawString(uri, strict));
    }
public static URI normalize ( final URI uri , final boolean strict ) throws NormalizationException { if ( isNormalized ( uri , strict ) ) { return uri ; } return URI . create ( toRawString ( uri , strict ) ) ; }
Normalizes a java.net.URI using our own getScheme, getHost, getPort, and getPath.  The returned URI will
be constructed such that each of its functions will return the same - i.e.
outUri.getScheme().equals(Uris.getScheme(inUri)).

@param uri the URI to normalize
@param strict whether or not to do strict escaping
@return the normalized URI, or the same URI if the input is already normalized.
@throws NormalizationException if the given URI doesn't meet our stricter restrictions