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

Upgrade from CE 6.1 GA2 to CE 6.1 GA3 fails when upgrading structures with manual ID containing dashes

Details

    Description

      Steps to reproduce:

      1. Startup 6.1.2 GA3 bundle with this property:
        1.  journal.structure.force.autogenerate.id=false
           
      1. Add an structure with a dash ("-") in its ID. For example: STRUCTURE-PARENT. Add some field row.
      2. Add an structure with a dash in its ID ("STRUCTURE-CHILD") and choose "STRUCTURE-PARENT" as its parent. Add some field row.
      3. Try to upgrade to 6.2.0 GA (or master). It will fail.

      Trying to upgrade from CE 6.1.1 GA2 to CE 6.2 GA1.

      The upgrade procedure fails in com.liferay.portal.upgrade.v6_2_0.UpgradeJournal at row 323, because the executed select is constructed by string concatenation?!

      ps = con.prepareStatement("select * from JournalStructure where structureId = " + structureId);
      

      And when structureId is something like FLEX-SLIDERS the resulting stacktrace looks like:

      20:17:01,945 INFO  [localhost-startStop-1][UpgradeProcess:175] Upgrading com.liferay.portal.upgrade.v6_2_0.UpgradeJournal
      20:17:03,356 ERROR [localhost-startStop-1][UpgradeJournal:364] Unable to update journal structure with structure ID FLEX-SLIDERS
      20:17:03,368 ERROR [localhost-startStop-1][MainServlet:209] com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'FLEX' in 'where clause'
      com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'FLEX' in 'where clause'
              at com.liferay.portal.events.StartupAction.run(StartupAction.java:74)
              at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1238)
              at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:206)
              at javax.servlet.GenericServlet.init(GenericServlet.java:160)
              at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
              at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
              at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
              at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
              at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
              at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:656)
              at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1635)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:744)
      Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'FLEX' in 'where clause'
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:181)
              at com.liferay.portal.upgrade.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:114)
              at com.liferay.portal.upgrade.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:66)
              at com.liferay.portal.upgrade.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:46)
              at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:138)
              at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:61)
              at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:143)
              at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:160)
              at com.liferay.portal.events.StartupAction.run(StartupAction.java:68)
              ... 19 more
      Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'FLEX' in 'where clause'
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:181)
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:195)
              at com.liferay.portal.upgrade.UpgradeProcess_6_2_0.doUpgrade(UpgradeProcess_6_2_0.java:75)
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:178)
              ... 27 more
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'FLEX' in 'where clause'
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
              at com.mysql.jdbc.Util.getInstance(Util.java:386)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)
              at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)
              at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)
              at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2794)
              at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
              at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2322)
              at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:116)
              at com.liferay.portal.upgrade.v6_2_0.UpgradeJournal.updateStructure(UpgradeJournal.java:323)
              at com.liferay.portal.upgrade.v6_2_0.UpgradeJournal.addDDMStructure(UpgradeJournal.java:127)
              at com.liferay.portal.upgrade.v6_2_0.UpgradeJournal.updateStructures(UpgradeJournal.java:404)
              at com.liferay.portal.upgrade.v6_2_0.UpgradeJournal.doUpgrade(UpgradeJournal.java:217)
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:178)
              ... 30 more
      

      Attachments

        Issue Links

          Activity

            People

              shitian.zhang Shitian "Shelton" Zhang (Inactive)
              e.doychev Emil Doychev (Inactive)
              Kiyoshi Lee Kiyoshi Lee
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                8 years, 40 weeks ago

                Packages

                  Version Package
                  6.2.2 CE GA3
                  6.2.X EE
                  7.0.0 M1