java.lang.IllegalArgumentException: "foo" does not contain '/'

Spring JIRA | Neil Brown | 4 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Having upgraded to 3.2.1 I've retested the fix to SPR-9534 (marked as a duplicate of, and resolved by SPR-9142). Whilst some cases of this issue have been fixed (thanks) there is still at least one scenario where the IllegalArgumentException thrown by MediaType.parseMediaType() is not being handled - when no handler is matched. For example, given the following Controller mapping - {code} @Controller @RequestMapping(value = "/channel/{channelId}/communication") public class CommunicationController { ... @RequestMapping(value = "/{commId}/registration", method = RequestMethod.POST, consumes = "application/xml") @ResponseStatus(value = HttpStatus.CREATED) public void preregister(@PathVariable Integer channelId, @PathVariable Integer commId, @RequestBody UserDto userDto, HttpServletRequest request) { ... } ... } {code} A Content-Type header of value "foo", results in an IllegalArgumentException, as per stack-trace: {code} java.lang.IllegalArgumentException: "foo" does not contain '/' at org.springframework.http.MediaType.parseMediaType(MediaType.java:697) at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:208) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:282) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:222) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:55) at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:297) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1091) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1076) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:896) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:827) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) .... {code} *Note* - It may also be useful to note that this problem also existed under 3.1.2 (i.e. it is NOT a SPR-9142 backport error/issue), but rather an edge-case that hasn't already been fixed.

    Spring JIRA | 4 years ago | Neil Brown
    java.lang.IllegalArgumentException: "foo" does not contain '/'
  2. 0

    Having upgraded to 3.2.1 I've retested the fix to SPR-9534 (marked as a duplicate of, and resolved by SPR-9142). Whilst some cases of this issue have been fixed (thanks) there is still at least one scenario where the IllegalArgumentException thrown by MediaType.parseMediaType() is not being handled - when no handler is matched. For example, given the following Controller mapping - {code} @Controller @RequestMapping(value = "/channel/{channelId}/communication") public class CommunicationController { ... @RequestMapping(value = "/{commId}/registration", method = RequestMethod.POST, consumes = "application/xml") @ResponseStatus(value = HttpStatus.CREATED) public void preregister(@PathVariable Integer channelId, @PathVariable Integer commId, @RequestBody UserDto userDto, HttpServletRequest request) { ... } ... } {code} A Content-Type header of value "foo", results in an IllegalArgumentException, as per stack-trace: {code} java.lang.IllegalArgumentException: "foo" does not contain '/' at org.springframework.http.MediaType.parseMediaType(MediaType.java:697) at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:208) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:282) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:222) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:55) at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:297) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1091) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1076) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:896) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:827) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) .... {code} *Note* - It may also be useful to note that this problem also existed under 3.1.2 (i.e. it is NOT a SPR-9142 backport error/issue), but rather an edge-case that hasn't already been fixed.

    Spring JIRA | 4 years ago | Neil Brown
    java.lang.IllegalArgumentException: "foo" does not contain '/'
  3. 0

    java.lang.IllegalArgumentException: "json" does not contain '/'

    Stack Overflow | 3 years ago | Pneumokok
    java.lang.IllegalArgumentException: "json" does not contain '/'
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    RESTEasy / Mailing Lists

    sourceforge.net | 2 years ago
    java.lang.IllegalArgumentException: You did not supply enough values to fill path parameters at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:188) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
  6. 0

    jboss mysql connection validation

    Stack Overflow | 7 years ago | Marko
    java.lang.IllegalArgumentException: id to load is required for loading org.hibernate.event.LoadEvent.<init>(LoadEvent.java:74) org.hibernate.event.LoadEvent.<init>(LoadEvent.java:56) org.hibernate.impl.SessionImpl.get(SessionImpl.java:839) org.hibernate.impl.SessionImpl.get(SessionImpl.java:835) org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182) org.jboss.seam.persistence.EntityManagerProxy.find(EntityManagerProxy.java:87) com.klikmee.tc.providers.ProviderProxy.parseTransactionId(ProviderProxy.java:137) com.klikmee.tc.providers.ProviderProxy.cancel(ProviderProxy.java:382) com.klikmee.tc.providers.ProviderProxy.cancel(ProviderProxy.java:359) com.klikmee.tc.servlets.DatecsTerminalCommunicatorServlet$RequestProcessor.processReverseTransaction(DatecsTerminalCommunicatorServlet.java:395) com.klikmee.tc.servlets.DatecsTerminalCommunicatorServlet$RequestProcessor.process(DatecsTerminalCommunicatorServlet.java:123) com.klikmee.tc.servlets.DatecsTerminalCommunicatorServlet.doPost(DatecsTerminalCommunicatorServlet.java:808) com.klikmee.tc.servlets.DatecsTerminalCommunicatorServlet.doGet(DatecsTerminalCommunicatorServlet.java:862)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      "foo" does not contain '/'

      at org.springframework.http.MediaType.parseMediaType()
    2. Spring
      MediaType.parseMediaType
      1. org.springframework.http.MediaType.parseMediaType(MediaType.java:697)
      1 frame
    3. Spring MVC
      FrameworkServlet.doPost
      1. org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:208)
      2. org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:282)
      3. org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:222)
      4. org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:55)
      5. org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:297)
      6. org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1091)
      7. org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1076)
      8. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:896)
      9. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      10. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
      11. org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:827)
      11 frames
    4. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
      1 frame
    5. Spring MVC
      FrameworkServlet.service
      1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
      1 frame
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      1 frame