769 |
private static synchronized URLStreamHandler |
private static synchronized URLStreamHandler |
770 |
getURLStreamHandler (String protocol) |
getURLStreamHandler (String protocol) |
771 |
{ |
{ |
772 |
URLStreamHandler ph; |
URLStreamHandler ph = null; |
773 |
|
|
774 |
// First, see if a protocol handler is in our cache. |
// First, see if a protocol handler is in our cache. |
775 |
if (cache_handlers) |
if (cache_handlers) |
792 |
// If a non-default factory has been set, use it to find the protocol. |
// If a non-default factory has been set, use it to find the protocol. |
793 |
if (factory != null) |
if (factory != null) |
794 |
{ |
{ |
795 |
ph = factory.createURLStreamHandler (protocol); |
ph = factory.createURLStreamHandler (protocol); |
796 |
} |
} |
797 |
|
|
798 |
// Non-default factory may have returned null or a factory wasn't set. |
// Non-default factory may have returned null or a factory wasn't set. |
802 |
// Finally loop through our search path looking for a match. |
// Finally loop through our search path looking for a match. |
803 |
StringTokenizer pkgPrefix = new StringTokenizer (ph_search_path, "|"); |
StringTokenizer pkgPrefix = new StringTokenizer (ph_search_path, "|"); |
804 |
|
|
805 |
while (pkgPrefix.hasMoreTokens()) |
do |
806 |
{ |
{ |
807 |
String clsName = pkgPrefix.nextToken() + "." + protocol + ".Handler"; |
String clsName = pkgPrefix.nextToken() + "." + protocol + ".Handler"; |
808 |
|
|
820 |
// Can't instantiate; handler still null, go on to next element. |
// Can't instantiate; handler still null, go on to next element. |
821 |
} |
} |
822 |
} |
} |
823 |
|
while ((ph == null || |
824 |
|
!(ph instanceof URLStreamHandler)) |
825 |
|
&& pkgPrefix.hasMoreTokens()); |
826 |
} |
} |
827 |
|
|
828 |
// Update the hashtable with the new protocol handler. |
// Update the hashtable with the new protocol handler. |