You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Julian Leichert (JIRA)" <ji...@apache.org> on 2017/09/21 12:36:00 UTC

[jira] [Updated] (OFBIZ-9734) [FB] Package org.apache.ofbiz.party.communication

     [ https://issues.apache.org/jira/browse/OFBIZ-9734?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Leichert updated OFBIZ-9734:
-----------------------------------
    Attachment: OFBIZ-9734_org.apache.ofbiz.party.communication_bugfixes.patch

class CommunicationServices
 - line 684 : removed useless objects
 - line 753,788 : changed "" to '' to increase performance
 - added locale in multiple lines
 - line 904 : changed to multicatch
 - removed multiple redundant null-checks



> [FB] Package org.apache.ofbiz.party.communication
> -------------------------------------------------
>
>                 Key: OFBIZ-9734
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9734
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: party
>    Affects Versions: Trunk
>            Reporter: Julian Leichert
>            Priority: Minor
>         Attachments: OFBIZ-9734_org.apache.ofbiz.party.communication_bugfixes.patch
>
>
> CommunicationEventServices.java:414, NP_NULL_PARAM_DEREF
> - NP: Null passed for nonnull parameter of org.apache.ofbiz.service.ServiceUtil.getErrorMessage(Map) in org.apache.ofbiz.party.communication.CommunicationEventServices.sendEmailToContactList(DispatchContext, Map)
> This method call passes a null value for a non-null method parameter. Either the parameter is annotated as a parameter that should always be non-null, or analysis has shown that it will always be dereferenced.
> CommunicationEventServices.java:690, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
> - RCN: Redundant nullcheck of contentType, which is known to be non-null in org.apache.ofbiz.party.communication.CommunicationEventServices.storeIncomingEmail(DispatchContext, Map)
> This method contains a redundant check of a known non-null value against the constant null.
> CommunicationEventServices.java:691, DLS_DEAD_LOCAL_STORE
> - DLS: Dead store to contentType in org.apache.ofbiz.party.communication.CommunicationEventServices.storeIncomingEmail(DispatchContext, Map)
> This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, because the value computed is never used.
> Note that Sun's javac compiler often generates dead stores for final local variables. Because FindBugs is a bytecode-based tool, there is no easy way to eliminate these false positives.
> CommunicationEventServices.java:691, DM_CONVERT_CASE
> - Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in org.apache.ofbiz.party.communication.CommunicationEventServices.storeIncomingEmail(DispatchContext, Map)
> A String is being converted to upper or lowercase, using the platform's default encoding. This may result in improper conversions when used with international characters. Use the
>     String.toUpperCase( Locale l )
>     String.toLowerCase( Locale l )
> versions instead.
> CommunicationEventServices.java:917, REC_CATCH_EXCEPTION
> - REC: Exception is caught when Exception is not thrown in org.apache.ofbiz.party.communication.CommunicationEventServices.storeIncomingEmail(DispatchContext, 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 ...
>   }
> CommunicationEventServices.java:1003, DM_CONVERT_CASE
> - Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in org.apache.ofbiz.party.communication.CommunicationEventServices.createAttachmentContent(LocalDispatcher, Delegator, MimeMessageWrapper, String, GenericValue)
> A String is being converted to upper or lowercase, using the platform's default encoding. This may result in improper conversions when used with international characters. Use the
>     String.toUpperCase( Locale l )
>     String.toLowerCase( Locale l )
> versions instead.
> CommunicationEventServices.java:1014, NP_NULL_ON_SOME_PATH
> - NP: Possible null pointer dereference of attContentType in org.apache.ofbiz.party.communication.CommunicationEventServices.createAttachmentContent(LocalDispatcher, Delegator, MimeMessageWrapper, String, GenericValue)
> There is a branch of statement that, if executed, guarantees that a null value will be dereferenced, which would generate a NullPointerException when the code is executed. Of course, the problem might be that the branch or statement is infeasible and that the null pointer exception can't ever be executed; deciding that is beyond the ability of FindBugs.
> CommunicationEventServices.java:1113, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
> - RCN: Redundant nullcheck of emailAddress, which is known to be non-null in org.apache.ofbiz.party.communication.CommunicationEventServices.buildListOfPartyInfoFromEmailAddresses(Address[], GenericValue, LocalDispatcher)
> This method contains a redundant check of a known non-null value against the constant null.
> CommunicationEventServices.java:1140, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
> - RCN: Redundant nullcheck of emailAddress, which is known to be non-null in org.apache.ofbiz.party.communication.CommunicationEventServices.buildListOfWorkEffortInfoFromEmailAddresses(Address[], GenericValue, LocalDispatcher)
> This method contains a redundant check of a known non-null value against the constant null.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)