Wicket
  1. Wicket
  2. WICKET-4309

StringValueConversionException for correct situation

    Details

      Description

      StringValue.toOptionalLong() produces org.apache.wicket.util.string.StringValueConversionException if empty string was passed.
      Let me suggest, that this behavior should be changes for all toOptionalXXX methods except getOptionalString method.

      The problem in inner code:

      The problem in following code:

      public final Long toOptionalLong() throws StringValueConversionException

      { return (text == null) ? null : toLongObject(); }

      Should be something like this:

      The problem in following code:

      public final Long toOptionalLong() throws StringValueConversionException

      { return Strings.isEmpty() ? null : toLongObject(); }

      But there is another problem: what to do if incorrect param was passed - for example "abc" for parameter of Long type?

      1. WICKET-4309.patch
        3 kB
        Andrea Del Bene

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Ilia Naryzhny
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development