1 Reply Latest reply on Feb 22, 2013 2:44 AM by EJP

    Order of the File.listFiles()


      We have the following code in our application, every thing was working fine until we upgraded our server infrastructure to VMWare 5.

      Once our server were moved to VMWare 5, the order of the files in "allFiles" changed which is resulting in failure in the code that follows this.

      *File baseFolder = new File(folderName);

      File[] allFiles = baseFolder.listFiles(new JARFilter());
      JarFile jarfile = null;

      for(int i=0; i<allFiles.length; ++i)
           System.out.println("The class File found in " + allFiles);

      I agree that we shouldn't have written our code in such a way that it would depend on the order of the files in the "allFiles", that is a very bad code, but what is done is done :(

      We are in to production now and we can't even change the code, is there any way we can do to resolve this may a JVM args that would change the order or some thing on the OS level.