Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.11.1
-
None
-
None
-
Windows x64, Java 7 u 21, MS SQL Server, Apache Derby in-memory
-
Novice
Description
JDBC component throws an IndexOutOfBoundsException when the result is empty.
The behaviour has been tested with a MS SQL Server database and a Apache Derby in-memory database. This bug is probably valid for any database system.
Stacktrace: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at o.a.c.c.j.JdbcProduce.setResultSet(JdbcProducer.java:226)
at o.a.c.c.j.J.createAndExecuteSqlStatement(JdbcProducer.java:146)
at o.a.c.c.j.J.processingSqlBySettingAutoCommit(JdbcProducer.java:82)
at o.a.c.c.j.J.process(JdbcProducer.java:63)
Cause: The first result row is accessed to determine the column names when setting the header JDBC_COLUMN_NAMES in method setResultSet(). If the result is empty there is no first result row.
Apache Camel 2.11.0 doen't set this header and is not affected by this bug.
Possible Workaround: Only set header JDBC_COLUMN_NAMES if data.size() > 0
Attachments
Attachments
Issue Links
- is duplicated by
-
CAMEL-6560 [JDBC Component] ResultMetaData as a header value - IndexOutOfBoundsException
- Resolved