checkstyle WhiteAround
WhiteAroundCheck script
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -103,14 +103,14 @@ abstract class HttpAdapterParsingUtils {
|
||||
|
||||
}
|
||||
|
||||
static void setHttpMethodOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){
|
||||
static void setHttpMethodOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
String httpMethod = element.getAttribute("http-method");
|
||||
String httpMethodExpression = element.getAttribute("http-method-expression");
|
||||
|
||||
boolean hasHttpMethod = StringUtils.hasText(httpMethod);
|
||||
boolean hasHttpMethodExpression = StringUtils.hasText(httpMethodExpression);
|
||||
|
||||
if (hasHttpMethod && hasHttpMethodExpression){
|
||||
if (hasHttpMethod && hasHttpMethodExpression) {
|
||||
parserContext.getReaderContext().error("The 'http-method' and 'http-method-expression' are mutually exclusive. " +
|
||||
"You can only have one or the other", element);
|
||||
}
|
||||
@@ -120,23 +120,23 @@ abstract class HttpAdapterParsingUtils {
|
||||
expressionDef = new RootBeanDefinition(LiteralExpression.class);
|
||||
expressionDef.getConstructorArgumentValues().addGenericArgumentValue(httpMethod);
|
||||
}
|
||||
else if (hasHttpMethodExpression){
|
||||
else if (hasHttpMethodExpression) {
|
||||
expressionDef = new RootBeanDefinition(ExpressionFactoryBean.class);
|
||||
expressionDef.getConstructorArgumentValues().addGenericArgumentValue(httpMethodExpression);
|
||||
}
|
||||
if (expressionDef != null){
|
||||
if (expressionDef != null) {
|
||||
builder.addPropertyValue("httpMethodExpression", expressionDef);
|
||||
}
|
||||
}
|
||||
|
||||
static void setExpectedResponseOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder){
|
||||
static void setExpectedResponseOrExpression(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
String expectedResponseType = element.getAttribute("expected-response-type");
|
||||
String expectedResponseTypeExpression = element.getAttribute("expected-response-type-expression");
|
||||
|
||||
boolean hasExpectedResponseType = StringUtils.hasText(expectedResponseType);
|
||||
boolean hasExpectedResponseTypeExpression = StringUtils.hasText(expectedResponseTypeExpression);
|
||||
|
||||
if (hasExpectedResponseType && hasExpectedResponseTypeExpression){
|
||||
if (hasExpectedResponseType && hasExpectedResponseTypeExpression) {
|
||||
parserContext.getReaderContext().error("The 'expected-response-type' and 'expected-response-type-expression' are mutually exclusive. " +
|
||||
"You can only have one or the other", element);
|
||||
}
|
||||
@@ -146,11 +146,11 @@ abstract class HttpAdapterParsingUtils {
|
||||
expressionDef = new RootBeanDefinition(LiteralExpression.class);
|
||||
expressionDef.getConstructorArgumentValues().addGenericArgumentValue(expectedResponseType);
|
||||
}
|
||||
else if (hasExpectedResponseTypeExpression){
|
||||
else if (hasExpectedResponseTypeExpression) {
|
||||
expressionDef = new RootBeanDefinition(ExpressionFactoryBean.class);
|
||||
expressionDef.getConstructorArgumentValues().addGenericArgumentValue(expectedResponseTypeExpression);
|
||||
}
|
||||
if (expressionDef != null){
|
||||
if (expressionDef != null) {
|
||||
builder.addPropertyValue("expectedResponseTypeExpression", expressionDef);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public class SerializingHttpMessageConverter extends AbstractHttpMessageConverte
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Serializable readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException {
|
||||
try {
|
||||
return (Serializable) new ObjectInputStream(inputMessage.getBody()).readObject();//NOSONAR
|
||||
return (Serializable) new ObjectInputStream(inputMessage.getBody()).readObject(); //NOSONAR
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -64,13 +64,13 @@ public class UploadedMultipartFile implements MultipartFile {
|
||||
this.originalFilename = originalFilename;
|
||||
}
|
||||
|
||||
public UploadedMultipartFile(byte[] bytes, String contentType, String formParameterName,//NOSONAR - direct storage
|
||||
public UploadedMultipartFile(byte[] bytes, String contentType, String formParameterName, //NOSONAR - direct storage
|
||||
String originalFilename) {
|
||||
Assert.notNull(bytes, "bytes must not be null");
|
||||
Assert.hasText(contentType, "contentType is required");
|
||||
Assert.hasText(formParameterName, "formParameterName is required");
|
||||
Assert.hasText(originalFilename, "originalFilename is required");
|
||||
this.bytes = bytes;//NOSONAR - direct storage
|
||||
this.bytes = bytes; //NOSONAR - direct storage
|
||||
this.size = bytes.length;
|
||||
this.file = null;
|
||||
this.contentType = contentType;
|
||||
@@ -87,7 +87,7 @@ public class UploadedMultipartFile implements MultipartFile {
|
||||
@Override
|
||||
public byte[] getBytes() throws IOException {
|
||||
if (this.bytes != null) {
|
||||
return this.bytes;//NOSONAR - direct access
|
||||
return this.bytes; //NOSONAR - direct access
|
||||
}
|
||||
return FileCopyUtils.copyToByteArray(this.file);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -358,8 +358,8 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
try {
|
||||
HttpMethod httpMethod = this.determineHttpMethod(requestMessage);
|
||||
|
||||
if (!this.shouldIncludeRequestBody(httpMethod) && this.extractPayloadExplicitlySet){
|
||||
if (logger.isWarnEnabled()){
|
||||
if (!this.shouldIncludeRequestBody(httpMethod) && this.extractPayloadExplicitlySet) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("The 'extractPayload' attribute has no relevance for the current request since the HTTP Method is '" +
|
||||
httpMethod + "', and no request body will be sent for that method.");
|
||||
}
|
||||
@@ -458,7 +458,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
if (MediaType.APPLICATION_FORM_URLENCODED.equals(httpHeaders.getContentType()) ||
|
||||
MediaType.MULTIPART_FORM_DATA.equals(httpHeaders.getContentType())) {
|
||||
if (!(payload instanceof MultiValueMap)) {
|
||||
payload = this.convertToMultiValueMap((Map<?,?>) payload);
|
||||
payload = this.convertToMultiValueMap((Map<?, ?>) payload);
|
||||
}
|
||||
}
|
||||
return new HttpEntity<Object>(payload, httpHeaders);
|
||||
@@ -492,7 +492,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
// We need to check separately for MULTIPART as well as URLENCODED simply because
|
||||
// MultiValueMap<Object, Object> is actually valid content for serialization
|
||||
if (this.isFormData((Map<Object, ?>) content)) {
|
||||
if (this.isMultipart((Map<String, ?>)content)) {
|
||||
if (this.isMultipart((Map<String, ?>) content)) {
|
||||
contentType = MediaType.MULTIPART_FORM_DATA;
|
||||
}
|
||||
else {
|
||||
@@ -589,9 +589,9 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
}
|
||||
}
|
||||
|
||||
private Object determineExpectedResponseType(Message<?> requestMessage) throws Exception{
|
||||
private Object determineExpectedResponseType(Message<?> requestMessage) throws Exception {
|
||||
Object expectedResponseType = null;
|
||||
if (this.expectedResponseTypeExpression != null){
|
||||
if (this.expectedResponseTypeExpression != null) {
|
||||
expectedResponseType = this.expectedResponseTypeExpression.getValue(this.evaluationContext, requestMessage);
|
||||
}
|
||||
if (expectedResponseType != null) {
|
||||
@@ -600,7 +600,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
|| expectedResponseType instanceof ParameterizedTypeReference,
|
||||
"'expectedResponseType' can be an instance of 'Class<?>', 'String' or 'ParameterizedTypeReference<?>'; "
|
||||
+ "evaluation resulted in a" + expectedResponseType.getClass() + ".");
|
||||
if (expectedResponseType instanceof String && StringUtils.hasText((String) expectedResponseType)){
|
||||
if (expectedResponseType instanceof String && StringUtils.hasText((String) expectedResponseType)) {
|
||||
expectedResponseType = ClassUtils.forName((String) expectedResponseType,
|
||||
getApplicationContext().getClassLoader());
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
* {@link DefaultHttpHeaderMapper#setUserDefinedHeaderPrefix(String)}. The default is 'X-'.
|
||||
* @param outboundHeaderNames The outbound header names.
|
||||
*/
|
||||
public void setOutboundHeaderNames(String[] outboundHeaderNames) {//NOSONAR - false positive
|
||||
public void setOutboundHeaderNames(String[] outboundHeaderNames) { //NOSONAR - false positive
|
||||
if (HTTP_REQUEST_HEADER_NAMES == outboundHeaderNames) {
|
||||
this.isDefaultOutboundMapper = true;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
* {@link DefaultHttpHeaderMapper#setUserDefinedHeaderPrefix(String)}. The default is 'X-'.
|
||||
* @param inboundHeaderNames The inbound header names.
|
||||
*/
|
||||
public void setInboundHeaderNames(String[] inboundHeaderNames) {//NOSONAR - false positive
|
||||
public void setInboundHeaderNames(String[] inboundHeaderNames) { //NOSONAR - false positive
|
||||
this.inboundHeaderNames = inboundHeaderNames != null ?
|
||||
Arrays.copyOf(inboundHeaderNames, inboundHeaderNames.length) : new String[0];
|
||||
this.inboundHeaderNamesLower = new String[this.inboundHeaderNames.length];
|
||||
|
||||
Reference in New Issue
Block a user