Skip to content

Suggestion : Improvement of String.equals("xxx") #4320

Closed

Description

@o0lwj0o

Hi,
I have found some usage of “String.equals("xxx")” in this project.

When using string.equals("a") ,it will get nullpointexception if string ==null.
The problem can be fixed by repalced with "a".equals(string) or Objects.equals(string,"a").

Detail websites and lines are listed below

77 80 83 86 89 92 95 98 101 104 | https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InsertTargetTcpProxyHttpRequest.java

There are too many cases of "fieldName.equals("xxxxx")" .

Best regards

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: computeIssues related to the Compute Engine API.
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    on Jan 11, 2019
  2. andreamlin commented on Jan 11, 2019

    @andreamlin
    Contributor

    Hi @o0lwj0o (what a username!), thanks a lot for filing this bug. Indeed this is a problem, and it should be easily fixed.

  3. self-assigned this
    on Jan 11, 2019
  4. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    on Jan 11, 2019
  5. andreamlin commented on Jan 11, 2019

    @andreamlin
    Contributor

    This fix will be available in the next release of google-cloud-compute.

  6. andreamlin commented on Jan 18, 2019

    @andreamlin
    Contributor

    Update: this is now in master: f62e169 and in the 0.78-alpha release.

    Thanks again for pointing this out @o0lwj0o !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: computeIssues related to the Compute Engine API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions