[ 
https://issues.apache.org/jira/browse/NETBEANS-958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alvin Thompson updated NETBEANS-958:
------------------------------------
    Description: 
I have the following code:

{{
foo
}}

{{public Map<StandingOrderInfo, Throwable> sendStandingOrders() {}}
 {{  Map<StandingOrderInfo, Throwable> out = new LinkedHashMap<>();}}
 {{  List<StandingOrderInfo> standingOrders = 
getStandingOrdersThatNeedToRunNow();}}
 {{  for (StandingOrderInfo standingOrderInfo : standingOrders) {}}
 {{    try {}}
 {{      sendStandingOrder(standingOrderInfo);}}
 {{      out.put(standingOrderInfo, null); // warning here}}
 {{    } catch (Exception ex) {}}
 {{      // TODO: send emails}}
 {{      logger.log(}}
 {{        Level.SEVERE,}}
 {{        "could not send standing order " + 
standingOrderInfo.standingOrder.getId() + " for "}}
 \{{ + standingOrderInfo.dayOfWeek + ", " + standingOrderInfo.dateRequested,}}
 {{        ex}}
 {{      );}}
 {{      out.put(standingOrderInfo, ex); // warning here}}
 \{{    }}}
 \{{  }}}
 {{  return out;}}
 \{{ }}}

Judging from the warning description, this warning shouldn't even apply to the 
method that's returning the Throwable, but rather the code that calls the 
method. In any case, the catch clause is clearly doing something with the 
exception. If the warning is intended behavior (that I don't understand), I 
don't see how the code above rises to the level of "probable bug". Can you 
please explain?

What's even more puzzling is that this similar but simpler code works:

{\{ private Throwable foo() {}}
 {{  try {}}
 {{    Thread.sleep(0);}}
 {{    return null;}}
 {{  } catch (Exception ex) {}}
 {{    return ex;}}
 \{{  }}}
 \{{ }}}

 

  was:
I have the following code:

{{public Map<StandingOrderInfo, Throwable> sendStandingOrders() {}}
 {{  Map<StandingOrderInfo, Throwable> out = new LinkedHashMap<>();}}
 {{  List<StandingOrderInfo> standingOrders = 
getStandingOrdersThatNeedToRunNow();}}
 {{  for (StandingOrderInfo standingOrderInfo : standingOrders) {}}
 {{    try {}}
 {{      sendStandingOrder(standingOrderInfo);}}
 {{      out.put(standingOrderInfo, null); // warning here}}
 {{    } catch (Exception ex) {}}
 {{      // TODO: send emails}}
 {{      logger.log(}}
 {{        Level.SEVERE,}}
 {{        "could not send standing order " + 
standingOrderInfo.standingOrder.getId() + " for "}}
 \{{ + standingOrderInfo.dayOfWeek + ", " + standingOrderInfo.dateRequested,}}
 {{        ex}}
 {{      );}}
 {{      out.put(standingOrderInfo, ex); // warning here}}
 \{{    }}}
 \{{  }}}
 {{  return out;}}
 \{{ }}}

Judging from the warning description, this warning shouldn't even apply to the 
method that's returning the Throwable, but rather the code that calls the 
method. In any case, the catch clause is clearly doing something with the 
exception. If the warning is intended behavior (that I don't understand), I 
don't see how the code above rises to the level of "probable bug". Can you 
please explain?

What's even more puzzling is that this similar but simpler code works:

{\{ private Throwable foo() {}}
 {{  try {}}
 {{    Thread.sleep(0);}}
 {{    return null;}}
 {{  } catch (Exception ex) {}}
 {{    return ex;}}
 \{{  }}}
 \{{ }}}

 


> inexplicable "throwable method result is ignored" warning
> ---------------------------------------------------------
>
>                 Key: NETBEANS-958
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-958
>             Project: NetBeans
>          Issue Type: Bug
>          Components: cnd - Editor
>    Affects Versions: 9.0
>         Environment: project JDK: 8
> IDE JDK: 10
>            Reporter: Alvin Thompson
>            Priority: Major
>
> I have the following code:
> {{
> foo
> }}
> {{public Map<StandingOrderInfo, Throwable> sendStandingOrders() {}}
>  {{  Map<StandingOrderInfo, Throwable> out = new LinkedHashMap<>();}}
>  {{  List<StandingOrderInfo> standingOrders = 
> getStandingOrdersThatNeedToRunNow();}}
>  {{  for (StandingOrderInfo standingOrderInfo : standingOrders) {}}
>  {{    try {}}
>  {{      sendStandingOrder(standingOrderInfo);}}
>  {{      out.put(standingOrderInfo, null); // warning here}}
>  {{    } catch (Exception ex) {}}
>  {{      // TODO: send emails}}
>  {{      logger.log(}}
>  {{        Level.SEVERE,}}
>  {{        "could not send standing order " + 
> standingOrderInfo.standingOrder.getId() + " for "}}
>  \{{ + standingOrderInfo.dayOfWeek + ", " + standingOrderInfo.dateRequested,}}
>  {{        ex}}
>  {{      );}}
>  {{      out.put(standingOrderInfo, ex); // warning here}}
>  \{{    }}}
>  \{{  }}}
>  {{  return out;}}
>  \{{ }}}
> Judging from the warning description, this warning shouldn't even apply to 
> the method that's returning the Throwable, but rather the code that calls the 
> method. In any case, the catch clause is clearly doing something with the 
> exception. If the warning is intended behavior (that I don't understand), I 
> don't see how the code above rises to the level of "probable bug". Can you 
> please explain?
> What's even more puzzling is that this similar but simpler code works:
> {\{ private Throwable foo() {}}
>  {{  try {}}
>  {{    Thread.sleep(0);}}
>  {{    return null;}}
>  {{  } catch (Exception ex) {}}
>  {{    return ex;}}
>  \{{  }}}
>  \{{ }}}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to