donaldp     02/04/18 02:14:08

  Modified:    src/java/org/apache/log/output/io/rotate
                        RevolvingFileStrategy.java
               src/test/org/apache/log/output/test
                        RevolvingFileStrategyTestCase.java
  Log:
  Fixed so that when max rotations are reached the oldest fill is culled rather 
than the youngest.
  
  Submitted by: [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.8       +5 -5      
jakarta-avalon-logkit/src/java/org/apache/log/output/io/rotate/RevolvingFileStrategy.java
  
  Index: RevolvingFileStrategy.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-logkit/src/java/org/apache/log/output/io/rotate/RevolvingFileStrategy.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RevolvingFileStrategy.java        2 Apr 2002 08:36:05 -0000       1.7
  +++ RevolvingFileStrategy.java        18 Apr 2002 09:14:08 -0000      1.8
  @@ -145,20 +145,20 @@
           //Okay now we need to calculate the youngest file for our rotation
           long time = matchingFiles[ 0 ].lastModified();
   
  -        //index of youngest file
  -        int youngest = 0;
  +        //index of oldest file
  +        int oldest = 0;
           for( int i = 0; i < matchingFiles.length; i++ )
           {
               final File file = matchingFiles[ i ];
               final long lastModified = file.lastModified();
  -            if( lastModified > time )
  +            if( lastModified < time )
               {
                   time = lastModified;
  -                youngest = rotations[ i ] + 1;
  +                oldest = rotations[ i ];
               }
           }
   
  -        return youngest;
  +        return oldest;
       }
   
       /**
  
  
  
  1.2       +3 -3      
jakarta-avalon-logkit/src/test/org/apache/log/output/test/RevolvingFileStrategyTestCase.java
  
  Index: RevolvingFileStrategyTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-logkit/src/test/org/apache/log/output/test/RevolvingFileStrategyTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RevolvingFileStrategyTestCase.java        29 Mar 2002 14:36:30 -0000      
1.1
  +++ RevolvingFileStrategyTestCase.java        18 Apr 2002 09:14:08 -0000      
1.2
  @@ -164,7 +164,7 @@
           assertEquals( "rotation", 0, strategy.getCurrentRotation() );
       }
   
  -    public void testFullRotationWithYounger()
  +    public void testFullRotationWithOlder()
           throws Exception
       {
           deleteFiles( 9 );
  @@ -175,13 +175,13 @@
           createFile( 4, 0 );
           createFile( 5, 0 );
           createFile( 6, 0 );
  -        createFile( 7, YOUNG_AGE );
  +        createFile( 7, OLD_AGE );
           createFile( 8, 0 );
           createFile( 9, 0 );
   
           final RevolvingFileStrategy strategy =
               new RevolvingFileStrategy( m_baseFile, 9 );
   
  -        assertEquals( "rotation", 8, strategy.getCurrentRotation() );
  +        assertEquals( "rotation", 7, strategy.getCurrentRotation() );
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to