Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
o0lwj0o opened this issue Jan 10, 2019 · 3 comments
Closed

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

o0lwj0o opened this issue Jan 10, 2019 · 3 comments
Assignees
Labels
api: compute Issues related to the Compute Engine API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@o0lwj0o
Copy link

o0lwj0o commented Jan 10, 2019

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

@andreamlin andreamlin added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: compute Issues related to the Compute Engine API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Jan 11, 2019
@andreamlin
Copy link
Contributor

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

@andreamlin andreamlin self-assigned this Jan 11, 2019
@andreamlin andreamlin added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Jan 11, 2019
@andreamlin
Copy link
Contributor

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

@andreamlin
Copy link
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
Labels
api: compute Issues related to the Compute Engine API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants