You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Alvin Thompson (JIRA)" <ji...@apache.org> on 2018/06/14 17:22:00 UTC
[jira] [Created] (NETBEANS-958) inexplicable "throwable method
result is ignored" warning
Alvin Thompson created NETBEANS-958:
---------------------------------------
Summary: 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
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;}}
{{ }}}
{{ }}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists