Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-79229

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

    Details

    • Fix Priority:
      3

      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.

      Expected behaviour:

      • Upgrade process ends without any errors.

      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
        

      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

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 22 weeks, 2 days ago

                  Packages

                  Version Package