xwikisas / application-analytics

GNU Lesser General Public License v2.1
0 stars 1 forks source link

Calling the Analytics filter macro with another macro anywhere in XWiki gives Velocity macro error #78

Closed petrenkonikita112263 closed 7 months ago

petrenkonikita112263 commented 7 months ago

Prerequisites

Steps to reproduce:

  1. Being logged as Admin
  2. Go to any Sandbox pages and start editing it
  3. Find from the CKEditor toolbar "Other macros" button and select "Analytics filter"
  4. And any another macro from Analytics app (example "Country")
  5. Leave data input fields empty
  6. Save page

Actual result: The macro "Analytics filter" display start and end date field, but the 2nd macro "Country" display velocity error with code and empty Live data table

image

Expected result: No errors on the page, and after user provide start and end date it filters the "Country" macro to given interval.

petrenkonikita112263 commented 7 months ago

The issue is present, even if I upgrade the License app as dependency.

image

petrenkonikita112263 commented 7 months ago

Errors in console

2024-04-08 16:06:15,724 [qtp1665404403-812 - http://192.168.150.86:8080/xwiki/bin/view/Sandbox/TestPage3] WARN  o.a.c.b.c.DateConverter        -     DateConverter does not support default String to 'Date' conversion.
2024-04-08 16:06:15,725 [qtp1665404403-812 - http://192.168.150.86:8080/xwiki/bin/view/Sandbox/TestPage3] WARN  o.a.c.b.c.DateConverter        -     (N.B. Re-configure Converter or use alternative implementation)
2024-04-08 16:06:16,565 [qtp1665404403-770 - http://192.168.150.86:8080/xwiki/rest/liveData/sources/liveTable/entries?timestamp=1712581576516&namespace=wiki%3Axwiki&sourceParams.date=&sourceParams.period=range&sourceParams.resultPage=Analytics.Code.Macros.SoftwareDevicesJSON&sourceParams.translationPrefix=analytics.softwareDevices.header.&sourceParams.queryFilters=currentlanguage%2Chidden&sourceParams.label=browser&sourceParams.limitEntries=-1&sourceParams.matomoMethod=DevicesDetection.getBrowsers&properties=browser&properties=visits&properties=nbOfActions&properties=timeSpent&properties=bounceCount&properties=actions&offset=0&limit=15&sort=visits&descending=true] INFO  a.i.BridgeAuthorizationManager - [view] access has been denied for user [xwiki:XWiki.Admin] on [xwiki:Analytics.Code.Macros.SoftwareDevicesJSON]: security checkpoint
2024-04-08 16:06:16,566 [qtp1665404403-770 - http://192.168.150.86:8080/xwiki/rest/liveData/sources/liveTable/entries?timestamp=1712581576516&namespace=wiki%3Axwiki&sourceParams.date=&sourceParams.period=range&sourceParams.resultPage=Analytics.Code.Macros.SoftwareDevicesJSON&sourceParams.translationPrefix=analytics.softwareDevices.header.&sourceParams.queryFilters=currentlanguage%2Chidden&sourceParams.label=browser&sourceParams.limitEntries=-1&sourceParams.matomoMethod=DevicesDetection.getBrowsers&properties=browser&properties=visits&properties=nbOfActions&properties=timeSpent&properties=bounceCount&properties=actions&offset=0&limit=15&sort=visits&descending=true] ERROR r.i.e.ExceptionExceptionMapper - A REST endpoint failed with an unmapped exception.
org.xwiki.livedata.LiveDataException: Failed to execute the live data query.
        at org.xwiki.livedata.internal.livetable.LiveTableLiveDataEntryStore.get(LiveTableLiveDataEntryStore.java:116)
        at org.xwiki.livedata.internal.rest.DefaultLiveDataEntriesResource.getEntries(DefaultLiveDataEntriesResource.java:200)
        at org.xwiki.livedata.internal.rest.DefaultLiveDataEntriesResource.getEntries(DefaultLiveDataEntriesResource.java:79)
        at jdk.internal.reflect.GeneratedMethodAccessor952.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.restlet.ext.jaxrs.internal.wrappers.AbstractMethodWrapper.internalInvoke(AbstractMethodWrapper.java:162)
        at org.restlet.ext.jaxrs.internal.wrappers.ResourceMethod.invoke(ResourceMethod.java:281)
        at org.restlet.ext.jaxrs.JaxRsRestlet.invokeMethod(JaxRsRestlet.java:997)
        at org.restlet.ext.jaxrs.JaxRsRestlet.handle(JaxRsRestlet.java:746)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Router.doHandle(Router.java:422)
        at org.restlet.routing.Router.handle(Router.java:641)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:140)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)
        at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:77)
        at org.restlet.Application.handle(Application.java:385)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Router.doHandle(Router.java:422)
        at org.restlet.routing.Router.handle(Router.java:641)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.routing.Router.doHandle(Router.java:422)
        at org.restlet.routing.Router.handle(Router.java:641)
        at org.restlet.routing.Filter.doHandle(Filter.java:150)
        at org.restlet.routing.Filter.handle(Filter.java:197)
        at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)
        at org.restlet.Component.handle(Component.java:408)
        at org.restlet.Server.handle(Server.java:507)
        at org.restlet.engine.connector.ServerHelper.handle(ServerHelper.java:63)
        at org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:143)
        at org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1117)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
        at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1419)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
        at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1624)
        at com.xpn.xwiki.web.XWikiContextInitializationFilter.doFilter(XWikiContextInitializationFilter.java:82)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594)
        at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594)
        at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594)
        at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594)
        at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594)
        at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:164)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:506)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1571)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1378)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:463)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1544)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1300)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192)
        at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
        at org.eclipse.jetty.server.Server.handle(Server.java:562)
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:418)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:675)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:410)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:319)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
        at org.eclipse.jetty.io.SocketChannelEndPoint$1.run(SocketChannelEndPoint.java:101)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:412)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:381)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:268)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:138)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:407)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:894)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1038)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.xwiki.security.authorization.AccessDeniedException: Access denied when checking [view] access to [xwiki:Analytics.Code.Macros.SoftwareDevicesJSON] for user [xwiki:XWiki.Admin]
        at org.xwiki.security.authorization.DefaultAuthorizationManager.checkAccess(DefaultAuthorizationManager.java:104)
        at org.xwiki.security.authorization.internal.BridgeAuthorizationManager.checkAccess(BridgeAuthorizationManager.java:53)
        at org.xwiki.security.authorization.internal.DefaultContextualAuthorizationManager.checkAccess(DefaultContextualAuthorizationManager.java:99)
        at org.xwiki.security.authorization.internal.DefaultContextualAuthorizationManager.checkAccess(DefaultContextualAuthorizationManager.java:90)
        at org.xwiki.livedata.internal.livetable.LiveTableLiveDataResultsRenderer.getLiveTableResultsFromPage(LiveTableLiveDataResultsRenderer.java:87)
        at org.xwiki.livedata.internal.livetable.LiveTableLiveDataEntryStore.getLiveTableResultsJSON(LiveTableLiveDataEntryStore.java:137)
        at org.xwiki.livedata.internal.livetable.LiveTableLiveDataEntryStore.get(LiveTableLiveDataEntryStore.java:107)
        ... 100 common frames omitted
petrenkonikita112263 commented 7 months ago

It sometimes happens, because I did another install of Analytics Pro 1.0-rc-3 on my another XWiki instance, where I have another pro app (latest version) with License app (also latest version) and the issue doesn't appear.

image

petrenkonikita112263 commented 7 months ago

The issue affects home page of pro app.

oanalavinia commented 7 months ago

This should be fixed after https://github.com/xwikisas/application-analytics/issues/71 is closed. @Farcasut please check after closing #71 if this one can indeed be closed as well

Farcasut commented 7 months ago

Fixed by #71 image