Importing web link in Common Cartridge package with url > 255 chars will kill import

Description

Steps to Replicate
-------------------------------------- 1) Create IMS CC package with a URL > 255 characters
2) Go to Sakai course -> Site Info
3) Import from Archive File
4) Upload package

Result
--------------------------------------- Package is not imported due to fatal error.

Proposed Fix
-------------------------------------- Truncate the URL the same way Aaron fixed

Stack Trace
-------------------------------------------
thing: content.CourseMaterials.label/Materials for Study Tour in Kingston/http%3A%2F%2Fmaps.google.com%2Fmaps%2Fms%3Fie%3DUTF8%26hl%3Den%26msa%3D0%26msid%3D108118499075806345993.0004661c824edb85e7a3a%26ll%3D18.00355%2C-76.878204%26spn%3D0.730075%2C1.135712%26z%3D10
2010-07-23 15:15:15,657 DEBUG http-8080-Processor24 org.sakaiproject.importer.impl.handlers.ResourcesHandler - import ResourcesHandler about to add web link entitled 'Map of Kingston with all Study Tour sites'
2010-07-23 15:15:15,679 WARN http-8080-Processor24 org.sakaiproject.db.impl.BasicSqlService - Sql.dbWrite(): error code: 1406 sql: insert into CONTENT_RESOURCE (RESOURCE_ID,IN_COLLECTION,CONTEXT,FILE_SIZE,RESOURCE_TYPE_ID,FILE_PATH,BINARY_ENTITY, XML) values ( ?, ?, ?, ?, ?, ?, ? , NULL ) binds: /group/fd1db9ca-b581-4f86-b521-8b499a298b06/content.CourseMaterials.label/Materials for Study Tour in Kingston/http_3A_2F_2Fmaps.google.com_2Fmaps_2Fms_3Fie_3DUTF8_26hl_3Den_26msa_3D0_26msid_3D108118499075806345993.0004661c824edb85e7a3a_26ll_3D18.00355_2C-76.878204_26spn_3D0.730075_2C1.135712_26z_3D10 /group/fd1db9ca-b581-4f86-b521-8b499a298b06/content.CourseMaterials.label/Materials for Study Tour in Kingston/ fd1db9ca-b581-4f86-b521-8b499a298b06 0 null /2010/204/19/3b0fa834-6cd1-4200-a0ae-66ac6eaabfd8 [B@ddaf79
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'RESOURCE_ID' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3564)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2409)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2327)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2312)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.sakaiproject.db.impl.BasicSqlService.dbWrite(BasicSqlService.java:1218)
at org.sakaiproject.db.impl.BasicSqlService.dbWrite(BasicSqlService.java:1052)
at org.sakaiproject.util.BaseDbDualSingleStorage.putResource(BaseDbDualSingleStorage.java:622)
at org.sakaiproject.content.impl.DbContentService$DbStorage.putResource(DbContentService.java:1618)
at org.sakaiproject.content.impl.BaseContentService.addResource(BaseContentService.java:3574)
at org.sakaiproject.content.impl.BaseContentService.addResource(BaseContentService.java:3112)
at org.sakaiproject.content.impl.BaseContentService.addResource(BaseContentService.java:3182)
at org.sakaiproject.content.impl.BaseContentService.addResource(BaseContentService.java:3171)
at org.sakaiproject.importer.impl.handlers.ResourcesHandler.addContentResource(ResourcesHandler.java:278)
at org.sakaiproject.importer.impl.handlers.ResourcesHandler.handle(ResourcesHandler.java:165)
at org.sakaiproject.importer.impl.BasicImportService.doImportItems(BasicImportService.java:50)
at org.sakaiproject.site.tool.SiteAction.doSaveMtrlSite(SiteAction.java:3490)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.sakaiproject.cheftool.VelocityPortletPaneledAction.actionDispatch(VelocityPortletPaneledAction.java:622)
at org.sakaiproject.cheftool.VelocityPortletPaneledAction.processAction(VelocityPortletPaneledAction.java:532)
at org.sakaiproject.cheftool.ToolServlet.doGet(ToolServlet.java:230)
at org.sakaiproject.cheftool.VelocityPortletPaneledAction.doGet(VelocityPortletPaneledAction.java:1029)
at org.sakaiproject.cheftool.ToolServlet.doPost(ToolServlet.java:154)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at org.sakaiproject.vm.ComponentServlet.service(ComponentServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:586)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:359)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:504)
at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1218)
at org.sakaiproject.portal.charon.handlers.ToolHandler.doTool(ToolHandler.java:204)
at org.sakaiproject.portal.charon.handlers.ToolHandler.doGet(ToolHandler.java:96)
at org.sakaiproject.portal.charon.handlers.ToolHandler.doPost(ToolHandler.java:73)
at org.sakaiproject.portal.charon.SkinnableCharonPortal.doPost(SkinnableCharonPortal.java:1061)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
2010-07-23 15:15:15,680 WARN http-8080-Processor24 org.sakaiproject.cheftool.VelocityPortletPaneledAction - Exception calling method doSaveMtrlSite java.lang.reflect.InvocationTargetException (Caused by java.lang.RuntimeException: SqlService.dbWrite failure)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.sakaiproject.cheftool.VelocityPortletPaneledAction.actionDispatch(VelocityPortletPaneledAction.java:622)
at org.sakaiproject.cheftool.VelocityPortletPaneledAction.processAction(VelocityPortletPaneledAction.java:532)
at org.sakaiproject.cheftool.ToolServlet.doGet(ToolServlet.java:230)
at org.sakaiproject.cheftool.VelocityPortletPaneledAction.doGet(VelocityPortletPaneledAction.java:1029)
at org.sakaiproject.cheftool.ToolServlet.doPost(ToolServlet.java:154)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at org.sakaiproject.vm.ComponentServlet.service(ComponentServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:586)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:359)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
at org.sakaiproject.tool.impl.ActiveToolComponent$MyActiveTool.forward(ActiveToolComponent.java:504)
at org.sakaiproject.portal.charon.SkinnableCharonPortal.forwardTool(SkinnableCharonPortal.java:1218)
at org.sakaiproject.portal.charon.handlers.ToolHandler.doTool(ToolHandler.java:204)
at org.sakaiproject.portal.charon.handlers.ToolHandler.doGet(ToolHandler.java:96)
at org.sakaiproject.portal.charon.handlers.ToolHandler.doPost(ToolHandler.java:73)
at org.sakaiproject.portal.charon.SkinnableCharonPortal.doPost(SkinnableCharonPortal.java:1061)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.sakaiproject.util.RequestFilter.doFilter(RequestFilter.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: SqlService.dbWrite failure
at org.sakaiproject.db.impl.BasicSqlService.dbWrite(BasicSqlService.java:1260)
at org.sakaiproject.db.impl.BasicSqlService.dbWrite(BasicSqlService.java:1052)
at org.sakaiproject.util.BaseDbDualSingleStorage.putResource(BaseDbDualSingleStorage.java:622)
at org.sakaiproject.content.impl.DbContentService$DbStorage.putResource(DbContentService.java:1618)
at org.sakaiproject.content.impl.BaseContentService.addResource(BaseContentService.java:3574)
at org.sakaiproject.content.impl.BaseContentService.addResource(BaseContentService.java:3112)
at org.sakaiproject.content.impl.BaseContentService.addResource(BaseContentService.java:3182)
at org.sakaiproject.content.impl.BaseContentService.addResource(BaseContentService.java:3171)
at org.sakaiproject.importer.impl.handlers.ResourcesHandler.addContentResource(ResourcesHandler.java:278)
at org.sakaiproject.importer.impl.handlers.ResourcesHandler.handle(ResourcesHandler.java:165)
at org.sakaiproject.importer.impl.BasicImportService.doImportItems(BasicImportService.java:50)
at org.sakaiproject.site.tool.SiteAction.doSaveMtrlSite(SiteAction.java:3490)
... 46 more
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'RESOURCE_ID' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3564)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2409)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2327)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2312)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.sakaiproject.db.impl.BasicSqlService.dbWrite(BasicSqlService.java:1218)

Attachments

2

Activity

Show:

Hudson CI Server August 5, 2011 at 1:31 PM

Integrated in common trunk #307 (See http://builds.sakaiproject.org:8080/job/common%20trunk/307/)
implement better resource id truncation; reverts and moves that functionality to helper function

Sam Ottenhoff June 1, 2011 at 6:53 AM

Duffy can you check the Apr 11 commits and confirm that this fix is not present?

Duffy Gillman May 31, 2011 at 2:50 PM

SAK-18833-drg.patch alters the length check to consider the entire length of the web link ID.

Duffy Gillman May 31, 2011 at 2:49 PM

Calculation of id length is incorrect. This fix only checks if the context portion of the id is too long, but does not check if the entire id is too long. So the check for length may pass and may still allow an id through which is too big for the RESOURCE_ID field. I will attach a patch that fixes this issue for review.

Hudson CI Server April 11, 2011 at 9:33 AM

Integrated in common trunk (build and deploy) #266 (See http://builds.sakaiproject.org:8080/job/common%20trunk%20(build%20and%20deploy)/266/)
additional fix to IF statement to see if new resource is too long

Fixed

Details

Priority

Affects versions

Fix versions

Components

Assignee

Reporter

Created July 23, 2010 at 12:25 PM
Updated August 5, 2011 at 3:14 PM
Resolved August 2, 2011 at 2:08 PM