Hi, during compilation of stored procedures a compiler warning makes it
impossible to start H2 in JUnit tests. The problem exists since version
1.4.191.
The compiler warning is caused by an annotation processor in the classpath
and should be ignored in method
org.h2.util.SourceCompiler#handleSyntaxError().
Unfortunately the compiler warning has 2 lines and thus it throws a
org.h2.message.DbException. The second line or last line respectively is a
summary with the number of warnings.
In my case a -proc:none or -nowarn compiler option would solve the problem
but generally the handleSyntaxError() method should ignore the summary line.
This could be achieved by an additional condition in the if statement:
*if* (line.startsWith("Note:") || line.startsWith("warning:") || line
.endsWith("warning")) {
Version 1.4.190
private static void handleSyntaxError(String output) {
if (output.startsWith("Note:") || output.startsWith("warning:")) {
// just a warning (e.g. unchecked or unsafe operations)
} else if (output.length() > 0) {
output = StringUtils.replaceAll(output, COMPILE_DIR, "");
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, output);
}
}
Version 1.2.191
private static void handleSyntaxError(String output) {
boolean syntaxError = false;
final BufferedReader reader = new BufferedReader(new
StringReader(output));
try {
for (String line; (line = reader.readLine()) != null;) {
if (line.startsWith("Note:") ||
line.startsWith("warning:")) {
// just a warning (e.g. unchecked or unsafe operations)
} else {
syntaxError = true;
break;
}
}
} catch (IOException ignored) {
// exception ignored
}
if (syntaxError) {
output = StringUtils.replaceAll(output, COMPILE_DIR, "");
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, output);
}
}
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.