Clean up warnings in spring-web
This commit is contained in:
@@ -39,7 +39,6 @@ import org.apache.http.protocol.HttpContext;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.http.client.ClientHttpRequestFactory} implementation that
|
||||
|
||||
@@ -24,7 +24,6 @@ import io.netty.handler.codec.http.cookie.DefaultCookie;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.io.netty.http.HttpClient;
|
||||
import reactor.io.netty.http.HttpClientRequest;
|
||||
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
|
||||
@@ -17,14 +17,11 @@
|
||||
package org.springframework.http.client.reactive;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.io.netty.http.HttpClientResponse;
|
||||
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.core.io.buffer.DataBufferFactory;
|
||||
import org.springframework.core.io.buffer.NettyDataBufferFactory;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -96,4 +93,5 @@ public class ReactorClientHttpResponse implements ClientHttpResponse {
|
||||
"status=" + getStatusCode() +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ import org.springframework.util.MimeType;
|
||||
* Decode an arbitrary split byte stream representing JSON objects to a byte
|
||||
* stream where each chunk is a well-formed JSON object.
|
||||
*
|
||||
* This class does not do any real parsing or validation. A sequence of byte
|
||||
* <p>This class does not do any real parsing or validation. A sequence of bytes
|
||||
* is considered a JSON object/array if it contains a matching number of opening
|
||||
* and closing braces/brackets.
|
||||
*
|
||||
* Based on <a href="https://github.com/netty/netty/blob/master/codec/src/main/java/io/netty/handler/codec/json/JsonObjectDecoder.java">Netty JsonObjectDecoder</a>
|
||||
* <p>Based on <a href="https://github.com/netty/netty/blob/master/codec/src/main/java/io/netty/handler/codec/json/JsonObjectDecoder.java">Netty JsonObjectDecoder</a>
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @since 5.0
|
||||
@@ -220,7 +220,6 @@ class JsonObjectDecoder extends AbstractDecoder<DataBuffer> {
|
||||
* Override this method if you want to filter the json objects/arrays that
|
||||
* get passed through the pipeline.
|
||||
*/
|
||||
@SuppressWarnings("UnusedParameters")
|
||||
protected ByteBuf extractObject(ByteBuf buffer, int index, int length) {
|
||||
return buffer.slice(index, length).retain();
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
|
||||
@Override
|
||||
public boolean canWrite(Type type, Class<?> clazz, MediaType mediaType) {
|
||||
if (!(type instanceof ParameterizedType)) {
|
||||
return ResourceRegion.class.isAssignableFrom((Class) type);
|
||||
return ResourceRegion.class.isAssignableFrom((Class<?>) type);
|
||||
}
|
||||
ParameterizedType parameterizedType = (ParameterizedType) type;
|
||||
if (!(parameterizedType.getRawType() instanceof Class)) {
|
||||
|
||||
@@ -181,7 +181,6 @@ public class CodecHttpMessageConverter<T> implements HttpMessageConverter<T> {
|
||||
* @param elementType the type of element for encoding
|
||||
* @return the content type, or {@code null}
|
||||
*/
|
||||
@SuppressWarnings("UnusedParameters")
|
||||
protected MediaType getDefaultContentType(ResolvableType elementType) {
|
||||
return (!this.writableMediaTypes.isEmpty() ? this.writableMediaTypes.get(0) : null);
|
||||
}
|
||||
|
||||
@@ -100,4 +100,5 @@ public interface HttpMessageConverter<T> {
|
||||
Mono<Void> write(Publisher<? extends T> inputStream,
|
||||
ResolvableType type, MediaType contentType,
|
||||
ReactiveHttpOutputMessage outputMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.ResourceUtils;
|
||||
/**
|
||||
* Implementation of {@link HttpMessageConverter} that can read and write
|
||||
* {@link Resource Resources} and supports byte range requests.
|
||||
**
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 5.0
|
||||
*/
|
||||
@@ -53,6 +53,7 @@ public class ResourceHttpMessageConverter extends CodecHttpMessageConverter<Reso
|
||||
super(new ResourceEncoder(bufferSize), new ResourceDecoder());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Mono<Void> write(Publisher<? extends Resource> inputStream,
|
||||
ResolvableType type, MediaType contentType,
|
||||
@@ -92,8 +93,7 @@ public class ResourceHttpMessageConverter extends CodecHttpMessageConverter<Reso
|
||||
ZeroCopyHttpOutputMessage zeroCopyResponse =
|
||||
(ZeroCopyHttpOutputMessage) outputMessage;
|
||||
|
||||
return zeroCopyResponse
|
||||
.writeWith(file.get(), (long) 0, file.get().length());
|
||||
return zeroCopyResponse.writeWith(file.get(), 0, file.get().length());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,5 +127,4 @@ public class ResourceHttpMessageConverter extends CodecHttpMessageConverter<Reso
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.http.converter.support;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
import org.springframework.http.converter.FormHttpMessageConverter;
|
||||
import org.springframework.http.converter.json.GsonHttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
|
||||
@@ -27,7 +27,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -114,6 +114,7 @@ public class UndertowServerHttpResponse extends AbstractServerHttpResponse
|
||||
try {
|
||||
StreamSinkChannel responseChannel =
|
||||
getUndertowExchange().getResponseChannel();
|
||||
@SuppressWarnings("resource")
|
||||
FileChannel in = new FileInputStream(file).getChannel();
|
||||
long result = responseChannel.transferFrom(in, position, count);
|
||||
if (result < count) {
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.springframework.context.i18n.LocaleContext;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.remoting.support.RemoteInvocationResult;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpEntity;
|
||||
|
||||
@@ -205,7 +205,7 @@ public final class WebClient {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
protected Mono<Void> writeRequestBody(Publisher<?> content,
|
||||
ResolvableType requestType, ClientHttpRequest request,
|
||||
List<HttpMessageConverter<?>> messageConverters) {
|
||||
|
||||
Reference in New Issue
Block a user