I have a thread that will check if a file exists before doing any computation.
FileSystem fs = ...
Path filenamePath = new Path(file.getID() + "file.txt");
try {
while(!fs.exists(filenamePath)){
Thread.sleep(1000);
}
} catch (InterruptedException e){
}
The problem is that my thread throws the error NulPointerException
and never gets interrupted. The null
exception becasue filenamePath
is null
. What should I do in this case? Am I doing something wrong?
The stack trace doesn't show anything useful except showing the line
ERROR [CheckFilesThread] compute.files.app.FirstApp: Exception in CheckFilesThread
java.lang.NullPointerException
at compute.files.app.FirstApp$CheckFilesThread.run(FirstApp.java:211)