|
Re: [CDO] StringIndexOutOfBoundsException thrown for a column containing a single space using H2 [message #994714 is a reply to message #994617] |
Fri, 28 December 2012 04:28 |
|
Am 27.12.2012 22:16, schrieb Ray Braithwood:
> 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.
I think you can post it if you obfuscate it a little bit, for example by putting a space after http:
>
> 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.
I hate to add workarounds for bugs in downstream dependencies but this one seems simple: as empty chars do not exist we
could return a space char if the string is empty. Please submit a bugzilla.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Powered by
FUDForum. Page generated in 0.03431 seconds