Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-306

AttachmentFileNameIs may throw UnsupportedEncodingException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0
    • Labels:
      None

      Description

      As the purpose of the matcher is to find matching attachments, the code is written with the following logic:

      1) If there are attachements
      1.1) If at least one of them matches, the matcher returns a match.
      1.2) If none of them matches
      1.2.1) If there is no exception, the matcher returns a no-match.
      1.2.2) If there is any exception, the matcher throws a MessagingException.
      2) If there are no attachements
      2.1) If there is no exception, the matcher returns a no-match.
      2.2) If there is any exception, the matcher throws a MessagingException.

      The important thing here is that in case 1.1 an exception is never thrown, and it would be a major bug. Instead all the other cases (1.2.1, 1.2.2, 2.1 and 2.2) can all be considered simply as a no-match, and that's why I use (and suggest to use) an onMatchException="noMatch" clause in the invocation if looking for "dangerous" attachments.

      In any case, just to avoid any future confusion, we should catch and ignore any exception corresponding to "unsupported" (but irrelevant as not related to attachments) encodings, and let flow up only other types of exceptions, to be handled by an appropriate onMatchException clause whose choice is up to the James administrator.

        Activity

        Hide
        vincenzo Vincenzo Gianferrari Pini added a comment -

        Such exceptions are totally harmless and as such are completely ignored by the committed fix.
        In such fix, other exceptions are thrown up (to be handled by "onMatchException" clause) and logged if debug is requested ("-d" parameter).

        Show
        vincenzo Vincenzo Gianferrari Pini added a comment - Such exceptions are totally harmless and as such are completely ignored by the committed fix. In such fix, other exceptions are thrown up (to be handled by "onMatchException" clause) and logged if debug is requested ("-d" parameter).
        Hide
        danny@apache.org Danny Angus added a comment -

        Closing issue fixed in released version.

        Show
        danny@apache.org Danny Angus added a comment - Closing issue fixed in released version.

          People

          • Assignee:
            vincenzo Vincenzo Gianferrari Pini
            Reporter:
            vincenzo Vincenzo Gianferrari Pini
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development