Skip to content

[Java-retrofit/retrofit2] String comparison uses for authName == operator #4750

@CodeNinjai

Description

@CodeNinjai
Description

String comparison for authName with == does a reference comparsion, which may work if the string is being optimized by the compiler and points to a single address...

Swagger-codegen version

2.2.1

Java/libraries/retrofit/ApiClient.mustache && Java/libraries/retrofit2/ApiClient.mustache
    {{#authMethods}}if (authName == "{{name}}") { {{#isBasic}}
Potential fix
    {{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions