Hi Dalibor,
here is the testcase. kaffe behaves differently than all other
implementations in the order the files are listed.
Just put in an empty directory, compile and run.
JDK 1.4/1.5, sablevm, jamvm, gcj 4.0 have this order:
java FileOrderBug
Name: ./FileOrderBug.class
Name: ./FileOrderBug.java
Name: ./log.000000
Name: ./log.000001
Name: ./log.000002
Name: ./log.000003
Name: ./log.000004
Name: ./log.000005
kaffe:
kaffe FileOrderBug
Name: ./log.000005
Name: ./log.000004
Name: ./log.000003
Name: ./log.000002
Name: ./log.000001
Name: ./log.000000
Name: ./FileOrderBug.java
Name: ./FileOrderBug.class
Wolfgang
import java.io.*;
public final class FileOrderBug {
private final File m_baseFile;
public FileOrderBug() throws IOException {
m_baseFile = ( new File( "log" ) ).getCanonicalFile();
}
private String getFilename( int i ) {
return m_baseFile.getName() + ".00000" + i;
}
private void createFile(int rotation) throws IOException {
final File file = new File( getFilename( rotation ) );
if( !file.createNewFile() )
throw new IOException( "Failed to create file " + file );
file.setLastModified( System.currentTimeMillis() );
}
public void test() throws Exception {
createFile( 0);
createFile( 1);
createFile( 2);
createFile( 3);
createFile( 4);
createFile( 5);
File basePath = new File( "." );
File[] files = basePath.listFiles();
for(int i=0; i < files.length; i++)
System.out.println("Name: " + files[i]);
}
public static void main(String[] args) throws Exception {
FileOrderBug bug = new FileOrderBug();
bug.test();
}
}
_______________________________________________
kaffe mailing list
[email protected]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe