java.text.ParseException: new

Spring JIRA | Sam Brannen | 7 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Given the following @MVC controllers... {code} @Controller @RequestMapping(value = "/{id}") public class OrderDetailsController { @RequestMapping(method = GET) public String display(@PathVariable("id") Long id) { // ... } } {code} {code} @Controller @RequestMapping("/new*") public class NewOrderController { @RequestMapping(method = GET) public final String edit() { // ... } } {code} ...the following URL worked with Spring 3.0.0.RC2: http://localhost:8080/order/new After upgrading from RC2 to RC3, I get the following exception when attempting to access the above URL: {code} org.springframework.core.convert.ConversionFailedException: Unable to convert value new from type [java.lang.String] to type [java.lang.Long]; reason = 'Unable to convert value new from type [java.lang.String] to type [java.lang.Long]; reason = 'new'; nested exception is java.text.ParseException: new'; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value new from type [java.lang.String] to type [java.lang.Long; reason = 'new'; nested exception is java.text.ParseException: new at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:40) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:130) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:199) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:104) at org.springframework.beans.SimpleTypeConverter.convertIfNecessary(SimpleTypeConverter.java:47) at org.springframework.validation.DataBinder.convertIfNecessary(DataBinder.java:526) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolvePathVariable(HandlerMethodInvoker.java:618) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:292) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:164) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:385) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:373) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) ... {code} The only way to access the "new" page with the "/new*" RequestMapping is by adding a bogus file extension such as ".htm" (FYI: simply appending a dot "." suffices), for example: http://localhost:8080/order/new.htm or http://localhost:8080/order/new. By using a "/new/*" RequestMapping instead, the "new" page can only be accessed by adding a bogus subpath such as "/x" (FYI: simply appending a slash "/" does not suffice), for example: http://localhost:8080/order/new/x Changing the RequestMapping for the OrderDetailsController from "/{id}" to "/{id}/" almost effects the desired reseults; however, this mapping requires that URLs such as http://localhost:8080/order/10000 be appended with a trailing slash "/" which is undesirable. In the end, using a RequestMapping of "/{id}**" for the OrderDetailsController achieves the desired results (i.e., same behavior as with Spring 3.0.0.RC2). Thus the question remains: Was this change intentional? Or should the mappings from RC2 continue to work with RC3 and beyond?

    Spring JIRA | 7 years ago | Sam Brannen
    java.text.ParseException: new
  2. 0

    Given the following @MVC controllers... {code} @Controller @RequestMapping(value = "/{id}") public class OrderDetailsController { @RequestMapping(method = GET) public String display(@PathVariable("id") Long id) { // ... } } {code} {code} @Controller @RequestMapping("/new*") public class NewOrderController { @RequestMapping(method = GET) public final String edit() { // ... } } {code} ...the following URL worked with Spring 3.0.0.RC2: http://localhost:8080/order/new After upgrading from RC2 to RC3, I get the following exception when attempting to access the above URL: {code} org.springframework.core.convert.ConversionFailedException: Unable to convert value new from type [java.lang.String] to type [java.lang.Long]; reason = 'Unable to convert value new from type [java.lang.String] to type [java.lang.Long]; reason = 'new'; nested exception is java.text.ParseException: new'; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value new from type [java.lang.String] to type [java.lang.Long; reason = 'new'; nested exception is java.text.ParseException: new at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:40) at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:130) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:199) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:104) at org.springframework.beans.SimpleTypeConverter.convertIfNecessary(SimpleTypeConverter.java:47) at org.springframework.validation.DataBinder.convertIfNecessary(DataBinder.java:526) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolvePathVariable(HandlerMethodInvoker.java:618) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:292) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:164) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:385) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:373) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) ... {code} The only way to access the "new" page with the "/new*" RequestMapping is by adding a bogus file extension such as ".htm" (FYI: simply appending a dot "." suffices), for example: http://localhost:8080/order/new.htm or http://localhost:8080/order/new. By using a "/new/*" RequestMapping instead, the "new" page can only be accessed by adding a bogus subpath such as "/x" (FYI: simply appending a slash "/" does not suffice), for example: http://localhost:8080/order/new/x Changing the RequestMapping for the OrderDetailsController from "/{id}" to "/{id}/" almost effects the desired reseults; however, this mapping requires that URLs such as http://localhost:8080/order/10000 be appended with a trailing slash "/" which is undesirable. In the end, using a RequestMapping of "/{id}**" for the OrderDetailsController achieves the desired results (i.e., same behavior as with Spring 3.0.0.RC2). Thus the question remains: Was this change intentional? Or should the mappings from RC2 continue to work with RC3 and beyond?

    Spring JIRA | 7 years ago | Sam Brannen
    java.text.ParseException: new

    Root Cause Analysis

    1. java.text.ParseException

      new

      at org.springframework.core.convert.support.ConversionUtils.invokeConverter()
    2. Spring Core
      GenericConversionService.convert
      1. org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:40)
      2. org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:130)
      2 frames
    3. Spring Beans
      SimpleTypeConverter.convertIfNecessary
      1. org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:199)
      2. org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:104)
      3. org.springframework.beans.SimpleTypeConverter.convertIfNecessary(SimpleTypeConverter.java:47)
      3 frames
    4. Spring Context
      DataBinder.convertIfNecessary
      1. org.springframework.validation.DataBinder.convertIfNecessary(DataBinder.java:526)
      1 frame
    5. Spring
      HandlerMethodInvoker.invokeHandlerMethod
      1. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolvePathVariable(HandlerMethodInvoker.java:618)
      2. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:292)
      3. org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:164)
      3 frames
    6. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:385)
      2. org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:373)
      3. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
      4. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
      5. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
      6. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
      6 frames
    7. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      2 frames