Description
This issue was raised when trying to move pages from dev.xwiki.org wiki to design wiki, http://dev.xwiki.org/xwiki/bin/view/Design/Annotation+Feature
Caused by:
java.sql.SQLException: Start position [1] cannot exceed overall CLOB length [0]
Full stack:
org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [#set ($sourceWiki = 'dev') #set ($targetWiki = 'design') #set ($sourceClass = 'XWiki.DesignClass') #set ($targetClass = 'ProposalCode.ProposalClass') #set ($importPages = $xwiki.queryManager.xwql("from doc.object($sourceClass) as page").setWiki($sourceWiki).execute()) #if ($request.confirm == "1") Moved: #foreach ($importPage in $importPages) #set ($sourcePageName =$xwiki.getDocument($importPage).getName()) #set ($sourceSpaceName = $xwiki.getDocument($importPage).getSpace()) #set($sourceDocReference = $services.model.createDocumentReference($sourceWiki, $sourceSpaceName, $sourcePageName)) #set($targetDocReference = $services.model.createDocumentReference($targetWiki, $sourceSpaceName, $sourcePageName)) ## Moving from dev:Design to design:Design space, keeping the page name #if ($xwiki.copyDocument($sourceDocReference, $targetDocReference, $NULL, false, true)) #set ($sourcePage = $xwiki.getDocument($sourceDocReference)) #set ($targetPage = $xwiki.getDocument($targetDocReference)) * $targetWiki:[[$targetWiki:$sourceSpaceName.$sourcePageName]] (% class='separator'%)from(%%) $sourceWiki:[[$sourceWiki:$importPage]] (%class='noitems'%) #if($sourcePage.getSyntaxId() == 'xwiki/1.0') [ Syntax: $sourcePage.getSyntaxId() ](%%) #end(%%) ## Creating for the new page a ProposalCode.ProposalClass object #set ($sourceObj = $sourcePage.getObject($sourceClass)) #set ($targetObj = $targetPage.newObject($targetClass)) #set ($discard = $targetObj.set("type", 'Feature')) ## Mapping dev:XWiki.DesignClass@Status to design:ProposalCode.ProposalClass@status #set ($statusMapping = { 'Active': 's2', 'Dormant': 's3', 'Completed': 's4', 'Dead': 's5' }) #set ($discard = $targetObj.set("status", $statusMapping.get($sourceObj.getProperty("Status").value))) ## Copying dev:XWiki.DesignClass@JIRAIssueReference to design:ProposalCode.ProposalClass@issues #set ($discard = $targetObj.set("issues", $sourceObj.getProperty("JIRAIssueReference").value)) ## Copying dev:XWiki.DesignClass@Lead to design:ProposalCode.ProposalClass@participants #set ($discard = $targetObj.set("participants", $sourceObj.getProperty("Lead").value)) #set ($discard = $targetObj.set("mails", '')) #set ($discard = $targetObj.set("other", '')) ## Removing the old object #set ($discard = $targetPage.removeObjects($sourceClass)) #set ($discard = $targetPage.save("Page moved from $sourceWiki:$sourceSpaceName.$sourcePageName")) ## Clean up: Mark the move in the source page by providing a warning and commenting the previous content #set ($discard = $sourcePage.setSyntaxId('xwiki/2.1')) #set ($discard = $sourcePage.setContent("{{warning}}Moved to [[$targetWiki:$sourceSpaceName.$sourcePageName]]{{/warning}}")) #set ($discard = $sourcePage.removeObjects($sourceClass)) #set ($discard = $sourcePage.save("Moved page to $targetWiki:$sourceSpaceName.$sourcePageName")) #else {{error}} Document $sourceDocReference could not be copied! {{/error}} #end #end Done! #else #if ($importPages.size() > 0) The following $importPages.size() pages need to imported from '$sourceWiki' to '$targetWiki': #foreach ($importPage in $importPages) * [[$sourceWiki:$importPage]] (%class='noitems'%)#if($xwiki.getDocument($importPage).getObjectNumbers($targetClass) > 0)[ Moved ]#end(%%) #end (%class='btn btn-primary'%)[[Start import>>||queryString='confirm=1']](%%) #else No pages matching the query have been found. #end #end ## Have a summary of pages that passed the move, manually verify them ## Also move pages that don't contains object, but are in the dev:Design space, add a object of type Feature - Requirements, manually fix them] at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:131) at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:50) at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:302) at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:198) at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:59) at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transformOnce(MacroTransformation.java:191) at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:132) at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:87) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:252) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:125) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:55) at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:80) at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:38) at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:113) at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:50) at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:67) at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:41) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:993) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:972) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1003) at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:603) at sun.reflect.GeneratedMethodAccessor299.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567) at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71) at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:228) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:187) at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:105) at com.xpn.xwiki.internal.template.DefaultPrivilegedTemplateRenderer.evaluate(DefaultPrivilegedTemplateRenderer.java:125) at com.xpn.xwiki.internal.template.DefaultPrivilegedTemplateRenderer.evaluateTemplate(DefaultPrivilegedTemplateRenderer.java:75) at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1841) at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1781) at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:918) at sun.reflect.GeneratedMethodAccessor197.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:216) at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:311) at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:228) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:187) at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:105) at com.xpn.xwiki.internal.template.DefaultPrivilegedTemplateRenderer.evaluate(DefaultPrivilegedTemplateRenderer.java:125) at com.xpn.xwiki.internal.template.DefaultPrivilegedTemplateRenderer.evaluateTemplate(DefaultPrivilegedTemplateRenderer.java:75) at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1841) at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:166) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:303) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:128) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:121) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:144) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:66) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:206) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:179) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:311) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at java.lang.Thread.run(Thread.java:662) Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with id [design:ProposalCode.ImportingFromDesign] at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:247) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:187) at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:124) ... 110 more Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'copyDocument' in class com.xpn.xwiki.api.XWiki threw exception com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document design:Design.Annotation Feature at design:ProposalCode.ImportingFromDesign[line 14, column 13] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:187) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:530) at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:62) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:85) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:420) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:228) ... 112 more Caused by: com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document design:Design.Annotation Feature at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:754) at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:177) at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:170) at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1460) at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1405) at com.xpn.xwiki.XWiki.copyDocument(XWiki.java:4183) at com.xpn.xwiki.api.XWiki.copyDocument(XWiki.java:1586) at sun.reflect.GeneratedMethodAccessor2053.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173) ... 123 more Caused by: org.hibernate.HibernateException: Failed to commit or rollback transaction. Root cause [] at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:983) at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:744) ... 135 more Caused by: org.hibernate.exception.GenericJDBCException: could not update: [com.xpn.xwiki.doc.rcs.XWikiRCSNodeContent#component[docId,version1,version2]{docId=300726695023087539, version2=1, version1=9}] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2612) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2494) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2821) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:113) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185) 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 org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133) at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:976) ... 136 more Caused by: java.sql.SQLException: Start position [1] cannot exceed overall CLOB length [0] at org.hibernate.engine.jdbc.ClobProxy.invoke(ClobProxy.java:146) at $Proxy102.getSubString(Unknown Source) at com.mysql.jdbc.PreparedStatement.setClob(PreparedStatement.java:2646) at org.apache.commons.dbcp.DelegatingPreparedStatement.setClob(DelegatingPreparedStatement.java:187) at org.apache.commons.dbcp.DelegatingPreparedStatement.setClob(DelegatingPreparedStatement.java:187) at org.apache.commons.dbcp.DelegatingPreparedStatement.setClob(DelegatingPreparedStatement.java:187) at sun.reflect.GeneratedMethodAccessor923.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at net.bull.javamelody.JdbcWrapper$StatementInvocationHandler.invoke(JdbcWrapper.java:146) at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:259) at $Proxy50.setClob(Unknown Source) at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2$1.doBind(ClobTypeDescriptor.java:70) at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1$1.doBind(ClobTypeDescriptor.java:56) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:283) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:278) at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:340) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2184) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2558) ... 148 more