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

Do not use exceptions for control flow

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Minor
    • Resolution: Done
    • None
    • 4.0
    • None

    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

              kinow Bruno P. Kinoshita
              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