Skip to content

Cleanup: restore the interrupt flag in email providers #255

Closed

Description

@shossain786

Part of the cleanup cycle from #251. SonarCloud rule java:S2142 flags these spots.

These places catch InterruptedException (often inside catch (Exception e)) and carry on without restoring the thread's interrupt flag. Anything further up that checks Thread.interrupted() (a parallel runner shutting down, a timeout) never sees the interrupt.

Where (line numbers as of master 2a07bba):

  • src/main/java/com/seleniumboot/email/MailhogProvider.java: lines 54, 66
  • src/main/java/com/seleniumboot/email/MailtrapProvider.java: lines 66, 79
  • src/main/java/com/seleniumboot/email/OutlookProvider.java: lines 82, 106, 139, 169

Fix: restore the flag and keep the existing behaviour. For a combined catch, split it out:

} catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    // then the same handling the old catch did (log / wrap / return)
} catch (Exception e) {
    ...
}

Done when: the listed spots restore the interrupt flag, the behaviour is otherwise unchanged, and mvn test passes. Keep this PR to this package. SonarCloud reruns on the PR.

Activity

  1. PUSHPAK-JAISWAL commented on Nov 22, 2026

    @PUSHPAK-JAISWAL
    Contributor

    @shossain786 i will take this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions