private static URL[] pathToURLs(String path) throws MalformedURLException {
synchronized (pathToURLsCache) {
    Object[] v=(Object[])pathToURLsCache.get(path);
    if (v != null) {
      return (URL[])v[0];
    }
  }
  StringTokenizer st=new StringTokenizer(path);
  URL[] urls=new URL[st.countTokens()];
  for (int i=0; st.hasMoreTokens(); i++) {
    urls[i]=new URL(st.nextToken());
  }
synchronized (pathToURLsCache) {
    pathToURLsCache.put(path,new Object[]{urls,new SoftReference(path)});
  }
  return urls;
}

private static URL [ ] pathToURLs ( String path ) throws MalformedURLException { synchronized ( pathToURLsCache ) { Object [ ] v = ( Object [ ] ) pathToURLsCache . get ( path ) ; if ( v != null ) { return ( URL [ ] ) v [ 0 ] ; } } StringTokenizer st = new StringTokenizer ( path ) ; URL [ ] urls = new URL [ st . countTokens ( ) ] ; for ( int i = 0 ; st . hasMoreTokens ( ) ; i ++ ) { urls [ i ] = new URL ( st . nextToken ( ) ) ; } synchronized ( pathToURLsCache ) { pathToURLsCache . put ( path , new Object [ ] { urls , new SoftReference ( path ) } ) ; } return urls ; }
convert a string containing a space - separated list of urls into a corresponding array of url objects , throwing a malformedurlexception if any of the urls are invalid .
