Reputation: 762
I'm trying to read some xml files from a folder. I'm able to read 3 out of 5 files. But, 2 xmls throws FileNotFoundException
.
java.io.FileNotFoundException: /pd00/test/myspace/workspace/xml/info.xml (No such file or directory)
Exception in thread "pool-1-thread-4" java.lang.NullPointerException
Even I have hardcoded the path and tried. I'm using SAXParser to parse the xmls where I get this exception.
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(theXml, saxHandler);
The above lines are in a method called inputParsing. Then, i call this from another method beginParse using
int beginParse(String theField){
Integer.parseInt(inputParsing(theXml, theField).getOffset()) - 1;
The above beginParse method is called from another class by creating an instance for the above method's enclosing Class like:
Parsing parser = new Parsing();
parser.beginParse("NAME");
What could be the problem.
Upvotes: 0
Views: 145
Reputation: 63
I once came across the same problem. But, the thing was very silly that I had given the paths in a config file, in which there was a space appended to the file path.
Just check that. Because, often there may be spaces appended to the end of strings.
Upvotes: 1