Uploaded image for project: 'Reference Application'
  1. Reference Application
  2. RA-1801 Search and fix minor errors
  3. RA-1812

Comparison of String objects using == or !=

    XMLWordPrintable

Details

    • Technical task
    • Status: Closed
    • Could
    • Resolution: Fixed
    • None
    • None
    • None
    • Low

    Description

      SonarQube:

      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.

      Problem:
      Using == or != to compare String objects.

      Solution:
      Use the equals() method for this.

      Where the problem occurs:

      Support materials:

      Gliffy Diagrams

        Attachments

          Activity

            People

              heshan Heshan Andrews
              sacull Lukasz Debicki
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h