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

NullPointerException (NPE) when accessing objects with ComputedField properties from REST

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 15.1
    • REST
    • None
    • Unknown

    Description

      I get a 500 error when accessing the following URLs from the demo package:

      http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Help/spaces/Applications/spaces/Movies/pages/Modern%20Times/objects/Help.Applications.Movies.Code.MoviesClass/0

      http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Help/spaces/Applications/spaces/Contributors/pages/Frank%20Capra/objects/Help.Applications.Contributors.Code.ContributorsClass/0

      I think this is caused by the presence of ComputedField properties in Help.Applications.Contributors.Code.ContributorsClass and Help.Applications.Movies.Code.MoviesClass because when I remove those fields from {} MoviesClass, the first URL works as espected.

      I get the following trace:

      mars 04, 2023 2:29:32 PM org.restlet.engine.application.StatusFilter doHandle
      AVERTISSEMENT: Exception or error caught by status service 
      java.lang.NullPointerException: Cannot invoke "com.xpn.xwiki.objects.PropertyInterface.getObject()" because "property" is null 
             at org.xwiki.rest.internal.ModelFactory.serializePropertyValue(ModelFactory.java:1071) 
             at org.xwiki.rest.internal.ModelFactory.toRestObject(ModelFactory.java:388) 
             at org.xwiki.rest.internal.resources.objects.ObjectResourceImpl.getObject(ObjectResourceImpl.java:67) 
             at jdk.internal.reflect.GeneratedMethodAccessor125.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:1665) 
             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: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.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.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: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:1571) 
             at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) 
             at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1383) 
             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:1544) 
             at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) 
             at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1305) 
             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:421) 
             at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390) 
             at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277) 
             at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:139) 
             at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411) 
             at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:933) 
             at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1077) 
             at java.base/java.lang.Thread.run(Thread.java:833)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            rjakse Raphaël Jakse
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: