private URL checkURL(URL url){
  String protocol=url.getProtocol();
  if (protocol == null) {
    throw new RepositoryException(repositoryName,"unknown url protocol from URL [" + url + "]");
  }
  for (  String supportedProtocol : supportedProtocols) {
    if (supportedProtocol.equals(protocol)) {
      try {
        if (URIPattern.match(urlWhiteList,url.toURI())) {
          return url;
        }
      }
 catch (      URISyntaxException ex) {
        logger.warn("cannot parse the specified url [{}]",url);
        throw new RepositoryException(repositoryName,"cannot parse the specified url [" + url + "]");
      }
      URL normalizedUrl=environment.resolveRepoURL(url);
      if (normalizedUrl == null) {
        logger.warn("The specified url [{}] doesn't start with any repository paths specified by the path.repo setting: [{}] or by repositories.url.allowed_urls setting: [{}] ",url,environment.repoFiles());
        throw new RepositoryException(repositoryName,"file url [" + url + "] doesn't match any of the locations specified by path.repo or repositories.url.allowed_urls");
      }
      return normalizedUrl;
    }
  }
  throw new RepositoryException(repositoryName,"unsupported url protocol [" + protocol + "] from URL ["+ url+ "]");
}

private URL checkURL ( URL url ) { String protocol = url . getProtocol ( ) ; if ( protocol == null ) { throw new RepositoryException ( repositoryName , "unknown url protocol from URL [" + url + "]" ) ; } for ( String supportedProtocol : supportedProtocols ) { if ( supportedProtocol . equals ( protocol ) ) { try { if ( URIPattern . match ( urlWhiteList , url . toURI ( ) ) ) { return url ; } } catch ( URISyntaxException ex ) { logger . warn ( "cannot parse the specified url [{}]" , url ) ; throw new RepositoryException ( repositoryName , "cannot parse the specified url [" + url + "]" ) ; } URL normalizedUrl = environment . resolveRepoURL ( url ) ; if ( normalizedUrl == null ) { logger . warn ( "The specified url [{}] doesn't start with any repository paths specified by the path.repo setting: [{}] or by repositories.url.allowed_urls setting: [{}] " , url , environment . repoFiles ( ) ) ; throw new RepositoryException ( repositoryName , "file url [" + url + "] doesn't match any of the locations specified by path.repo or repositories.url.allowed_urls" ) ; } return normalizedUrl ; } } throw new RepositoryException ( repositoryName , "unsupported url protocol [" + protocol + "] from URL [" + url + "]" ) ; }
makes sure that the url is white listed or if it points to the local file system it matches one on of the root path in path . repo
