[ 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: {code:java} 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); } catch (Exception ex) { // TODO: send emails logger.log( Level.SEVERE, "could not send standing order ", ex ); out.put(standingOrderInfo, ex); } } return out; } {code} 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: {code:java} private Throwable foo() { try { Thread.sleep(0); return null; } catch (Exception ex) { return ex; } } {code} was: I have the following code: {code:java} 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); } catch (Exception ex) { // TODO: send emails logger.log(Level.SEVERE, "could not send standing order ", ex); out.put(standingOrderInfo, ex); } } return out; } {code} 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: {code:java} private Throwable foo() { try { Thread.sleep(0); return null; } catch (Exception ex) { return ex; } } {code} > 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: > {code:java} > 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); > } catch (Exception ex) { > // TODO: send emails > logger.log( > Level.SEVERE, > "could not send standing order ", > ex > ); > out.put(standingOrderInfo, ex); > } > } > return out; > } > {code} > 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: > {code:java} > private Throwable foo() { > try { > Thread.sleep(0); > return null; > } catch (Exception ex) { > return ex; > } > } > {code} -- 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