From e913111a8e2745f2fbbf6f6d3eac6e8a3acabe1d Mon Sep 17 00:00:00 2001 From: Joerg Schoenfisch Date: Wed, 20 Feb 2013 13:55:29 +0100 Subject: [PATCH] Prevent an IndexOutOfBoundsException if the SQL-String ends with a single line comment without a newline. --- jOOQ/src/main/java/org/jooq/impl/Utils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/Utils.java b/jOOQ/src/main/java/org/jooq/impl/Utils.java index 94f5ecec52..92bd18d804 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Utils.java +++ b/jOOQ/src/main/java/org/jooq/impl/Utils.java @@ -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) BigInteger.class); }