Skip to content

Commit 0986acd

Browse files
authored
Merge pull request #3359 from sinofool/master
Not compare Java String with "=="
2 parents cee45bc + f75a42f commit 0986acd

File tree

15 files changed

+37
-37
lines changed

15 files changed

+37
-37
lines changed

modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public class ApiKeyAuth implements Authentication {
5555
} else {
5656
value = apiKey;
5757
}
58-
if (location == "query") {
58+
if ("query".equals(location)) {
5959
queryParams.add(new Pair(paramName, value));
60-
} else if (location == "header") {
60+
} else if ("header".equals(location)) {
6161
headerParams.put(paramName, value);
6262
}
6363
}

modules/swagger-codegen/src/main/resources/Java/libraries/feign/auth/ApiKeyAuth.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public class ApiKeyAuth implements RequestInterceptor {
3232

3333
@Override
3434
public void apply(RequestTemplate template) {
35-
if (location == "query") {
35+
if ("query".equals(location)) {
3636
template.query(paramName, apiKey);
37-
} else if (location == "header") {
37+
} else if ("header".equals(location)) {
3838
template.header(paramName, apiKey);
3939
}
4040
}
41-
}
41+
}

modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/auth/ApiKeyAuth.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ApiKeyAuth implements Interceptor {
4040
String paramValue;
4141
Request request = chain.request();
4242
43-
if (location == "query") {
43+
if ("query".equals(location)) {
4444
String newQuery = request.uri().getQuery();
4545
paramValue = paramName + "=" + apiKey;
4646
if (newQuery == null) {
@@ -58,11 +58,11 @@ public class ApiKeyAuth implements Interceptor {
5858
}
5959

6060
request = request.newBuilder().url(newUri.toURL()).build();
61-
} else if (location == "header") {
61+
} else if ("header".equals(location)) {
6262
request = request.newBuilder()
6363
.addHeader(paramName, apiKey)
6464
.build();
6565
}
6666
return chain.proceed(request);
6767
}
68-
}
68+
}

modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/auth/ApiKeyAuth.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ApiKeyAuth implements Interceptor {
4040
String paramValue;
4141
Request request = chain.request();
4242
43-
if (location == "query") {
43+
if ("query".equals(location)) {
4444
String newQuery = request.url().uri().getQuery();
4545
paramValue = paramName + "=" + apiKey;
4646
if (newQuery == null) {
@@ -58,11 +58,11 @@ public class ApiKeyAuth implements Interceptor {
5858
}
5959

6060
request = request.newBuilder().url(newUri.toURL()).build();
61-
} else if (location == "header") {
61+
} else if ("header".equals(location)) {
6262
request = request.newBuilder()
6363
.addHeader(paramName, apiKey)
6464
.build();
6565
}
6666
return chain.proceed(request);
6767
}
68-
}
68+
}

modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/apikeyauth.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public class ApiKeyAuth implements Authentication {
5353
} else {
5454
value = apiKey;
5555
}
56-
if (location == "query") {
56+
if ("query".equals(location)) {
5757
queryParams.add(new Pair(paramName, value));
58-
} else if (location == "header") {
58+
} else if ("header".equals(location)) {
5959
headerParams.put(paramName, value);
6060
}
6161
}

samples/client/petstore-security-test/java/okhttp-gson/src/main/java/io/swagger/client/auth/ApiKeyAuth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public void applyToParams(List<Pair> queryParams, Map<String, String> headerPara
7878
} else {
7979
value = apiKey;
8080
}
81-
if (location == "query") {
81+
if ("query".equals(location)) {
8282
queryParams.add(new Pair(paramName, value));
83-
} else if (location == "header") {
83+
} else if ("header".equals(location)) {
8484
headerParams.put(paramName, value);
8585
}
8686
}

samples/client/petstore/android/volley/src/main/java/io/swagger/client/auth/ApiKeyAuth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public void applyToParams(List<Pair> queryParams, Map<String, String> headerPara
7676
} else {
7777
value = apiKey;
7878
}
79-
if (location == "query") {
79+
if ("query".equals(location)) {
8080
queryParams.add(new Pair(paramName, value));
81-
} else if (location == "header") {
81+
} else if ("header".equals(location)) {
8282
headerParams.put(paramName, value);
8383
}
8484
}

samples/client/petstore/java/feign/src/main/java/io/swagger/client/auth/ApiKeyAuth.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public void setApiKey(String apiKey) {
3232

3333
@Override
3434
public void apply(RequestTemplate template) {
35-
if (location == "query") {
35+
if ("query".equals(location)) {
3636
template.query(paramName, apiKey);
37-
} else if (location == "header") {
37+
} else if ("header".equals(location)) {
3838
template.header(paramName, apiKey);
3939
}
4040
}
41-
}
41+
}

samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/auth/ApiKeyAuth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public void applyToParams(List<Pair> queryParams, Map<String, String> headerPara
7878
} else {
7979
value = apiKey;
8080
}
81-
if (location == "query") {
81+
if ("query".equals(location)) {
8282
queryParams.add(new Pair(paramName, value));
83-
} else if (location == "header") {
83+
} else if ("header".equals(location)) {
8484
headerParams.put(paramName, value);
8585
}
8686
}

samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/auth/ApiKeyAuth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public void applyToParams(List<Pair> queryParams, Map<String, String> headerPara
7878
} else {
7979
value = apiKey;
8080
}
81-
if (location == "query") {
81+
if ("query".equals(location)) {
8282
queryParams.add(new Pair(paramName, value));
83-
} else if (location == "header") {
83+
} else if ("header".equals(location)) {
8484
headerParams.put(paramName, value);
8585
}
8686
}

0 commit comments

Comments
 (0)