tags:

views:

46

answers:

2

Hi,

I've passed a file to a library, and the library is spitting out a FileNotFound error as shown:

javax.xml.transform.TransformerException: java.io.FileNotFoundException: file:\C:\Users\Oroma\workspace\IndividualProject_JINQS\WebContent\WEB-INF\classes\presentationlayer\utility\mappings\jmt\networkModel.xml (The filename, directory name, or volume label syntax is incorrect)

The file is sent calling this method:

 private URI getFileLocation(String fName) throws URISyntaxException {
    return this.getClass().getResource("utility/mappings/jmt/"+ fName).toURI();
 }

So if the file didn't exist I'd be getting a null pointer way before I send the file to the JSIM library.

I'm looking at the the errors message: (The filename, directory name, or volume label syntax is incorrect). Looking at the full path for the file, I can't see any special characters.

Does anyone have any idea what might be causing the error?

EDIT: The method call to the other library requires sending a file:

SolverDispatcher solver = new SolverDispatcher();
File networkModel = new File(getFileLocation("networkModel.xml"));
solver.solve(networkModel);
A: 

Does the method you are calling expect a URI or a filename? That is, does it expect that file: at the start?

djna
It expects a file. I've added the method call to the original question.
A: 

I might be wrong. I'm just guessing. Usually absolute URL of a file starts with a

file:///

In the exception I see it as

file:\
wowrt
Thats why I tried to create the file using a URI rather than a string