diff --git a/plugins/org.etsi.mts.tdl.openapi2tdl.next/src/org/etsi/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java b/plugins/org.etsi.mts.tdl.openapi2tdl.next/src/org/etsi/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java index 7ab0220c2f3276f7419cccdd039d2d3ad2488b0b..c9816994eda7f004c1439d9b3e4e1110dac2a377 100644 --- a/plugins/org.etsi.mts.tdl.openapi2tdl.next/src/org/etsi/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java +++ b/plugins/org.etsi.mts.tdl.openapi2tdl.next/src/org/etsi/mts/tdl/openapi2tdl/next/OpenAPI2TDLTranslatorNext.java @@ -574,9 +574,13 @@ public class OpenAPI2TDLTranslatorNext extends AbstractTranslator { * * @param specFilePath The path to the specification file * @return A "raw" OpenAPI document + * @throws Exception */ - public static OpenAPI parseSpec(String specFilePath, Boolean processInline) { + public static OpenAPI parseSpec(String specFilePath, Boolean processInline) throws Exception { OpenAPI openAPI = new OpenAPIParser().readLocation(specFilePath, null, new ParseOptions()).getOpenAPI(); + + if (openAPI == null) + throw new Exception("Failed to parse '" + specFilePath + "', make sure it's valid "); // Invoke helper function to get the original swagger version. // See https://github.com/swagger-api/swagger-parser/pull/1374 // Also see https://github.com/swagger-api/swagger-parser/issues/1369.