Uploaded image for project: 'PUBLIC - Liferay Portal Web Content Experience'
  1. PUBLIC - Liferay Portal Web Content Experience
  2. WCM-1361

Wrong elementId for custom source in Web Content Article

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 1.X, 2.x
    • Fix Version/s: 1.1.5
    • Component/s: Content Targeting
    • Labels:
      None

      Description

      Description

      When custom source code is used for a Web Content Article, and one of the fields of a select or form tag is set to "id," CT_Analytics_AnalyticsEvent.elementId is set to the value of the tag instead of the actual id. In version 1.1.4, a data truncation error appears due to the column size being set to 75 varchar (not large enough).

      Steps to reproduce

      1) Start the server and configure it to use MySQL.
      2) Deploy Audience Targeting.
      3) Under Site > Configuration > Audience Targeting, Add a User Segment with one rule that tracks whether a user is logged in or not.
      4) Add a web content article with this source:

      <form action="/" id="submitPopup" method="POST" name="submitPopup">
      <input id="id" name="id" type="hidden" value="" /> 
      <input id="action" name="action" type="hidden" value="" />
      </form>
      

      5) Add a web content display to the page, select the web content, and refresh the page.
      6) Using MySQL Workbench or the console, query for the entries in the CT_Analytics_AnalyticsEvent.

      Results

      Expected Result: ElementId should be "submitPopup."
      Actual Results: ElementId will look something like this:

      {"_yuid":"yui_patched_v3_18_1_1_1492031410413_357","_stateProxy":{"_yuid":"yui_patched_v3_18_1_1_1492031410413_357"},"_plugins":{},"_node":{"_yuid":"yui_patched_v3_18_1_1_1492031410413_357"}}
      

      Errors/Logs for 1.1.4

      21:38:40,987 ERROR [liferay/analytics-9][JDBCExceptionReporter:82] Data truncation: Data too long for column 'elementId' at row 1
      21:38:40,993 ERROR [liferay/analytics-9][AnalyticsMessageListener:39] Unable to process message {destinationName=liferay/analytics, response=null, responseDestinationName=null, responseId=null, payload=null, values={pathContext=, groupId=0, scopeGroupId=20519, clientIP=127.0.0.1, anonymousUserId=20482, referrerClassName=com.liferay.content.targeting.model.UserSegment, uRLHome=http://localhost:8080/web/guest, companyGroupId=20195, stateMaximized=false, pathJavaScript=/html/js, elementId={"_yuid":"yui_patched_v3_11_0_1_1490305120718_388","_stateProxy":{"_yuid":"yui_patched_v3_11_0_1_1490305120718_388"},"_plugins":{},"_node":{"_yuid":"yui_patched_v3_11_0_1_1490305120718_388"}}, statePopUp=false, plid=20540, portletSetupShowBordersDefault=true, defaultLanguageId=en_US, privateLayout=false, defaultLocale=en_US, companyId=20155, pathThemeRoot=/html/themes/classic, referrerClassPK=20557, impersonated=false, bCP47LanguageId=en-US, virtualLayout=false, parentLayoutId=0, doAsUserIdEncoded=, siteGroupId=20519, pathThemeImages=http://localhost:8080/html/themes/classic/images, uRLControlPanel=/group/control_panel?refererPlid=20540, event=view, scopeGroupIdOrLiveGroupId=20519, timestamp=2017-03-23T21:38:40.968Z, cDNBaseURL=http://localhost:8080, languageId=en_US, parentGroupId=20519, stateExclusive=false, userAgent=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36, sessionId=, userName=Test Test, layoutId=1, userId=20199, pathMain=/c, pathImage=/image, cDNHost=, layoutURL=http://localhost:8080/web/site_a/snth, portalURL=http://localhost:8080, signedIn=true, addSessionIdToURL=false, cDNDynamicResourcesHost=, freeformLayout=false}}
      com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.DataException: Could not execute JDBC batch update
      	at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:30)
      	at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:147)
      	at com.liferay.portal.kernel.dao.orm.ClassLoaderSession.flush(ClassLoaderSession.java:237)
      	at com.liferay.portal.dao.orm.hibernate.PortletSessionFactoryImpl.closeSession(PortletSessionFactoryImpl.java:57)
      	at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.closeSession(BasePersistenceImpl.java:83)
      	at com.liferay.content.targeting.analytics.service.persistence.AnalyticsEventPersistenceImpl.updateImpl(AnalyticsEventPersistenceImpl.java:5216)
      	at com.liferay.content.targeting.analytics.service.persistence.AnalyticsEventPersistenceImpl.updateImpl(AnalyticsEventPersistenceImpl.java:1)
      	at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:333)
      	at sun.reflect.GeneratedMethodAccessor354.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:320)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      	at com.liferay.portal.dao.shard.advice.ShardPersistenceAdvice.invoke(ShardPersistenceAdvice.java:54)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      	at com.sun.proxy.$Proxy480.update(Unknown Source)
      	at com.liferay.content.targeting.analytics.service.impl.AnalyticsEventLocalServiceImpl.addAnalyticsEvent(AnalyticsEventLocalServiceImpl.java:113)
      	at com.liferay.content.targeting.analytics.service.impl.AnalyticsEventLocalServiceImpl.addAnalyticsEvent(AnalyticsEventLocalServiceImpl.java:65)
      	at sun.reflect.GeneratedMethodAccessor894.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
      	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
      	at com.sun.proxy.$Proxy478.addAnalyticsEvent(Unknown Source)
      	at com.liferay.content.targeting.analytics.service.AnalyticsEventLocalServiceUtil.addAnalyticsEvent(AnalyticsEventLocalServiceUtil.java:289)
      	at com.liferay.content.targeting.analytics.messaging.AnalyticsMessageListener.doReceive(AnalyticsMessageListener.java:75)
      	at com.liferay.content.targeting.analytics.messaging.AnalyticsMessageListener.receive(AnalyticsMessageListener.java:36)
      	at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:72)
      	at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:71)
      	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:682)
      	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:593)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.hibernate.exception.DataException: Could not execute JDBC batch update
      	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
      	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
      	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
      	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
      	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
      	at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:144)
      	... 37 more
      Caused by: java.sql.BatchUpdateException: Data truncation: Data too long for column 'elementId' at row 1
      	at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2054)
      	at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1467)
      	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:2465)
      	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
      	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
      	... 43 more
      Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'elementId' at row 1
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4118)
      	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.executeUpdate(PreparedStatement.java:2458)
      	at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)
      	... 47 more
      

      2.x
      3dd9f04efc45cc6f51b4ecfcf3781de5f1f21f35
      Reproduces the issue.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  1.1.5