java.text.ParseException: new

Spring JIRA | Sam Brannen | 7 years ago
  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
  3. 0

    How to resolve java.text.ParseException

    Stack Overflow | 3 years ago | Vignesh Vino
    java.text.ParseException: Unparseable date: "New folder"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Default Parameter setting in OpenReports 3.0.

    oreports | 8 years ago | deepz
    java.text.ParseException: Unparseable date: "new Date()"
  6. 0

    java.text.ParseException: Unparseable date on some devices only

    Stack Overflow | 3 months ago | Abhilash
    java.text.ParseException: Unparseable date: "2016-09-06 05:18:06.023 PM" (at offset 24) Weird part is that the device on which this exception has occurred is a friend's Nexus 5. However, if I debug this same string on my Nexus 5 / several other emulators, it works fine. Here is the code that I'm using. SimpleDateFormat belongs to java.text package. Date belongs to java.util package SimpleDateFormat formatGMT = new SimpleDateFormat("yyyy-MM-dd KK:mm:ss.SSS a"); formatGMT.setTimeZone(TimeZone.getTimeZone("GMT")); try { date = formatGMT.parse("2016-09-06 05:18:06.023 PM"); } catch (ParseException e) { Crashlytics.log(Log.ERROR, "DB Insertion error", e.getMessage().toString()); Crashlytics.logException(e); e.printStackTrace(); } Here is the full stack trace. # Crashlytics - plaintext stacktrace Wed, 07 Sep 2016 03:37:44 GMT # Platform: android # Bundle Identifier: com.mypackage.app # Issue #: 306 # Date: 2016-09-06T17:18:04Z # OS Version: 6.0.1 # Device: Nexus 5 # RAM Free: 36.5% # Disk Free: 11% #0. Crashed: pool-3-thread-3: 0 0 0x0000000000000000

    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.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