Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-21278

Possible error when trying to perform a save with deleting right object

    XMLWordPrintable

Details

    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      Reproduction steps:

      • Create a user Foo on a fresh wiki
      • Create a page Test with Admin user
      • Go to Administer -> Right of the page
      • Deny Foo the script right on that page
      • Login with Foo and edit the page with object editor
      • Delete the right xobject
      • Click save & view

      Expected result:

      • The page is saved properly but when accessing the object editor the right xobject is still there as Foo doesn't have right to manipulate it, RightFilterListener prevents performing such manipulation

      Obtained result:

      • A notification error message appears, the user is not redirected to view the page and remains in object editor, the console displays the following stack trace:
        2023-08-30 16:56:19,261 [qtp149047107-416 - http://localhost:8080/xwiki/bin/save/MyPage/WebHome] WARN  c.x.x.w.XWikiAction            - Uncaught exception: Error number 3201 in 3: Exception while saving document xwiki:MyPage.WebHome 
        com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:MyPage.WebHome
        	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:746)
        	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:255)
        	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:215)
        	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:2111)
        	at com.xpn.xwiki.web.SaveAction.save(SaveAction.java:298)
        	at com.xpn.xwiki.web.SaveAction.action(SaveAction.java:524)
        	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:636)
        	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:339)
        	at com.xpn.xwiki.web.LegacyActionServlet.service(LegacyActionServlet.java:112)
        	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:1665)
        	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:122)
        	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        	at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:61)
        	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
        	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        	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:1635)
        	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:1635)
        	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
        	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
        	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:596)
        	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:1570)
        	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
        	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
        	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
        	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
        	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
        	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
        	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
        	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
        	at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:215)
        	at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:135)
        	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112)
        	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        	at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:61)
        	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        	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:1635)
        	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
        	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        	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:1635)
        	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
        	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210)
        	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        	at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
        	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
        	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:1570)
        	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
        	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
        	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
        	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
        	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
        	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
        	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
        	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:563)
        	at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
        	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
        	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
        	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
        	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
        	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
        	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
        	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
        	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
        	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
        	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)
        	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
        	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
        	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
        	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
        	at java.base/java.lang.Thread.run(Thread.java:829)
        Caused by: com.xpn.xwiki.XWikiException: Error number 3211 in 3: Exception while saving object MyPage.WebHome
        	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:1472)
        	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:716)
        	... 98 common frames omitted
        Caused by: org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session : [com.xpn.xwiki.objects.BaseObject#5549891865985907633]
        	at org.hibernate.engine.internal.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:700)
        	at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:287)
        	at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:230)
        	at org.hibernate.event.internal.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:38)
        	at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:75)
        	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
        	at org.hibernate.internal.SessionImpl.fireUpdate(SessionImpl.java:694)
        	at org.hibernate.internal.SessionImpl.update(SessionImpl.java:687)
        	at org.hibernate.engine.spi.SessionDelegatorBaseImpl.update(SessionDelegatorBaseImpl.java:860)
        	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiCollection(XWikiHibernateStore.java:1387)
        	... 99 common frames omitted
        

      Attachments

        Issue Links

          Activity

            People

              surli Simon Urli
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: