EDIT for further readers: the problem was that my input file was corrupted.
I don't understand what I'm doing wrong :
I was using this code :
File f = new File("C:\Temp\dico.txt");
BufferedReader r = null;
try {
r = new BufferedReader(new FileReader(f));
String scan;
while((scan=r.readLine())!=null) {
if(scan.length()==0) {continue;}
//treatment
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Lexique.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Lexique.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if(r!=null) try {
r.close();
} catch (IOException ex) {
Logger.getLogger(Lexique.class.getName()).log(Level.SEVERE, null, ex);
}
}
Which is working fine. Now, for some reason, I wanted to change for a Scanner. My code became :
File f = new File("C:\Temp\dico.txt");
Scanner r = null;
try {
r = new Scanner(f);
String scan;
while(r.hasNextLine()) {
scan = r.nextLine();
if(scan.length()==0) {continue;}
//treatment
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Lexique.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Lexique.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if(r!=null) r.close();
}
This time, we never enter the while, because r.hasNextLine() always returns "false". Any idea about what I'm doing wrong ?
I precise that nothing else changed, the file is still the same.
EDIT : I also precise that I tried with another file and got the same result, meaning it doesn't comes from the file apparently.
The file looks like this :
a
à
abaissa
abaissable
abaissables
abaissai
abaissaient
abaissais
abaissait
...
Edit 2 :
The content of the file seems to be problematic since the problem persists only if I copy/paste the content from my file to another. In clear, if I write the content myself, it works, if I use a part of the content of my dico.txt file, it doesn't work. Any explanation ?
Edit 3 :
These are the links to my files. I advice you to avoid the dico.txt which is very huge.
dico.txt : https://drive.google.com/file/d/0B0sroFy9HZlBNDl3MUwzVnh6VU0/edit?usp=sharing
test.txt : https://drive.google.com/file/d/0B0sroFy9HZlBemZjbXU1RmlmdjQ/edit?usp=sharing
See Question&Answers more detail:
os