From feed7665c930d0c462e710934158898de477984c Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Mon, 26 Aug 2019 10:21:30 +0200 Subject: [PATCH] [jOOQ/jOOQ#9078] Improve MockFileDatabase error message "Invalid SQL" --- .../main/java/org/jooq/tools/jdbc/MockFileDatabase.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jOOQ/src/main/java/org/jooq/tools/jdbc/MockFileDatabase.java b/jOOQ/src/main/java/org/jooq/tools/jdbc/MockFileDatabase.java index 12f488b187..8b3abd76f6 100644 --- a/jOOQ/src/main/java/org/jooq/tools/jdbc/MockFileDatabase.java +++ b/jOOQ/src/main/java/org/jooq/tools/jdbc/MockFileDatabase.java @@ -380,8 +380,14 @@ public class MockFileDatabase implements MockDataProvider { } } + // [#9078] Listing possible reasons for this to happen if (list == null) - throw new SQLException("Invalid SQL: " + sql); + throw new SQLException("Invalid SQL: " + sql + + "\nPossible reasons include: " + + "\n Your regular expressions are case sensitive." + + "\n Your regular expressions use constant literals (e.g. 'Hello'), but the above SQL string uses bind variable placeholders (e.g. ?)." + + "\n Your regular expressions did not quote special characters (e.g. \\?)." + + "\n Your regular expressions' whitespace doesn't match the input SQL's whitespace."); return list.toArray(new MockResult[list.size()]); }