commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject cvs commit: jakarta-commons/configuration/src/java/org/apache/commons/configuration ConfigurationUtils.java AbstractFileConfiguration.java
Date Fri, 21 Jan 2005 15:51:33 GMT
oheger      2005/01/21 07:51:33

  Modified:    configuration/src/java/org/apache/commons/configuration
                        ConfigurationUtils.java
                        AbstractFileConfiguration.java
  Log:
  Fix for issue 33185, test for invalid parameters of the save(String) method on unix
  
  Revision  Changes    Path
  1.14      +3 -7      jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationUtils.java
  
  Index: ConfigurationUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationUtils.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ConfigurationUtils.java	4 Dec 2004 15:45:40 -0000	1.13
  +++ ConfigurationUtils.java	21 Jan 2005 15:51:33 -0000	1.14
  @@ -430,7 +430,7 @@
        * 
        * @param basePath the base path
        * @param fileName the file name
  -     * @return the file object
  +     * @return the file object (<b>null</b> if no file can be obtained)
        */
       public static File getFile(String basePath, String fileName)
       {
  @@ -454,11 +454,7 @@
   
           if (url != null)
           {
  -            File result = fileFromURL(url);
  -            if (result != null)
  -            {
  -                return result;
  -            }
  +            return fileFromURL(url);
           }
   
           return constructFile(basePath, fileName);
  
  
  
  1.15      +7 -3      jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java
  
  Index: AbstractFileConfiguration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractFileConfiguration.java	15 Jan 2005 15:29:30 -0000	1.14
  +++ AbstractFileConfiguration.java	21 Jan 2005 15:51:33 -0000	1.15
  @@ -314,8 +314,12 @@
       {
           try
           {
  -            // create a new file
  -            save(ConfigurationUtils.getFile(basePath, fileName));
  +            File file = ConfigurationUtils.getFile(basePath, fileName);
  +            if (file == null)
  +            {
  +                throw new ConfigurationException("Invalid file name for save: " + fileName);
  +            }
  +            save(file);
           }
           catch (ConfigurationException e)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message