/[classpath]/classpath/java/util/Properties.java
ViewVC logotype

Diff of /classpath/java/util/Properties.java

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

revision 1.31 by rabbit78, Tue Jul 26 14:25:37 2005 UTC revision 1.32 by rabbit78, Wed Jul 27 10:42:40 2005 UTC
# Line 398  label   = Name:\\u0020</pre> Line 398  label   = Name:\\u0020</pre>
398    
399      writer.flush ();      writer.flush ();
400    }    }
     
   /**  
    *  Internal method called by getProperty() methods. This avoids  
    *  recursive calls if getProperty() methods are overwritten in  
    *  a subclass.  
    *  
    * @param key the key for the property to fetch  
    * @param defaultValue the defaultValue or <code>null</code> if there  
    *        is no default value  
    */  
   private String getPropertyInternal(String key, String defaultValue)  
   {  
     Properties prop = this;  
     // Eliminate tail recursion.  
     do  
       {  
         String value = (String) prop.get(key);  
         if (value != null)  
           return value;  
         prop = prop.defaults;  
       }  
     while (prop != null);  
     return defaultValue;      
   }  
401    
402    /**    /**
403     * Gets the property with the specified key in this property list.     * Gets the property with the specified key in this property list.
# Line 438  label   = Name:\\u0020</pre> Line 414  label   = Name:\\u0020</pre>
414     */     */
415    public String getProperty(String key)    public String getProperty(String key)
416    {    {
417      return getPropertyInternal(key, null);      Properties prop = this;
418        // Eliminate tail recursion.
419        do
420          {
421            String value = (String) prop.get(key);
422            if (value != null)
423              return value;
424            prop = prop.defaults;
425          }
426        while (prop != null);
427        return null;
428    }    }
429    
430    /**    /**
# Line 457  label   = Name:\\u0020</pre> Line 443  label   = Name:\\u0020</pre>
443     */     */
444    public String getProperty(String key, String defaultValue)    public String getProperty(String key, String defaultValue)
445    {    {
446      return getPropertyInternal(key, defaultValue);      String prop = getProperty(key);
447        if (prop == null)
448          prop = defaultValue;
449        return prop;
450    }    }
451    
452    /**    /**

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

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