[
https://issues.apache.org/jira/browse/OFBIZ-11827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17146791#comment-17146791 ]
ASF subversion and git services commented on OFBIZ-11827:
---------------------------------------------------------
Commit 1f97f89bae0db49da2facf0be28f0cf7ebe4c8e7 in ofbiz-plugins's branch refs/heads/trunk from Pawan Verma
[
https://gitbox.apache.org/repos/asf?p=ofbiz-plugins.git;h=1f97f89 ]
Improved: Merge identical catch blocks in single catch block(OFBIZ-11827)
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.
Thanks: Jacques for the review.
> 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)