@Test public void testBuildNewURI_7() throws Exception { String url = "http: String suffix = "./readme.txt"; Assert.assertEquals( new URI( "http: UriUtils.buildNewURI( new URI( url ), suffix )); }
public static URI buildNewURI( URI referenceUri, String uriSuffix ) throws URISyntaxException { if( uriSuffix == null ) throw new IllegalArgumentException( "The URI suffix cannot be null." ); uriSuffix = uriSuffix.replaceAll( "\\\\", "/" ); URI importUri = null; try { importUri = urlToUri( new URL( uriSuffix )); } catch( Exception e ) { try { if( ! referenceUri.toString().endsWith( "/" ) && ! uriSuffix.startsWith( "/" )) referenceUri = new URI( referenceUri.toString() + "/" ); importUri = referenceUri.resolve( new URI( null, uriSuffix, null )); } catch( Exception e2 ) { String msg = "An URI could not be built from the URI " + referenceUri.toString() + " and the suffix " + uriSuffix + "."; throw new URISyntaxException( msg, e2.getMessage()); } } return importUri.normalize(); }
UriUtils { public static URI buildNewURI( URI referenceUri, String uriSuffix ) throws URISyntaxException { if( uriSuffix == null ) throw new IllegalArgumentException( "The URI suffix cannot be null." ); uriSuffix = uriSuffix.replaceAll( "\\\\", "/" ); URI importUri = null; try { importUri = urlToUri( new URL( uriSuffix )); } catch( Exception e ) { try { if( ! referenceUri.toString().endsWith( "/" ) && ! uriSuffix.startsWith( "/" )) referenceUri = new URI( referenceUri.toString() + "/" ); importUri = referenceUri.resolve( new URI( null, uriSuffix, null )); } catch( Exception e2 ) { String msg = "An URI could not be built from the URI " + referenceUri.toString() + " and the suffix " + uriSuffix + "."; throw new URISyntaxException( msg, e2.getMessage()); } } return importUri.normalize(); } }
UriUtils { public static URI buildNewURI( URI referenceUri, String uriSuffix ) throws URISyntaxException { if( uriSuffix == null ) throw new IllegalArgumentException( "The URI suffix cannot be null." ); uriSuffix = uriSuffix.replaceAll( "\\\\", "/" ); URI importUri = null; try { importUri = urlToUri( new URL( uriSuffix )); } catch( Exception e ) { try { if( ! referenceUri.toString().endsWith( "/" ) && ! uriSuffix.startsWith( "/" )) referenceUri = new URI( referenceUri.toString() + "/" ); importUri = referenceUri.resolve( new URI( null, uriSuffix, null )); } catch( Exception e2 ) { String msg = "An URI could not be built from the URI " + referenceUri.toString() + " and the suffix " + uriSuffix + "."; throw new URISyntaxException( msg, e2.getMessage()); } } return importUri.normalize(); } private  UriUtils(); }
UriUtils { public static URI buildNewURI( URI referenceUri, String uriSuffix ) throws URISyntaxException { if( uriSuffix == null ) throw new IllegalArgumentException( "The URI suffix cannot be null." ); uriSuffix = uriSuffix.replaceAll( "\\\\", "/" ); URI importUri = null; try { importUri = urlToUri( new URL( uriSuffix )); } catch( Exception e ) { try { if( ! referenceUri.toString().endsWith( "/" ) && ! uriSuffix.startsWith( "/" )) referenceUri = new URI( referenceUri.toString() + "/" ); importUri = referenceUri.resolve( new URI( null, uriSuffix, null )); } catch( Exception e2 ) { String msg = "An URI could not be built from the URI " + referenceUri.toString() + " and the suffix " + uriSuffix + "."; throw new URISyntaxException( msg, e2.getMessage()); } } return importUri.normalize(); } private  UriUtils(); static URI urlToUri( URL url ); static URI urlToUri( String urlAsString ); static URI buildNewURI( URI referenceUri, String uriSuffix ); }
UriUtils { public static URI buildNewURI( URI referenceUri, String uriSuffix ) throws URISyntaxException { if( uriSuffix == null ) throw new IllegalArgumentException( "The URI suffix cannot be null." ); uriSuffix = uriSuffix.replaceAll( "\\\\", "/" ); URI importUri = null; try { importUri = urlToUri( new URL( uriSuffix )); } catch( Exception e ) { try { if( ! referenceUri.toString().endsWith( "/" ) && ! uriSuffix.startsWith( "/" )) referenceUri = new URI( referenceUri.toString() + "/" ); importUri = referenceUri.resolve( new URI( null, uriSuffix, null )); } catch( Exception e2 ) { String msg = "An URI could not be built from the URI " + referenceUri.toString() + " and the suffix " + uriSuffix + "."; throw new URISyntaxException( msg, e2.getMessage()); } } return importUri.normalize(); } private  UriUtils(); static URI urlToUri( URL url ); static URI urlToUri( String urlAsString ); static URI buildNewURI( URI referenceUri, String uriSuffix );  }