From 09c070a27e78ef350b7762afc3c17aa35407a167 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 23 Nov 2022 20:32:01 +0800 Subject: [PATCH] update test, suppress warnings in java apache client (#14098) --- .../libraries/apache-httpclient/ApiClient.mustache | 10 +++++++++- .../apachehttpclient/ApacheHttpClientCodegenTest.java | 1 - .../main/java/org/openapitools/client/ApiClient.java | 10 +++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache index 7e4d2181f5a..5aeb9da6b81 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/apache-httpclient/ApiClient.mustache @@ -782,8 +782,16 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { } /** - * Deserialize response content + * Deserialize response body to Java object according to the Content-Type. + * + * @param Type + * @param response Response + * @param valueType Return type + * @return Deserialized object + * @throws ApiException API exception + * @throws IOException IO exception */ + @SuppressWarnings("unchecked") public T deserialize(HttpResponse response, TypeReference valueType) throws ApiException, IOException { if (valueType == null) { return null; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/apachehttpclient/ApacheHttpClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/apachehttpclient/ApacheHttpClientCodegenTest.java index 8ec55391db1..8315833d466 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/apachehttpclient/ApacheHttpClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/apachehttpclient/ApacheHttpClientCodegenTest.java @@ -1,6 +1,5 @@ /* * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) - * Copyright 2018 SmartBear Software * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java index 43308167ad2..273adaad06c 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java @@ -737,8 +737,16 @@ public class ApiClient extends JavaTimeFormatter { } /** - * Deserialize response content + * Deserialize response body to Java object according to the Content-Type. + * + * @param Type + * @param response Response + * @param valueType Return type + * @return Deserialized object + * @throws ApiException API exception + * @throws IOException IO exception */ + @SuppressWarnings("unchecked") public T deserialize(HttpResponse response, TypeReference valueType) throws ApiException, IOException { if (valueType == null) { return null;