Skip to content

Commit 842f8d9

Browse files
committed
added IF condition for 'diagnostic.getSource() != null' in case of warning during compiling
1 parent 2d2cb6f commit 842f8d9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • knowagemeta/src/main/java/it/eng/knowage/meta/generator/utils

knowagemeta/src/main/java/it/eng/knowage/meta/generator/utils/Compiler.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public boolean compile() {
141141
if (!diagnostics.getDiagnostics().isEmpty()) {
142142
logger.error("Found compilation errors during metamodel generation");
143143
for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
144+
if (diagnostic.getSource() != null) {
144145
logger.error("Found error on " + diagnostic.getSource().toUri() + "- line " + diagnostic.getLineNumber()
145146
+ "- Error: " + diagnostic.getMessage(null));
146147
log.append(MessageFormat.format(
@@ -152,6 +153,11 @@ public boolean compile() {
152153
} catch (IOException e) {
153154
log.append("Error while reading java sources.\n");
154155
}
156+
}
157+
else
158+
{
159+
it.eng.knowage.meta.generator.utils.Compiler.logger.warn(diagnostic.getMessage(null));
160+
}
155161
}
156162
}
157163
log.flush();

0 commit comments

Comments
 (0)