raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

RamlModelBuilder with relative File without parent

Open schlagi123 opened this issue 8 years ago • 0 comments

In the following example I get the following exception. Code: RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(new File("test.raml"));

Exception:

Exception in thread "main" java.lang.NullPointerException
	at java.io.File.<init>(File.java:277)
	at org.raml.v2.api.loader.FileResourceLoader.<init>(FileResourceLoader.java:36)
	at org.raml.v2.api.RamlModelBuilder.getRamlContent(RamlModelBuilder.java:252)
	at org.raml.v2.api.RamlModelBuilder.buildApi(RamlModelBuilder.java:99)
	at de.ostfalia.ramltools.editor.Main.main(Main.java:11)

I look in the code and see, that you call the getParent() Method of the File Object. In this special case I use an relative url for the file without a parent. It can be fixed if you call the getAbsoluteFile() Method before.

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-73

schlagi123 avatar Oct 12 '17 07:10 schlagi123