You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2019/12/27 08:32:00 UTC

[jira] [Work logged] (MATH-1408) Do not use exceptions for control flow

     [ https://issues.apache.org/jira/browse/MATH-1408?focusedWorklogId=363892&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-363892 ]

ASF GitHub Bot logged work on MATH-1408:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Dec/19 08:31
            Start Date: 27/Dec/19 08:31
    Worklog Time Spent: 10m 
      Work Description: kinow commented on pull request #115: [MATH-1408]: Replace try/catch with CCE by if/else
URL: https://github.com/apache/commons-math/pull/115
 
 
   Replaces the use of `ClassCastException`s in control-flow, by `if`/`else` statements.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 363892)
    Remaining Estimate: 0h
            Time Spent: 10m

> Do not use exceptions for control flow
> --------------------------------------
>
>                 Key: MATH-1408
>                 URL: https://issues.apache.org/jira/browse/MATH-1408
>             Project: Commons Math
>          Issue Type: Task
>            Reporter: Gilles Sadowski
>            Assignee: Bruno P. Kinoshita
>            Priority: Minor
>              Labels: control, exception, flow
>             Fix For: 4.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> There are several occurrences where exception is used to control flow.
> Code such as
> {noformat}
> try  {
>  // block A
> } catch (ClassCastException e) {
>  // block B
> }
> {noformat}
> where "block A" is trying to cast an object "o" to "SomeClass", should be changed to
> {noformat}
> if (o instanceof SomeClass)  {
>  // block A
> } else {
>  // block B
> }
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)