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 BEF3B200CFE for ; Fri, 8 Sep 2017 10:56:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BDCC81609C0; Fri, 8 Sep 2017 08:56:08 +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 DDDC81609A7 for ; Fri, 8 Sep 2017 10:56:07 +0200 (CEST) Received: (qmail 54183 invoked by uid 500); 8 Sep 2017 08:56:07 -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 54174 invoked by uid 99); 8 Sep 2017 08:56:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Sep 2017 08:56:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 694FA1A7689 for ; Fri, 8 Sep 2017 08:56:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-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 (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id JD3S03AdF78s for ; Fri, 8 Sep 2017 08:56:01 +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 EE7F261257 for ; Fri, 8 Sep 2017 08:56:00 +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 767BCE0D87 for ; Fri, 8 Sep 2017 08:56:00 +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 2F04724147 for ; Fri, 8 Sep 2017 08:56:00 +0000 (UTC) Date: Fri, 8 Sep 2017 08:56:00 +0000 (UTC) From: "Dennis Balkir (JIRA)" To: notifications@ofbiz.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (OFBIZ-9688) [FB] Package org.apache.ofbiz.service.engine MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 08 Sep 2017 08:56:08 -0000 [ https://issues.apache.org/jira/browse/OFBIZ-9688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dennis Balkir updated OFBIZ-9688: --------------------------------- Attachment: OFBIZ-9688_org.apache.ofbiz.service.engine_bugfixes.patch - Diamond Operators fixed class GroovyEngine: - Line 51: changed the parameter from protected to private class HttpEngine: - Line 191: added a Charset to {{getByte}} - Line 194: added a Charset to {{getByte}} > [FB] Package org.apache.ofbiz.service.engine > -------------------------------------------- > > Key: OFBIZ-9688 > URL: https://issues.apache.org/jira/browse/OFBIZ-9688 > Project: OFBiz > Issue Type: Sub-task > Components: framework > Affects Versions: Trunk > Reporter: Dennis Balkir > Priority: Minor > Attachments: OFBIZ-9688_org.apache.ofbiz.service.engine_bugfixes.patch > > > - GenericEngineFactory.java:67, REC_CATCH_EXCEPTION > REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.service.engine.GenericEngineFactory.getGenericEngine(String) > 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 ... > } > - GroovyEngine.java:-1, CI_CONFUSED_INHERITANCE > CI: Class org.apache.ofbiz.service.engine.GroovyEngine is final but declares protected field org.apache.ofbiz.service.engine.GroovyEngine.EMPTY_ARGS > This class is declared to be final, but declares fields to be protected. Since the class is final, it can not be derived from, and the use of protected is confusing. The access modifier for the field should be changed to private or public to represent the true use for the field. > - HttpEngine.java:64, REC_CATCH_EXCEPTION > REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.service.engine.HttpEngine.runSync(String, ModelService, Map) > 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 ... > } > - HttpEngine.java:137, REC_CATCH_EXCEPTION > REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.service.engine.HttpEngine.httpEngine(HttpServletRequest, HttpServletResponse) > 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 ... > } > - HttpEngine.java:185, DM_DEFAULT_ENCODING > Dm: Found reliance on default encoding in org.apache.ofbiz.service.engine.HttpEngine.httpEngine(HttpServletRequest, HttpServletResponse): String.getBytes() > Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behaviour to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly. > - SOAPClientEngine.java:135, REC_CATCH_EXCEPTION > REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.service.engine.SOAPClientEngine.serviceInvoker(ModelService, Map) > 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 ... -- This message was sent by Atlassian JIRA (v6.4.14#64029)