DBZ-538 Improve invalid DDL statement reporting

This commit is contained in:
Jiri Pechanec 2018-01-11 13:19:03 +01:00 committed by Gunnar Morling
parent 374999ee45
commit 0b269a6e41
4 changed files with 8 additions and 3 deletions

View File

@ -290,7 +290,6 @@ public boolean applyDdl(SourceInfo source, String databaseName, String ddlStatem
if (skipUnparseableDDL) { if (skipUnparseableDDL) {
logger.warn("Ignoring unparseable DDL statement '{}': {}", ddlStatements); logger.warn("Ignoring unparseable DDL statement '{}': {}", ddlStatements);
} else { } else {
logger.error("Error parsing DDL statement and updating tables: {}", ddlStatements);
throw e; throw e;
} }
} finally { } finally {

View File

@ -289,7 +289,7 @@ public final void parse(TokenStream ddlContent, Tables databaseTables) throws Pa
} }
} catch (ParsingException e) { } catch (ParsingException e) {
ddlContent.rewind(marker); ddlContent.rewind(marker);
throw e; throw new ParsingException(e.getPosition(), "Failed to parse statement '" + ddlContent.getInputString() + "'", e);
} catch (Throwable t) { } catch (Throwable t) {
parsingFailed(ddlContent.nextPosition(), "Unexpected exception (" + t.getMessage() + ") parsing", t); parsingFailed(ddlContent.nextPosition(), "Unexpected exception (" + t.getMessage() + ") parsing", t);
} }

View File

@ -74,7 +74,6 @@ public final void recover(Map<String, ?> source, Map<String, ?> position, Tables
if (skipUnparseableDDL) { if (skipUnparseableDDL) {
logger.warn("Ignoring unparseable statements '{}' stored in database history: {}", ddl, e); logger.warn("Ignoring unparseable statements '{}' stored in database history: {}", ddl, e);
} else { } else {
logger.error("Cannot parse DDL statements {} stored in history, exiting", ddl);
throw e; throw e;
} }
} }

View File

@ -2691,4 +2691,11 @@ public void tokenize(CharacterStream input,
} }
} }
} }
/**
* @return a string to be parsed
*/
public String getInputString() {
return inputString;
}
} }