Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.0.Final
    • Fix Version/s: None
    • Component/s: Templating
    • Labels:
      None

      Description

      I enabled solder catch with this annotations
      @ExceptionMapping.List(

      { @ExceptionMapping(exceptionType = NotFoundException.class, status = 404, message = "Requested resource does not exist."), @ExceptionMapping(exceptionType = IllegalArgumentException.class, status = 400, message = "Illegal argument value.") }

      )

      which should produce 404 for unknown/not mapped urls. But when i enter an unknown url it produces

      java.lang.NullPointerException
      at org.jboss.seam.rest.templating.TemplatingMessageBodyWriter.findAnnotation(TemplatingMessageBodyWriter.java:112)
      at org.jboss.seam.rest.templating.TemplatingMessageBodyWriter.isWriteable(TemplatingMessageBodyWriter.java:97)
      at org.jboss.seam.rest.templating.TemplatingMessageBodyWriter$Proxy$$$_WeldClientProxy.isWriteable(TemplatingMessageBodyWriter$Proxy$$$_WeldClientProxy.java)
      at org.jboss.resteasy.spi.ResteasyProviderFactory.getMessageBodyWriter(ResteasyProviderFactory.java:1033)
      at org.jboss.resteasy.core.SynchronousDispatcher.resolveContentTypeByAccept(SynchronousDispatcher.java:615)
      at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:591)
      at org.jboss.resteasy.core.SynchronousDispatcher.writeFailure(SynchronousDispatcher.java:433)
      at org.jboss.resteasy.core.SynchronousDispatcher.executeExceptionMapper(SynchronousDispatcher.java:335)
      at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:235)
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:129)
      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:594)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1365)
      at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)
      at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:412)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
      at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
      at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
      at org.eclipse.jetty.server.Server.handle(Server.java:351)
      at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
      at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
      at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
      at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
      at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
      at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
      at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
      at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
      at java.lang.Thread.run(Thread.java:722)

      The problem arise from

      protected MediaType resolveContentTypeByAccept(List<MediaType> accepts, Object entity)
      {
      if (accepts == null || accepts.size() == 0 || entity == null)

      { return MediaType.WILDCARD_TYPE; }

      Class clazz = entity.getClass();
      Type type = null;
      if (entity instanceof GenericEntity)

      { GenericEntity gen = (GenericEntity) entity; clazz = gen.getRawType(); type = gen.getType(); }

      for (MediaType accept : accepts)
      {
      if (providerFactory.getMessageBodyWriter(clazz, type, null, accept) != null)

      { return accept; }

      }
      return MediaType.WILDCARD_TYPE;
      }

      as you see getMessageBodyWriter has null as annotations parameter and TemplatingMessageBodyWriter findAnnotation function has this line

      for (Annotation a : annotations)

      which rises NullPointerException

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                capacman anil halil
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: