Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2B0EF200D2A for ; Fri, 13 Oct 2017 23:02:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 298611609E9; Fri, 13 Oct 2017 21:02:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 52CAD160BE5 for ; Fri, 13 Oct 2017 23:02:06 +0200 (CEST) Received: (qmail 53149 invoked by uid 500); 13 Oct 2017 21:02:05 -0000 Mailing-List: contact notifications-help@ofbiz.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ofbiz.apache.org Delivered-To: mailing list notifications@ofbiz.apache.org Received: (qmail 53137 invoked by uid 99); 13 Oct 2017 21:02:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Oct 2017 21:02:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B3428C8BBE for ; Fri, 13 Oct 2017 21:02:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id lsL5CEvmAwnX for ; Fri, 13 Oct 2017 21:02:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 368525FE3D for ; Fri, 13 Oct 2017 21:02:03 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E5B56E2568 for ; Fri, 13 Oct 2017 21:02:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id DD36C2439D for ; Fri, 13 Oct 2017 21:02:00 +0000 (UTC) Date: Fri, 13 Oct 2017 21:02:00 +0000 (UTC) From: "Michael Brohl (JIRA)" To: notifications@ofbiz.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (OFBIZ-9706) [FB] Package org.apache.ofbiz.entity.test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 13 Oct 2017 21:02:07 -0000 [ https://issues.apache.org/jira/browse/OFBIZ-9706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Brohl reassigned OFBIZ-9706: ------------------------------------ Assignee: Michael Brohl > [FB] Package org.apache.ofbiz.entity.test > ----------------------------------------- > > Key: OFBIZ-9706 > URL: https://issues.apache.org/jira/browse/OFBIZ-9706 > Project: OFBiz > Issue Type: Sub-task > Components: ALL APPLICATIONS, ALL COMPONENTS > Affects Versions: Trunk > Reporter: Julian Leichert > Assignee: Michael Brohl > Priority: Minor > Attachments: OFBIZ-9706_org.apache.ofbiz.entity.test_bugfixes.patch > > > EntityQueryTestSuite.java:313, REC_CATCH_EXCEPTION > - REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.entity.test.EntityQueryTestSuite.testQueryIterator() > This method uses a try-catch block that catches Exception objects, but Exception is not thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well, masking potential bugs. > A better approach is to either explicitly catch the specific exceptions that are thrown, or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below: > try { > ... > } catch (RuntimeException e) { > throw e; > } catch (Exception e) { > ... deal with all non-runtime exceptions ... > } > EntityQueryTestSuite.java:348, REC_CATCH_EXCEPTION > - REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.entity.test.EntityQueryTestSuite.testCursorForwardOnly() > This method uses a try-catch block that catches Exception objects, but Exception is not thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well, masking potential bugs. > A better approach is to either explicitly catch the specific exceptions that are thrown, or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below: > try { > ... > } catch (RuntimeException e) { > throw e; > } catch (Exception e) { > ... deal with all non-runtime exceptions ... > } > EntityQueryTestSuite.java:383, REC_CATCH_EXCEPTION > - REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.entity.test.EntityQueryTestSuite.testCursorScrollSensitive() > This method uses a try-catch block that catches Exception objects, but Exception is not thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well, masking potential bugs. > A better approach is to either explicitly catch the specific exceptions that are thrown, or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below: > try { > ... > } catch (RuntimeException e) { > throw e; > } catch (Exception e) { > ... deal with all non-runtime exceptions ... > } > EntityQueryTestSuite.java:418, REC_CATCH_EXCEPTION > - REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.entity.test.EntityQueryTestSuite.testCursorScrollInSensitive() > This method uses a try-catch block that catches Exception objects, but Exception is not thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well, masking potential bugs. > A better approach is to either explicitly catch the specific exceptions that are thrown, or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below: > try { > ... > } catch (RuntimeException e) { > throw e; > } catch (Exception e) { > ... deal with all non-runtime exceptions ... > } > EntityTestSuite.java:462, DM_STRING_TOSTRING > - Dm: org.apache.ofbiz.entity.test.EntityTestSuite.testCountViews() invokes toString() method on a String > Calling String.toString() is just a redundant operation. Just use the String. > EntityTestSuite.java:1201, SIC_INNER_SHOULD_BE_STATIC_ANON > - SIC: The class org.apache.ofbiz.entity.test.EntityTestSuite$1 could be refactored into a named _static_ inner class > This class is an inner class, but does not use its embedded reference to the object which created it. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary. If possible, the class should be made into a static inner class. Since anonymous inner classes cannot be marked as static, doing this will require refactoring the inner class so that it is a named inner class. > EntityTestSuite.java:1215, SIC_INNER_SHOULD_BE_STATIC_ANON > - SIC: The class org.apache.ofbiz.entity.test.EntityTestSuite$2 could be refactored into a named _static_ inner class > This class is an inner class, but does not use its embedded reference to the object which created it. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary. If possible, the class should be made into a static inner class. Since anonymous inner classes cannot be marked as static, doing this will require refactoring the inner class so that it is a named inner class. > EntityTestSuite.java:1260, REC_CATCH_EXCEPTION > - REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.entity.test.EntityTestSuite.testOneBigTransactionIsFasterThanSeveralSmallOnes() > This method uses a try-catch block that catches Exception objects, but Exception is not thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well, masking potential bugs. > A better approach is to either explicitly catch the specific exceptions that are thrown, or to explicitly catch RuntimeException exception, rethrow it, and then catch all non-Runtime Exceptions, as shown below: > try { > ... > } catch (RuntimeException e) { > throw e; > } catch (Exception e) { > ... deal with all non-runtime exceptions ... > } > EntityTestSuite.java:1263, DE_MIGHT_IGNORE > - DE: org.apache.ofbiz.entity.test.EntityTestSuite.testOneBigTransactionIsFasterThanSeveralSmallOnes() might ignore java.lang.Exception > This method might ignore an exception. In general, exceptions should be handled or reported in some way, or they should be thrown out of the method. > EntityTestSuite.java:1314, SIC_INNER_SHOULD_BE_STATIC > - SIC: Should org.apache.ofbiz.entity.test.EntityTestSuite$TestObserver be a _static_ inner class? > This class is an inner class, but does not use its embedded reference to the object which created it. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary. If possible, the class should be made static. > EntityTestSuite.java:1320, URF_UNREAD_FIELD > - UrF: Unread field: org.apache.ofbiz.entity.test.EntityTestSuite$TestObserver.observable > This field is never read. Consider removing it from the class. -- This message was sent by Atlassian JIRA (v6.4.14#64029)