tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/modules/storeconfig/src/share/org/apache/catalina/storeconfig StoreFileMover.java
Date Wed, 12 Jan 2005 17:39:55 GMT
remm        2005/01/12 09:39:55

  Modified:    modules/storeconfig/src/share/org/apache/catalina/storeconfig
                        StoreFileMover.java
  Log:
  - Fix problems handling context files which do not exist (which is the default configuration).
  
  Revision  Changes    Path
  1.2       +13 -4     jakarta-tomcat-catalina/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreFileMover.java
  
  Index: StoreFileMover.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreFileMover.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StoreFileMover.java	8 Jan 2005 11:14:07 -0000	1.1
  +++ StoreFileMover.java	12 Jan 2005 17:39:55 -0000	1.2
  @@ -137,6 +137,9 @@
           if (!configNew.isAbsolute()) {
               configNew = new File(getBasename(), configFile + ".new");
           }
  +        if (!configNew.getParentFile().exists()) {
  +            configNew.getParentFile().mkdirs();
  +        }
           String sb = getTimeTag();
           configSave = new File(configFile + sb);
           if (!configSave.isAbsolute()) {
  @@ -151,18 +154,24 @@
        */
       public void move() throws IOException {
           if (configOld.renameTo(configSave)) {
  -            if (configNew.renameTo(configOld)) {
  -                return;
  -            } else {
  +            if (!configNew.renameTo(configOld)) {
                   configSave.renameTo(configOld);
                   throw new IOException("Cannot rename "
                           + configNew.getAbsolutePath() + " to "
                           + configOld.getAbsolutePath());
               }
           } else {
  -            throw new IOException("Cannot rename "
  +            if (!configOld.exists()) {
  +                if (!configNew.renameTo(configOld)) {
  +                    throw new IOException("Cannot move "
  +                            + configNew.getAbsolutePath() + " to "
  +                            + configOld.getAbsolutePath());
  +                }
  +            } else {
  +                throw new IOException("Cannot rename "
                       + configOld.getAbsolutePath() + " to "
                       + configSave.getAbsolutePath());
  +            }
           }
       }
   
  
  
  

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


Mime
View raw message