Wrong data retrieval when using getString() instead of getClob() for clob columns

Description

Preconditions:

  1. Database upgrading from 6.2 to 7.0

  2. Some content recorded using a clob structure with a size >= 4000 bytes

  3. RDBMS Oracle using a ojdbc7.jar driver library.
    Important: There may be other RDBMS in a similar issue.

Steps to reproduce:

  • Launch an upgrade process from 6.2 to 7.0 using Liferay upgrade client.

Check Mark Expected behaviour:

  • Upgrade process ends without any errors.

Cross Mark Observed behaviour:

  • Some entities generate errors during upgrade because of data retrieval is truncated.
    Example:

    Caused by: com.liferay.portal.kernel.xml.DocumentException: Error on line 66 of document : XML document structures must start and end within the same entity. Nested exception: XML document structures must start and end within the same entity. at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:408) at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:384) at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:419) at com.liferay.portal.kernel.xml.SAXReaderUtil.read(SAXReaderUtil.java:165) at com.liferay.journal.internal.upgrade.v0_0_5.UpgradeJournal.convertStaticContentToDynamic(UpgradeJournal.java:237) at com.liferay.journal.internal.upgrade.v0_0_5.UpgradeJournal.updateJournalArticles(UpgradeJournal.java

Warning Root cause:
Our code uses

java.sql.ResultSet.getString(String)


method instead of

java.sql.ResultSet.getClob(String)


for data retrieval from clob columns.

Under some context, getString(String) method gets truncated data.

See also: https://docs.oracle.com/javase/8/docs/api/java/sql/Clob.html

Warning Workaround:
Oracle Support admits some bugs using getString(String) method under ojdbc7.jar driver library.
Oracle Support recommends using ojdbc8.jar driver library with at least Oracle 12.2.0.1.0 JDBC 4.2 versioning.

Activity

Show:

Anita May 15, 2018 at 3:38 PM

Closing this issue as the team said it can't be fixed.
The documentation has been updated (https://liferay.atlassian.net/browse/LRDOCS-5275#icft=LRDOCS-5275).

Sergio Alonso May 8, 2018 at 1:36 AM

Hello

Updating documentation about Oracle's recommendation could help us to have a reference.
The ticket could be fixed later.

Kind regards,
Sergio

Anita May 7, 2018 at 3:36 PM

Hello . Just checked with Shuyang and Albert. We can't fix it but maybe we can update documentation to suggest the Oracle recommendation:
"Oracle Support recommends using ojdbc8.jar driver library with at least Oracle 12.2.0.1.0 JDBC 4.2 versioning."
cc

Won't Fix
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix Priority

3

Bug Type

Database Upgrade

Affects versions

Priority

Zendesk Support

Created March 28, 2018 at 5:35 AM
Updated June 26, 2023 at 1:54 AM
Resolved May 15, 2018 at 3:38 PM

Flag notifications