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

[FB] Package org.apache.ofbiz.accounting.thirdparty.eway (Additional Bugs)

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Resolved
    • Trunk
    • 17.12.01
    • accounting
    • None

    Description

      After adjusting the FindBugs configuration, these new bugs have been found:

      EwayServices.java:99, BX_UNBOXING_IMMEDIATELY_REBOXED

      • Bx: Boxed value is unboxed and then immediately reboxed in org.apache.ofbiz.accounting.thirdparty.eway.EwayServices.ewayCharge(DispatchContext, Map)
        A boxed value is unboxed and then immediately reboxed.

      EwayServices.java:166, BX_UNBOXING_IMMEDIATELY_REBOXED

      • Bx: Boxed value is unboxed and then immediately reboxed in org.apache.ofbiz.accounting.thirdparty.eway.EwayServices.ewayRefund(DispatchContext, Map)
        A boxed value is unboxed and then immediately reboxed.

      EwayServices.java:231, BX_UNBOXING_IMMEDIATELY_REBOXED

      • Bx: Boxed value is unboxed and then immediately reboxed in org.apache.ofbiz.accounting.thirdparty.eway.EwayServices.ewayRelease(DispatchContext, Map)
        A boxed value is unboxed and then immediately reboxed.

      GatewayConnector.java:90, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE

      • RCN: Nullcheck of connection at line 90 of value previously dereferenced in org.apache.ofbiz.accounting.thirdparty.eway.GatewayConnector.sendRequest(GatewayRequest)
        A value is checked here to see whether it is null, but this value can't be null because it was previously dereferenced and if it were null a null pointer exception would have occurred at the earlier dereference. Essentially, this code and the previous dereference disagree as to whether this value is allowed to be null. Either the check is redundant or the previous dereference is erroneous.

      GatewayConnector.java:96, OS_OPEN_STREAM_EXCEPTION_PATH

      • OS: org.apache.ofbiz.accounting.thirdparty.eway.GatewayConnector.sendRequest(GatewayRequest) may fail to close stream on exception
        The method creates an IO stream object, does not assign it to any fields, pass it to other methods, or return it, and does not appear to close it on all possible exception paths out of the method. This may result in a file descriptor leak. It is generally a good idea to use a finally block to ensure that streams are closed.

      GatewayResponse.java:155, DM_CONVERT_CASE

      • Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in new org.apache.ofbiz.accounting.thirdparty.eway.GatewayResponse(InputStream, GatewayRequest)
        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.

      GatewayResponse.java:159, 161, 163, 165, 167, 172, 174, 176 ES_COMPARING_STRINGS_WITH_EQ

      • ES: Comparison of String objects using == or != in new org.apache.ofbiz.accounting.thirdparty.eway.GatewayResponse(InputStream, GatewayRequest)
        This code compares java.lang.String objects for reference equality using the == or != operators. Unless both strings are either constants in a source file, or have been interned using the String.intern() method, the same string value may be represented by two different String objects. Consider using the equals(Object) method instead.

      Attachments

        1. OFBIZ-9528_eway_bugfixes.patch
          7 kB
          Julian Leichert

        Activity

          People

            jleroux Jacques Le Roux
            Kyra Pritzel-Hentley Kyra Pritzel-Hentley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: