Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The recent files panel can break #51

Closed
aubincleme opened this issue Jan 4, 2022 · 1 comment
Closed

The recent files panel can break #51

aubincleme opened this issue Jan 4, 2022 · 1 comment
Assignees
Milestone

Comments

@aubincleme
Copy link
Member

Steps to reproduce :

  • In XWiki 13.4.5, install extension File Manager 2.5.1 in a sub-wiki

After some time, we get the following error on the right panel :

image

The stacktrace is the following :

org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [#set ($discard = $xwiki.ssx.use('FileManagerCode.RecentFilesMacro'))
#resolveDriveReference($driveReference)
#set ($statement = 'from doc.object(FileManagerCode.FileClass) as file ' +
  'where doc.space = :space order by doc.creationDate desc')
#set ($fetchLimit = 100)
#set ($viewLimit = $numbertool.toNumber($xcontext.macro.params.limit).intValue())
#if (!$viewLimit || $viewLimit < 1)
  #set ($viewLimit = 5)
#end
## We retrieve the most recent $fetchLimit files and then list the fist $viewLimit files the current user can view.
#set ($results = $services.query.xwql($statement).bindValue('space',
  $services.model.serialize($driveReference.parent, 'local')).setLimit($fetchLimit).execute())
(% class="filemanager-recent" %)
#set ($i = 0)
#foreach($result in $results)
  #set ($fileDoc = $xwiki.getDocument($result))
  #if ($fileDoc)
    #getFile($fileDoc $file)
    #getFileFolders($fileDoc)
    #set ($fileUrl = $fileDoc.getURL('view'))
    #set ($creatorUrl = $xwiki.getDocument($file.creator).getURL('view'))
    * {{html clean='false'}}
      #mimetypeimg($file.mediaType.toLowerCase() $file.name.toLowerCase())
      <a href="$fileUrl" title="$escapetool.xml($folders)">$escapetool.xml($file.name)</a>
      <span>$escapetool.xml($services.localization.render('fileManager.recentFiles.creator'))</span>
      <a href="$creatorUrl">$xwiki.getUserName($file.creator, false)</a>
      <span>
        $escapetool.xml($services.localization.render(
          'fileManager.recentFiles.creationDate', [$xwiki.formatDate($file.creationDate)]))
      </span>
    {{/html}}
    #set ($i = $i + 1)
    #if ($i >= $viewLimit)
      #break
    #end
  #end
#end
#if ($i == 0)
  * {{translation key="fileManager.recentFiles.noFiles"/}}
  #if ($services.security.authorization.hasAccess('edit', $driveReference.parent))
    * [[{{translation key="fileManager.recentFiles.addFiles"/}}>>$driveReference||queryString="#?driveNode=$escapetool.url($driveReference.name)"]]
  #end
#else
  * [[{{translation key="fileManager.recentFiles.seeAllFiles"/}}>>$driveReference||queryString="#?driveNode=%2FallFiles"]]
#end]
	at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:139)
	at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:52)
	at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:286)
	at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182)
	at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58)
	at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:297)
	at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
	at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.transform(AbstractBlockAsyncRenderer.java:76)
	at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacroRenderer.transform(DefaultWikiMacroRenderer.java:870)
	at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacroRenderer.transform(DefaultWikiMacroRenderer.java:856)
	at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacroRenderer.transform(DefaultWikiMacroRenderer.java:589)
	at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacroRenderer.execute(DefaultWikiMacroRenderer.java:404)
	at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:157)
	at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:54)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:267)
	at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:267)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:250)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:125)
	at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacro.execute(DefaultWikiMacro.java:110)
	at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacro.execute(DefaultWikiMacro.java:53)
	at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:297)
	at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
	at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.transform(AbstractBlockAsyncRenderer.java:76)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRenderer.tranform(DefaultBlockAsyncRenderer.java:143)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRenderer.execute(DefaultBlockAsyncRenderer.java:126)
	at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:157)
	at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:54)
	at org.xwiki.panels.internal.PanelWikiUIExtension.render(PanelWikiUIExtension.java:131)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor$DecoratorWrapper.render(DefaultBlockAsyncRendererExecutor.java:67)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor$DecoratorWrapper.render(DefaultBlockAsyncRendererExecutor.java:49)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:267)
	at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:267)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:250)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:125)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:113)
	at org.xwiki.uiextension.internal.AbstractWikiUIExtension.execute(AbstractWikiUIExtension.java:112)
	at jdk.internal.reflect.GeneratedMethodAccessor271.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704)
	at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:75)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:167)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:492)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:171)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.directive.Foreach.renderBlock(Foreach.java:309)
	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:279)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:171)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
	at org.apache.velocity.Template.merge(Template.java:358)
	at org.apache.velocity.Template.merge(Template.java:262)
	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:280)
	at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:321)
	at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:95)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:217)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:180)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:137)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:53)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:267)
	at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:267)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:250)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:772)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:745)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:725)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:711)
	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:78)
	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2512)
	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:2490)
	at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:997)
	at jdk.internal.reflect.GeneratedMethodAccessor242.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:492)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:218)
	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
	at org.apache.velocity.Template.merge(Template.java:358)
	at org.apache.velocity.Template.merge(Template.java:262)
	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:280)
	at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:321)
	at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:95)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:217)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:180)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:137)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:53)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:267)
	at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:267)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:250)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:772)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:745)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:725)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:711)
	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:78)
	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2512)
	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:2490)
	at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:997)
	at jdk.internal.reflect.GeneratedMethodAccessor242.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:492)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:218)
	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
	at org.apache.velocity.Template.merge(Template.java:358)
	at org.apache.velocity.Template.merge(Template.java:262)
	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:280)
	at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:321)
	at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:95)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:217)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:180)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:137)
	at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:53)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:267)
	at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:267)
	at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:250)
	at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:772)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:745)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:725)
	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:711)
	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:78)
	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2512)
	at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:179)
	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:605)
	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:286)
	at com.xpn.xwiki.web.LegacyActionServlet.service(LegacyActionServlet.java:115)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:122)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:109)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with namespace [sru:FileManagerCode.RecentFilesPanel]
	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:288)
	at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:321)
	at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:131)
	... 195 more
Caused by: org.apache.velocity.exception.VelocityException: Error invoking method 'get(java.lang.Integer)' in java.util.ArrayList at sru:FileManagerCode.RecentFilesPanel[line 5, column 26]
	at org.apache.velocity.runtime.parser.node.ASTIndex.execute(ASTIndex.java:221)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704)
	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:237)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:218)
	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:171)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
	at org.apache.velocity.runtime.directive.Foreach.renderBlock(Foreach.java:309)
	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:279)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
	at org.apache.velocity.Template.merge(Template.java:358)
	at org.apache.velocity.Template.merge(Template.java:262)
	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:280)
	... 197 more
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.GeneratedMethodAccessor331.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
	at org.apache.velocity.runtime.parser.node.ASTIndex.execute(ASTIndex.java:195)
	... 216 more
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:459)
	... 222 more
@aubincleme
Copy link
Member Author

Looking at the code ; it seems that the velocity macro #macro(getFileFolders $fileDoc) gets called with files that are not inside of folders.

In that case, #getFilePaths($fileDoc $paths) will return an empty array ([]), which will make the call for $paths[0] fail in #foreach ($path in $paths[0])

aubincleme added a commit that referenced this issue Jan 4, 2022
* Make sure that a path exists before trying to access it
mflorea added a commit that referenced this issue Jan 4, 2022
The recent files panel can break #51
@mflorea mflorea closed this as completed Jan 4, 2022
@mflorea mflorea added this to the 2.5.1 milestone Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants