Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-1408

Do not use exceptions for control flow

    XMLWordPrintableJSON

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 4.0

      Description

      There are several occurrences where exception is used to control flow.
      Code such as

      try  {
       // block A
      } catch (ClassCastException e) {
       // block B
      }
      

      where "block A" is trying to cast an object "o" to "SomeClass", should be changed to

      if (o instanceof SomeClass)  {
       // block A
      } else {
       // block B
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kinow Bruno P. Kinoshita
                Reporter:
                erans Gilles Sadowski
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m