jersey
  1. jersey
  2. JERSEY-780

Malformed URL returns a 500 instead of a 400

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8, 1.12, 2.0-m02
    • Fix Version/s: 2.0-m03, 2.0
    • Component/s: containers
    • Labels:
      None
    • Environment:

      Tomcat7, Spring 3.0.5.RELEASE, Java 6, Ubuntu 10.04

      Description

      When a URL with an invalid character is sent jersey throws a URISyntaxException that gets translated into a IllegalArgumentException and sends a 500 back to the client instead of a 400.

      23-Sep-2011 10:46:18 org.apache.catalina.core.StandardWrapperValve invoke
      SEVERE: Servlet.service() for servlet [Jersey Web Application] in context with path [/api] threw exception
      java.lang.IllegalArgumentException
      at java.net.URI.create(URI.java:842)
      at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:95)
      at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:140)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: java.net.URISyntaxException: Illegal character in path at index 49: http://localhost:7071/api/user/173bcth0lkim*^
      at java.net.URI$Parser.fail(URI.java:2809)
      at java.net.URI$Parser.checkChars(URI.java:2982)
      at java.net.URI$Parser.parseHierarchical(URI.java:3066)
      at java.net.URI$Parser.parse(URI.java:3014)
      at java.net.URI.<init>(URI.java:578)
      at java.net.URI.create(URI.java:840)
      ... 20 more

      Related to JERSEY-767

        Activity

        Hide
        mhuffnagle added a comment -

        I can also reproduce this error with the URL http://localhost/users/#<User:0x44d74990>

        Show
        mhuffnagle added a comment - I can also reproduce this error with the URL http://localhost/users/# <User:0x44d74990>

          People

          • Assignee:
            Michal Gajdos
            Reporter:
            iker
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: