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

NotFoundExcepiton throws when convert parameter failure in ParamConverter implementation

    Details

      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.

       

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ron_sigal Ronald Sigal
                  Reporter:
                  wuhuaxu huaxu wu
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated: