SonarQube Java
  1. SonarQube Java
  2. SONARJAVA-125

Rule S00112: Generic exceptions Error, RuntimeException, Throwable and Exception should never be thrown

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Component/s: PMD, Squid
    • Labels:
      None
    • Number of attachments :
      0

      Description

      http://jira.sonarsource.com/browse/RSPEC-112

      As described in this thread: http://markmail.org/thread/5ewdhxhb5f3a3uv5

      This rule flagged the following code:

      public Error createError() {
        return new Error(); // <--- flagged this line
      }
      

      The Error class in question isn't even a Throwable.

      The PMD rule key is AvoidThrowingRawExceptionTypes

        Issue Links

          Activity

          Hide
          Fabrice Bellingard added a comment -

          Perfect!

          Manually tested.

          Show
          Fabrice Bellingard added a comment - Perfect! Manually tested.
          Hide
          Evgeny Mandrikov added a comment -

          Integration tests were updated.

          Show
          Evgeny Mandrikov added a comment - Integration tests were updated.

            People

            • Assignee:
              Evgeny Mandrikov
              Reporter:
              G. Ann Campbell
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: