ServletTest#buildJsonRaw: Annotate queryString parameter as @Nullable The queryString parameter may be null, but dereferencing it is protected by a call to Strings.isNullOrEmpty. Change-Id: I2c9a0a7dbd04719b5ad3c64016e585a8409574fe
diff --git a/javatests/com/google/gitiles/BUILD b/javatests/com/google/gitiles/BUILD index 0bb414b..ee28f2f 100644 --- a/javatests/com/google/gitiles/BUILD +++ b/javatests/com/google/gitiles/BUILD
@@ -15,6 +15,7 @@ ) + glob(["**/ServletTest.java"]), deps = DEPS + [ "//java/com/google/gitiles:servlet", + "//lib:jsr305", "//lib:servlet-api_2_5", "//lib:truth", "//lib/jgit:junit",
diff --git a/javatests/com/google/gitiles/ServletTest.java b/javatests/com/google/gitiles/ServletTest.java index 5c1eea1..c642a79 100644 --- a/javatests/com/google/gitiles/ServletTest.java +++ b/javatests/com/google/gitiles/ServletTest.java
@@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken; import java.util.Map; import java.util.Optional; +import javax.annotation.Nullable; import org.eclipse.jgit.internal.storage.dfs.DfsRepository; import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription; import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository; @@ -109,7 +110,7 @@ return res; } - private String buildJsonRaw(String path, String queryString) throws Exception { + private String buildJsonRaw(String path, @Nullable String queryString) throws Exception { String fmt = "format=JSON"; queryString = Strings.isNullOrEmpty(queryString) ? fmt : fmt + "&" + queryString; FakeHttpServletResponse res = buildResponse(path, queryString, SC_OK);