Richard Zowalla created OPENJPA-3061:
----------------------------------------

             Summary: MariaDB: writing a Reader into a CLOB fails with 
ArrayIndexOutOfBoundsException
                 Key: OPENJPA-3061
                 URL: https://issues.apache.org/jira/browse/OPENJPA-3061
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
            Reporter: Richard Zowalla
            Assignee: Richard Zowalla
             Fix For: 4.2.0


Writing a {{Reader}} into a CLOB field fails on MariaDB:
{noformat}
java.lang.ArrayIndexOutOfBoundsException: arraycopy: last destination index 
8193 out of bounds for byte[8192]
        at 
org.mariadb.jdbc.MariaDbBlob$BlobOutputStream.write(MariaDbBlob.java:448)
        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:206)
        at org.apache.openjpa.jdbc.sql.DBDictionary.copy(DBDictionary.java:5947)
        at 
org.apache.openjpa.jdbc.sql.DBDictionary.updateClob(DBDictionary.java:5911)
        at 
org.apache.openjpa.jdbc.meta.strats.LobFieldStrategy.customInsert(LobFieldStrategy.java:128)
{noformat}
{{DBDictionary.updateClob}} selects the row with an updatable result set, gets 
the {{Clob}} and writes through {{Clob.setCharacterStream(1)}}. The writer 
returned by MariaDB Connector/J 3.5.11 overruns its own buffer once more than 8 
KB is written. Writing an {{InputStream}} into a BLOB works.

The LOB tests ({{AbstractLobTest}}, {{TestReaderLob}}, {{TestInputStreamLob}}) 
only run on MySQL and DB2, so this was not noticed. {{TestReaderLob}} fails on 
MariaDB 12.3 with 12 errors when MariaDB is added to the supported databases.

Found while working on OPENJPA-3060.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to