From 0e1ae3234ce0ee928f51ab050f97af2899964ce4 Mon Sep 17 00:00:00 2001 From: Felix Schnabel Date: Fri, 13 Sep 2024 23:10:46 +0200 Subject: [PATCH] Fix spotbugs --- .../ballerinalang/bindgen/utils/BindgenFileGenerator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenFileGenerator.java b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenFileGenerator.java index f9909fcb5077..26846fdbecec 100644 --- a/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenFileGenerator.java +++ b/misc/ballerina-bindgen/src/main/java/org/ballerinalang/bindgen/utils/BindgenFileGenerator.java @@ -84,7 +84,11 @@ private SyntaxTree generateSyntaxTree() throws BindgenException { } private SyntaxTree generateFromTemplate(Path filePath) throws BindgenException { - return generateFromTemplate(filePath, env.getAlias(currentClass.getName())); + String alias = env.getAlias(currentClass.getName()); + if (alias == null) { + throw new BindgenException("error: unable to generate the binding class '" + currentClass.getName() + "'"); + } + return generateFromTemplate(filePath, alias); } private SyntaxTree generateFromTemplate(Path filePath, String alias) throws BindgenException {