/[classpath]/classpath/java/net/URL.java
ViewVC logotype

Diff of /classpath/java/net/URL.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by mkoch, Sat Sep 27 13:13:02 2003 UTC revision 1.20 by mkoch, Mon Sep 29 08:36:28 2003 UTC
# Line 119  import java.util.StringTokenizer; Line 119  import java.util.StringTokenizer;
119    */    */
120  public final class URL implements Serializable  public final class URL implements Serializable
121  {  {
122      private static final String DEFAULT_SEARCH_PATH = "gnu.java.net.protocol";
123      
124    /**    /**
125     * The name of the protocol for this URL.     * The name of the protocol for this URL.
126     * The protocol is always stored in lower case.     * The protocol is always stored in lower case.
# Line 188  public final class URL implements Serial Line 190  public final class URL implements Serial
190    
191    static    static
192      {      {
193        String s = System.getProperty("gnu.java.net.nocache_protocol_handlers");        String s = System.getProperty ("gnu.java.net.nocache_protocol_handlers");
194          
195        if (s == null)        if (s == null)
196          cache_handlers = true;          cache_handlers = true;
197        else        else
198          cache_handlers = false;          cache_handlers = false;
199    
200        ph_search_path = System.getProperty("java.protocol.handler.pkgs");        ph_search_path = System.getProperty ("java.protocol.handler.pkgs");
201    
202        // Tack our default package on at the ends        // Tack our default package on at the ends
203        if (ph_search_path != null)        if (ph_search_path != null)
204          ph_search_path = ph_search_path + "|" + "gnu.java.net.protocol";          ph_search_path = ph_search_path + "|" + DEFAULT_SEARCH_PATH;
205        else        else
206          ph_search_path = "gnu.java.net.protocol";          ph_search_path = DEFAULT_SEARCH_PATH;
207      }      }
208    
209    /**    /**
# Line 774  public final class URL implements Serial Line 777  public final class URL implements Serial
777      // First, see if a protocol handler is in our cache.      // First, see if a protocol handler is in our cache.
778      if (cache_handlers)      if (cache_handlers)
779        {        {
780          Class cls = (Class) ph_cache.get (protocol);          if ((ph = (URLStreamHandler) ph_cache.get (protocol)) != null)
781                      return ph;
         if (cls != null)  
           {  
             try  
               {  
                 return (URLStreamHandler) cls.newInstance();  
               }  
             catch (Exception e)  
               {  
                 // Can't instantiate; handler still null.  
               }  
           }  
782        }        }
783    
784      // 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.
# Line 829  public final class URL implements Serial Line 821  public final class URL implements Serial
821      if (ph != null      if (ph != null
822          && cache_handlers)          && cache_handlers)
823        if (ph instanceof URLStreamHandler)        if (ph instanceof URLStreamHandler)
824          ph_cache.put (protocol, ph.getClass());          ph_cache.put (protocol, ph);
825        else        else
826          ph = null;          ph = null;
827    

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26