Creating topic with same name in different workspace leads to topic not being created/exception
Issue: The dmx-webpages module equips every user (on-demand) with its personal "Website". The website is created within the users private workspace by default and has always the same name "My collection of webpages".
Reproduce: UserA demands her website. A topic with the name "My collection of webpages" is created and associated with her username topic.
UserB demands her website. A topic with the name "My collection of webpages" can not be created and associated with her username topic because of the following error.
The "Website Name" topic is already associated with the workspace of UserA.
Problem: Two topics with the same value can not be created in different workspaces.
Stacktrace:
Dez 24, 2020 1:34:06 PM systems.dmx.topicmaps.TopicmapsPlugin getTopicmap
INFORMATION: Fetching topicmap 2890, includeChildren=false
Dez 24, 2020 1:34:08 PM systems.dmx.core.util.UniversalExceptionMapper logException
SCHWERWIEGEND: Request "GET /webpages/UserA" failed. Responding with 500 (Internal Server Error). The original exception/error is:
java.lang.RuntimeException: java.lang.RuntimeException: Assigning object 8674 to workspace 4002 failed, object=RelatedTopicModelImpl {
"id": 8674,
"uri": "",
"typeUri": "de.mikromedia.site.name",
"value": "My collection of webpages",
"children": {},
"assoc": {
"id": 8728,
"uri": "",
"typeUri": "dmx.core.composition",
"value": "",
"children": {},
"player1": {
"topicId": 8725,
"roleTypeUri": "dmx.core.parent"
},
"player2": {
"topicId": 8674,
"roleTypeUri": "dmx.core.child"
}
}
}
at de.mikromedia.webpages.WebpagePlugin.createWebsiteTopic(WebpagePlugin.java:721)
at de.mikromedia.webpages.WebpagePlugin.getOrCreateWebsiteTopic(WebpagePlugin.java:671)
at de.mikromedia.webpages.WebpagePlugin.getWebsiteByUsername(WebpagePlugin.java:304)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1480)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1411)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1360)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1350)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:339)
at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:300)
at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:93)
at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:50)
at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:76)
at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:49)
at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Assigning object 8674 to workspace 4002 failed, object=RelatedTopicModelImpl {
"id": 8674,
"uri": "",
"typeUri": "de.mikromedia.site.name",
"value": "My collection of webpages",
"children": {},
"assoc": {
"id": 8728,
"uri": "",
"typeUri": "dmx.core.composition",
"value": "",
"children": {},
"player1": {
"topicId": 8725,
"roleTypeUri": "dmx.core.parent"
},
"player2": {
"topicId": 8674,
"roleTypeUri": "dmx.core.child"
}
}
}
at systems.dmx.core.impl.PrivilegedAccessImpl.assignToWorkspace(PrivilegedAccessImpl.java:345)
at de.mikromedia.webpages.WebpagePlugin$4.call(WebpagePlugin.java:703)
at de.mikromedia.webpages.WebpagePlugin$4.call(WebpagePlugin.java:689)
at systems.dmx.core.util.ContextTracker.run(ContextTracker.java:20)
at systems.dmx.core.impl.PrivilegedAccessImpl.runInWorkspaceContext(PrivilegedAccessImpl.java:354)
at systems.dmx.core.impl.PrivilegedAccessImpl.runWithoutWorkspaceAssignment(PrivilegedAccessImpl.java:359)
at de.mikromedia.webpages.WebpagePlugin.createWebsiteTopic(WebpagePlugin.java:689)
... 53 more
Caused by: java.lang.RuntimeException: object 8674 is already assigned to workspace 3821
at systems.dmx.core.impl.PrivilegedAccessImpl.assignToWorkspace(PrivilegedAccessImpl.java:341)
... 59 more