Prevent an IndexOutOfBoundsException if the SQL-String ends with a single line comment without a newline.

This commit is contained in:
Joerg Schoenfisch 2013-02-20 13:55:29 +01:00
parent d66fbbab21
commit e913111a8e

View File

@ -733,7 +733,7 @@ final class Utils {
if (peek(sqlChars, i, "--")) {
// Consume the complete comment
for (; sqlChars[i] != '\r' && sqlChars[i] != '\n'; render.sql(sqlChars[i++]));
for (; i < sqlChars.length && sqlChars[i] != '\r' && sqlChars[i] != '\n'; render.sql(sqlChars[i++]));
// Consume the newline character
render.sql(sqlChars[i]);
@ -1739,7 +1739,7 @@ final class Utils {
return (T) wasNull(rs, Boolean.valueOf(rs.getBoolean(index)));
}
else if (type == BigInteger.class) {
// The SQLite JDBC driver doesn't support BigDecimals
// The SQLite JDBC driver doesn't support BigDecimals
if (ctx.getDialect() == SQLDialect.SQLITE) {
return Convert.convert(rs.getString(index), (Class<T>) BigInteger.class);
}