Browse Source

Polishing

pull/1723/head
Juergen Hoeller 8 years ago
parent
commit
8e68ac44d2
  1. 4
      spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java
  2. 4
      spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionWrapper.java
  3. 10
      spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java
  4. 2
      spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java
  5. 5
      spring-jms/src/main/java/org/springframework/jms/support/JmsMessageHeaderAccessor.java
  6. 2
      spring-jms/src/main/java/org/springframework/jms/support/SimpleJmsHeaderMapper.java
  7. 2
      spring-orm-hibernate5/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java
  8. 4
      spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java
  9. 5
      spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/webdriver/WebConnectionHtmlUnitDriver.java
  10. 5
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/CompositeRequestCondition.java
  11. 6
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ConsumesRequestCondition.java
  12. 12
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java
  13. 8
      spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java
  14. 3
      spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java
  15. 3
      spring-websocket/src/main/java/org/springframework/web/socket/server/standard/TomcatRequestUpgradeStrategy.java
  16. 3
      spring-websocket/src/main/java/org/springframework/web/socket/server/standard/UndertowRequestUpgradeStrategy.java

4
spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionReader.java

@ -237,6 +237,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp @@ -237,6 +237,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
}
Closure beans = new Closure(this) {
@Override
public Object call(Object[] args) {
invokeBeanDefiningClosure((Closure) args[0]);
return null;
@ -818,14 +819,17 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp @@ -818,14 +819,17 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
return retVal;
}
@Override
public Object invokeMethod(String name, Object args) {
return InvokerHelper.invokeMethod(this.propertyValue, name, args);
}
@Override
public Object getProperty(String name) {
return InvokerHelper.getProperty(this.propertyValue, name);
}
@Override
public void setProperty(String name, Object value) {
InvokerHelper.setProperty(this.propertyValue, name, value);
}

4
spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy/GroovyBeanDefinitionWrapper.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2018 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.
@ -162,6 +162,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport { @@ -162,6 +162,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
}
@Override
public Object getProperty(String property) {
if (this.definitionWrapper.isReadableProperty(property)) {
return this.definitionWrapper.getPropertyValue(property);
@ -172,6 +173,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport { @@ -172,6 +173,7 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
return super.getProperty(property);
}
@Override
public void setProperty(String property, Object newValue) {
if (PARENT.equals(property)) {
setParent(newValue);

10
spring-beans/src/main/java/org/springframework/beans/TypeMismatchException.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 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.
@ -41,7 +41,7 @@ public class TypeMismatchException extends PropertyAccessException { @@ -41,7 +41,7 @@ public class TypeMismatchException extends PropertyAccessException {
/**
* Create a new TypeMismatchException.
* Create a new {@code TypeMismatchException}.
* @param propertyChangeEvent the PropertyChangeEvent that resulted in the problem
* @param requiredType the required target type
*/
@ -50,7 +50,7 @@ public class TypeMismatchException extends PropertyAccessException { @@ -50,7 +50,7 @@ public class TypeMismatchException extends PropertyAccessException {
}
/**
* Create a new TypeMismatchException.
* Create a new {@code TypeMismatchException}.
* @param propertyChangeEvent the PropertyChangeEvent that resulted in the problem
* @param requiredType the required target type (or {@code null} if not known)
* @param cause the root cause (may be {@code null})
@ -69,7 +69,7 @@ public class TypeMismatchException extends PropertyAccessException { @@ -69,7 +69,7 @@ public class TypeMismatchException extends PropertyAccessException {
}
/**
* Create a new TypeMismatchException without PropertyChangeEvent.
* Create a new {@code TypeMismatchException} without a {@code PropertyChangeEvent}.
* @param value the offending value that couldn't be converted (may be {@code null})
* @param requiredType the required target type (or {@code null} if not known)
*/
@ -78,7 +78,7 @@ public class TypeMismatchException extends PropertyAccessException { @@ -78,7 +78,7 @@ public class TypeMismatchException extends PropertyAccessException {
}
/**
* Create a new TypeMismatchException without PropertyChangeEvent.
* Create a new {@code TypeMismatchException} without a {@code PropertyChangeEvent}.
* @param value the offending value that couldn't be converted (may be {@code null})
* @param requiredType the required target type (or {@code null} if not known)
* @param cause the root cause (may be {@code null})

2
spring-core/src/main/java/org/springframework/util/FastByteArrayOutputStream.java

@ -489,6 +489,7 @@ public class FastByteArrayOutputStream extends OutputStream { @@ -489,6 +489,7 @@ public class FastByteArrayOutputStream extends OutputStream {
* Update the message digest with the remaining bytes in this stream.
* @param messageDigest The message digest to update
*/
@Override
public void updateMessageDigest(MessageDigest messageDigest) {
updateMessageDigest(messageDigest, available());
}
@ -499,6 +500,7 @@ public class FastByteArrayOutputStream extends OutputStream { @@ -499,6 +500,7 @@ public class FastByteArrayOutputStream extends OutputStream {
* @param messageDigest The message digest to update
* @param len how many bytes to read from this stream and use to update the message digest
*/
@Override
public void updateMessageDigest(MessageDigest messageDigest, int len) {
if (this.currentBuffer == null) {
// This stream doesn't have any data in it...

5
spring-jms/src/main/java/org/springframework/jms/support/JmsMessageHeaderAccessor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2018 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.
@ -82,7 +82,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor { @@ -82,7 +82,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
}
/**
* Return the {@link JmsHeaders#PRIORITY}.
* Return the {@link JmsHeaders#PRIORITY priority}.
* @see JmsHeaders#PRIORITY
*/
public Integer getPriority() {
@ -117,6 +117,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor { @@ -117,6 +117,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
* Return the {@link JmsHeaders#TIMESTAMP timestamp}.
* @see JmsHeaders#TIMESTAMP
*/
@Override
public Long getTimestamp() {
return (Long) getHeader(JmsHeaders.TIMESTAMP);
}

2
spring-jms/src/main/java/org/springframework/jms/support/SimpleJmsHeaderMapper.java

@ -235,6 +235,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme @@ -235,6 +235,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
* <p>Convert {@link MessageHeaders#CONTENT_TYPE} to {@code content_type} for JMS compliance.
* @see #CONTENT_TYPE_PROPERTY
*/
@Override
protected String fromHeaderName(String headerName) {
if (MessageHeaders.CONTENT_TYPE.equals(headerName)) {
return CONTENT_TYPE_PROPERTY;
@ -247,6 +248,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme @@ -247,6 +248,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
* <p>Convert the JMS-compliant {@code content_type} to {@link MessageHeaders#CONTENT_TYPE}.
* @see #CONTENT_TYPE_PROPERTY
*/
@Override
protected String toHeaderName(String propertyName) {
if (CONTENT_TYPE_PROPERTY.equals(propertyName)) {
return MessageHeaders.CONTENT_TYPE;

2
spring-orm-hibernate5/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java

@ -88,7 +88,7 @@ public class LocalSessionFactoryBuilder extends Configuration { @@ -88,7 +88,7 @@ public class LocalSessionFactoryBuilder extends Configuration {
new AnnotationTypeFilter(Embeddable.class, false),
new AnnotationTypeFilter(MappedSuperclass.class, false)};
private final TypeFilter CONVERTER_TYPE_FILTER = new AnnotationTypeFilter(Converter.class, false);
private static final TypeFilter CONVERTER_TYPE_FILTER = new AnnotationTypeFilter(Converter.class, false);
private final ResourcePatternResolver resourcePatternResolver;

4
spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilder.java

@ -490,6 +490,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -490,6 +490,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
super(servletContext, method, requestURI);
}
@Override
public HttpSession getSession(boolean create) {
HttpSession session = super.getSession(false);
if (session == null && create) {
@ -506,10 +507,12 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -506,10 +507,12 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
return session;
}
@Override
public HttpSession getSession() {
return super.getSession();
}
@Override
public void setSession(HttpSession session) {
super.setSession(session);
}
@ -535,6 +538,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable { @@ -535,6 +538,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
this.request = request;
}
@Override
public void invalidate() {
super.invalidate();
synchronized (HtmlUnitRequestBuilder.this.sessions) {

5
spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/webdriver/WebConnectionHtmlUnitDriver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -91,13 +91,14 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver { @@ -91,13 +91,14 @@ public class WebConnectionHtmlUnitDriver extends HtmlUnitDriver {
* Return the current {@link WebClient}.
* @since 4.3
*/
@Override
public WebClient getWebClient() {
return this.webClient;
}
/**
* Set the {@link WebConnection} to be used with the {@link WebClient}.
* @param webConnection the {@code WebConnection} to use (never {@code null})
* @param webConnection the {@code WebConnection} to use
*/
public void setWebConnection(WebConnection webConnection) {
Assert.notNull(webConnection, "WebConnection must not be null");

5
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/CompositeRequestCondition.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2018 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.
@ -69,12 +69,13 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit @@ -69,12 +69,13 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit
/**
* Whether this instance contains 0 conditions or not.
*/
@Override
public boolean isEmpty() {
return ObjectUtils.isEmpty(this.requestConditions);
}
/**
* Return the underlying conditions, possibly empty but never {@code null}.
* Return the underlying conditions (possibly empty but never {@code null}).
*/
public List<RequestCondition<?>> getConditions() {
return unwrap();

6
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ConsumesRequestCondition.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 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.
@ -28,8 +28,6 @@ import javax.servlet.http.HttpServletRequest; @@ -28,8 +28,6 @@ import javax.servlet.http.HttpServletRequest;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;
import org.springframework.web.HttpMediaTypeException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.cors.CorsUtils;
import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression;
@ -50,7 +48,6 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con @@ -50,7 +48,6 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
private final static ConsumesRequestCondition PRE_FLIGHT_MATCH = new ConsumesRequestCondition();
private final List<ConsumeMediaTypeExpression> expressions;
@ -129,6 +126,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con @@ -129,6 +126,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
/**
* Whether the condition has any media type expressions.
*/
@Override
public boolean isEmpty() {
return this.expressions.isEmpty();
}

12
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 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.
@ -47,14 +47,14 @@ import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.Hea @@ -47,14 +47,14 @@ import org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.Hea
*/
public final class ProducesRequestCondition extends AbstractRequestCondition<ProducesRequestCondition> {
private final static ProducesRequestCondition PRE_FLIGHT_MATCH = new ProducesRequestCondition();
private static final ProducesRequestCondition PRE_FLIGHT_MATCH = new ProducesRequestCondition();
private static final ProducesRequestCondition EMPTY_CONDITION = new ProducesRequestCondition();
private final List<ProduceMediaTypeExpression> MEDIA_TYPE_ALL_LIST =
private static final List<ProduceMediaTypeExpression> MEDIA_TYPE_ALL_LIST =
Collections.singletonList(new ProduceMediaTypeExpression("*/*"));
private final List<ProduceMediaTypeExpression> expressions;
private final ContentNegotiationManager contentNegotiationManager;
@ -66,7 +66,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro @@ -66,7 +66,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
* @param produces expressions with syntax defined by {@link RequestMapping#produces()}
*/
public ProducesRequestCondition(String... produces) {
this(produces, (String[]) null);
this(produces, null, null);
}
/**
@ -310,7 +310,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro @@ -310,7 +310,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
/**
* Parses and matches a single media type expression to a request's 'Accept' header.
*/
class ProduceMediaTypeExpression extends AbstractMediaTypeExpression {
static class ProduceMediaTypeExpression extends AbstractMediaTypeExpression {
ProduceMediaTypeExpression(MediaType mediaType, boolean negated) {
super(mediaType, negated);

8
spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@ -113,6 +113,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat @@ -113,6 +113,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
}
@Override
public void sendMessage(WebSocketMessage<?> message) throws IOException {
if (shouldNotSend()) {
return;
@ -124,10 +125,9 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat @@ -124,10 +125,9 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
do {
if (!tryFlushMessageBuffer()) {
if (logger.isTraceEnabled()) {
String text = String.format("Another send already in progress: " +
logger.trace(String.format("Another send already in progress: " +
"session id '%s':, \"in-progress\" send time %d (ms), buffer size %d bytes",
getId(), getTimeSinceSendStarted(), getBufferSize());
logger.trace(text);
getId(), getTimeSinceSendStarted(), getBufferSize()));
}
checkSessionLimits();
break;

3
spring-websocket/src/main/java/org/springframework/web/socket/server/standard/AbstractTyrusRequestUpgradeStrategy.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -79,6 +79,7 @@ public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStanda @@ -79,6 +79,7 @@ public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStanda
return StringUtils.tokenizeToStringArray(Version.getSupportedWireProtocolVersions(), ",");
}
@Override
protected List<WebSocketExtension> getInstalledExtensions(WebSocketContainer container) {
try {
return super.getInstalledExtensions(container);

3
spring-websocket/src/main/java/org/springframework/web/socket/server/standard/TomcatRequestUpgradeStrategy.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@ -80,6 +80,7 @@ public class TomcatRequestUpgradeStrategy extends AbstractStandardUpgradeStrateg @@ -80,6 +80,7 @@ public class TomcatRequestUpgradeStrategy extends AbstractStandardUpgradeStrateg
}
}
@Override
public WsServerContainer getContainer(HttpServletRequest request) {
return (WsServerContainer) super.getContainer(request);
}

3
spring-websocket/src/main/java/org/springframework/web/socket/server/standard/UndertowRequestUpgradeStrategy.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@ -123,6 +123,7 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat @@ -123,6 +123,7 @@ public class UndertowRequestUpgradeStrategy extends AbstractStandardUpgradeStrat
}
}
@Override
public ServerWebSocketContainer getContainer(HttpServletRequest request) {
return (ServerWebSocketContainer) super.getContainer(request);
}

Loading…
Cancel
Save