Browse Source

Polishing

pull/28694/head
Juergen Hoeller 4 years ago
parent
commit
36e4951b5e
  1. 10
      spring-context/src/test/resources/org/springframework/jmx/export/notificationPublisherTests.xml
  2. 8
      spring-core/src/main/java/org/springframework/core/convert/Property.java
  3. 4
      spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java
  4. 7
      spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java
  5. 9
      spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java

10
spring-context/src/test/resources/org/springframework/jmx/export/notificationPublisherTests.xml

@ -5,19 +5,19 @@ @@ -5,19 +5,19 @@
<bean id="publisher" class="org.springframework.jmx.export.NotificationPublisherTests$MyNotificationPublisher"/>
<bean id="publisherMBean" class="org.springframework.jmx.export.NotificationPublisherTests$MyNotificationPublisherMBean"/>
<bean id="publisherMBean" class="org.springframework.jmx.export.NotificationPublisherTests$MyNotificationPublisherMBean"/>
<bean id="publisherStandardMBean" class="org.springframework.jmx.export.NotificationPublisherTests$MyNotificationPublisherStandardMBean"/>
<bean id="publisherStandardMBean" class="org.springframework.jmx.export.NotificationPublisherTests$MyNotificationPublisherStandardMBean"/>
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="spring:type=Publisher" value-ref="publisher"/>
<entry key="spring:type=PublisherMBean" value-ref="publisherMBean"/>
<entry key="spring:type=PublisherStandardMBean" value-ref="publisherStandardMBean"/>
<entry key="spring:type=PublisherMBean" value-ref="publisherMBean"/>
<entry key="spring:type=PublisherStandardMBean" value-ref="publisherStandardMBean"/>
</map>
</property>
<property name="server" ref="server"/>
<property name="server" ref="server"/>
</bean>
</beans>

8
spring-core/src/main/java/org/springframework/core/convert/Property.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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,7 +47,7 @@ import org.springframework.util.StringUtils; @@ -47,7 +47,7 @@ import org.springframework.util.StringUtils;
*/
public final class Property {
private static Map<Property, Annotation[]> annotationCache = new ConcurrentReferenceHashMap<>();
private static final Map<Property, Annotation[]> annotationCache = new ConcurrentReferenceHashMap<>();
private final Class<?> objectType;
@ -118,7 +118,7 @@ public final class Property { @@ -118,7 +118,7 @@ public final class Property {
}
// package private
// Package private
MethodParameter getMethodParameter() {
return this.methodParameter;
@ -132,7 +132,7 @@ public final class Property { @@ -132,7 +132,7 @@ public final class Property {
}
// internal helpers
// Internal helpers
private String resolveName() {
if (this.readMethod != null) {

4
spring-expression/src/main/java/org/springframework/expression/spel/ast/ConstructorReference.java

@ -288,8 +288,8 @@ public class ConstructorReference extends SpelNodeImpl { @@ -288,8 +288,8 @@ public class ConstructorReference extends SpelNodeImpl {
else {
// There is an initializer
if (this.dimensions == null || this.dimensions.length > 1) {
// There is an initializer but this is a multi-dimensional array (e.g. new int[][]{{1,2},{3,4}}) - this
// is not currently supported
// There is an initializer but this is a multi-dimensional array (e.g. new int[][]{{1,2},{3,4}})
// - this is not currently supported
throw new SpelEvaluationException(getStartPosition(),
SpelMessage.MULTIDIM_ARRAY_INITIALIZER_NOT_SUPPORTED);
}

7
spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
@ -190,7 +190,7 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest { @@ -190,7 +190,7 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest {
@Nullable
protected SslInfo initSslInfo() {
X509Certificate[] certificates = getX509Certificates();
return certificates != null ? new DefaultSslInfo(getSslSessionId(), certificates) : null;
return (certificates != null ? new DefaultSslInfo(getSslSessionId(), certificates) : null);
}
@Nullable
@ -200,8 +200,7 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest { @@ -200,8 +200,7 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest {
@Nullable
private X509Certificate[] getX509Certificates() {
String name = "javax.servlet.request.X509Certificate";
return (X509Certificate[]) this.request.getAttribute(name);
return (X509Certificate[]) this.request.getAttribute("javax.servlet.request.X509Certificate");
}
@Override

9
spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonEncoderTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@ -81,8 +81,6 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE @@ -81,8 +81,6 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
// SPR-15910
assertThat(this.encoder.canEncode(ResolvableType.forClass(Object.class), APPLICATION_OCTET_STREAM)).isFalse();
}
@Override
@ -100,7 +98,7 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE @@ -100,7 +98,7 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
APPLICATION_STREAM_JSON, null);
}
@Test // SPR-15866
@Test // SPR-15866
public void canEncodeWithCustomMimeType() {
MimeType textJavascript = new MimeType("text", "javascript", StandardCharsets.UTF_8);
Jackson2JsonEncoder encoder = new Jackson2JsonEncoder(new ObjectMapper(), textJavascript);
@ -212,7 +210,7 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE @@ -212,7 +210,7 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
null, hints);
}
@Test // gh-22771
@Test // gh-22771
public void encodeWithFlushAfterWriteOff() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.FLUSH_AFTER_WRITE_VALUE, false);
@ -235,7 +233,6 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE @@ -235,7 +233,6 @@ public class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonE
.consumeNextWith(expectString("{\"foo\":\"foo\",\"bar\":\"bar\"}"))
.verifyComplete(),
new MimeType("application", "json", StandardCharsets.US_ASCII), null);
}

Loading…
Cancel
Save