Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3188

FN in S3039 when using String length()

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.14
    • Fix Version/s: 6.0
    • Component/s: Rules
    • Labels:
      None

      Description

      One of the Noncompliant code examples in the RSPEC-3039 doesn't raise any issue.

      String speech = "Now is the time for all good people to come to the aid of their country.";
      
      String substr1 = speech.substring(-1, speech.length());  // Noncompliant => issue OK
      String substr2 = speech.substring(speech.length(), 0); // Noncompliant => no issue
      char ch = speech.charAt(speech.length());  // Noncompliant => issue OK
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                amelie.renard Amélie Renard
                Reporter:
                nicolas.harraudeau Nicolas Harraudeau
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: