You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Pawan Verma (Jira)" <ji...@apache.org> on 2020/06/17 17:27:00 UTC
[jira] [Updated] (OFBIZ-11827) Merge identical catch blocks in
single catch block
[ https://issues.apache.org/jira/browse/OFBIZ-11827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pawan Verma updated OFBIZ-11827:
--------------------------------
Attachment: OFBIZ-11827-plugins.patch
OFBIZ-11827.patch
> Merge identical catch blocks in single catch block
> ---------------------------------------------------
>
> Key: OFBIZ-11827
> URL: https://issues.apache.org/jira/browse/OFBIZ-11827
> Project: OFBiz
> Issue Type: Improvement
> Components: ALL COMPONENTS
> Affects Versions: Trunk
> Reporter: Pawan Verma
> Assignee: Pawan Verma
> Priority: Minor
> Attachments: OFBIZ-11827-plugins.patch, OFBIZ-11827.patch
>
>
> In Java SE 7 and later, a single catch block can handle more than one type of exception. This feature can reduce code duplication and lessen the temptation to catch an overly broad exception.
> For more details: https://docs.oracle.com/javase/8/docs/technotes/guides/language/catch-multiple.html
> Example:
> {code:java}
> catch (IOException ex) {
> logger.log(ex);
> throw ex;
> } catch (SQLException ex) {
> logger.log(ex);
> throw ex;
> }{code}
> Can be written as, which is valid in Java SE 7 and later, eliminates the duplicated code:
>
> {code:java}
> catch (IOException | SQLException ex) {
> logger.log(ex);
> throw ex;
> }{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)