Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-9450 Fixing defects reported by code analysis tools
  3. OFBIZ-9734

[FB] Package org.apache.ofbiz.party.communication

Attach filesAttach ScreenshotVotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • Trunk
    • 17.12.01
    • party
    • None

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mbrohl Michael Brohl
            jleichert Julian Leichert
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment