I have the following code:
public static void main( String[] args ) {
System.out.println(Locale.getDefault());
File f = new File("/Users/johngoering/Documents");
File[] fs = f.listFiles();
for (File ff : fs) {
System.out.println(ff.getName());
System.out.println(ff.exists());
}
}
In my Documents folder I have a file called "??.pdf". Here is the output under Java 6:
en_US
(...)
??.pdf
true
(...)
But here is the output under Java 7:
en_US
(...)
o????.pdf
false
(...)
Note especially that file.exists
returns false
for a file returned by listFiles
!!
What gives? Is there any way to fix this? This seems like quite the Java 7 bug...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…