|[CDO] StringIndexOutOfBoundsException thrown for a column containing a single space using H2 [message #994617]
||Thu, 27 December 2012 16:16
| Ray Braithwood
Registered: November 2012
I believe I have found a bug in the H2 JDBC driver and have already created a bug against H2 about this. Unfortunately I cannot post a link to the bug until I have 5 posts to the forums.|
The reason for the forum post here is that CDO will throw a StringIndexOutOfBoundException with the following situation.
1) Define a model object that has a field with an EChar
2) When CDO creates the table it creates a column for the EChar that is CHAR(1)
3) Write data using CDO that will put a space (unicode-32) as the char
4) shut down the "cdo server" and H2 database (to clear caches)
5) Restart everything and use CDO to retrieve the value from the DB
What happens now is that TMCharacter will get the data from the ResultSet. Because of the driver bug, all space chars are stripped from the data returning an empty String. TMCharacter will now call charAt(0) causing the exception.
We have a workaround in that we changed the model from EChar to EString and use a CDO annotation to make the column a VARCHAR(1) which does not get stripped by the JDBC driver.
Powered by FUDForum
. Page generated in 0.02785 seconds