Affects Version/s: Master
When upgrading to DXP, some portletIds may become too long during the upgrade process, resulting in "java.sql.BatchUpdateException: String or binary data would be truncated" error.
This is because we are replacing the oldPortletId incorrectly. Rather than replacing the first instance of the portletId, or the portletId appended with an underscore, we replace just the portlet id. When upgrading a portlet with the following id : 56_USER_5566856_INSTANCE_HNiazbHID1Ni, the portletId '56' is replaced three times, resulting in a new portletId which is too many characters for the DB to handle (and incorrect). The new portletId looks something like: com_liferay_journal_content_web_portlet_JournalContentPortlet_USER_5com_liferay_journal_content_web_portlet_JournalContentPortlet68com_liferay_journal_content_web_portlet_JournalContentPortlet_INSTANCE_HNiazbHID1Ni
Steps to Reproduce:
- Start a 6.2 instance
- have a portlet with a portletId which appears multiple times (such as 56_USER_5566856_INSTANCE_HNiazbHID1Ni)
- Upgrade to DXP
Portlet upgrades normally and DXP upgrade is successful
PortletID balloons up due to improper string replacement, does not insert into DB, and DXP upgrade is unsuccessful.
NOTE: I didn't actually reproduce on this githash, however the problematic code is still present.