class UriUtils {

    public static URI extendUriWithQuery(URI u, String... keyValues) {
        String query = u.getQuery();
        if (query != null && !query.isEmpty()) {
            query += URI_QUERY_PARAM_LINK_CHAR_CONST + buildUriQuery(keyValues);
        } else {
            query = buildUriQuery(keyValues);
        }

        try {
            return new URI(u.getScheme(), null, u.getHost(),
                    u.getPort(), u.getPath(), query, null);
        } catch (URISyntaxException e) {
            Utils.log(UriUtils.class, Utils.class.getSimpleName(), Level.SEVERE, "%s",
                    Utils.toString(e));
        }
        return null;
    }

    private  UriUtils();

}