Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2644

NotFoundExcepiton throws when convert parameter failure in ParamConverter implementation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • 3.12.1.Final
    • jaxrs
    • None

    Description

       

      public class LocalDateParamConverter implements ParamConverter<LocalDate> {
          @Override
          public LocalDate fromString(String value) {
              try {
                  return DateTimeUtil.parseDate(value);
              } catch (Exception e) {
                  throw new IllegalArgumentException("'" +value + "' can not be convert to LocalDate");
              }
          }
      
          @Override
          public String toString(LocalDate value) {
              return DateTimeUtil.formatDate(value);
          }
      }
      

      if exception occurs in fromString method, a NotFoundException will be thrown

      I think a BadRequestException is better in this situation.

       

      Attachments

        Issue Links

          Activity

            People

              rsigal@redhat.com Ronald Sigal
              wuhuaxu huaxu wu (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: