Skip to content

Commit

Permalink
Fixed NullPointerException Bug
Browse files Browse the repository at this point in the history
`RequestTemplate.header(name, values)` method has two overloaded implementations.
In the case where `values` has type `Iterable<String>`, `values` is guarded against `null`.
This does not happen when `values has type `String...`, which is fixed by this commit
  • Loading branch information
pingpingy1 committed Jan 24, 2024
1 parent 903a5d7 commit c3cd960
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/java/feign/RequestTemplate.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 The Feign Authors
* Copyright 2012-2024 The Feign Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -703,6 +703,10 @@ public Map<String, Collection<String>> queries() {
* @see RequestTemplate#header(String, Iterable)
*/
public RequestTemplate header(String name, String... values) {
if (values == null) {
return appendHeader(name, new Collections.emptyList());
}

return header(name, Arrays.asList(values));
}

Expand Down

0 comments on commit c3cd960

Please sign in to comment.