Skip to content

Commit 3767092

Browse files
committed
Polishing
1 parent ee5143b commit 3767092

File tree

5 files changed

+32
-25
lines changed

5 files changed

+32
-25
lines changed

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -441,20 +441,19 @@ public boolean isMergeEnabled() {
441441

442442
@Override
443443
public Object merge(Object parent) {
444-
if (parent == null) {
445-
return this;
446-
}
447-
if (parent instanceof MockHttpServletRequestBuilder) {
448-
MockHttpServletRequestBuilder copiedParent = MockMvcRequestBuilders.get("/");
449-
copiedParent.merge(parent);
450-
this.parentBuilder = copiedParent;
451-
} else if (parent instanceof RequestBuilder) {
452-
this.parentBuilder = (RequestBuilder) parent;
453-
}
454-
if (parent instanceof SmartRequestBuilder) {
455-
this.parentPostProcessor = (SmartRequestBuilder) parent;
444+
if (parent instanceof RequestBuilder) {
445+
if (parent instanceof MockHttpServletRequestBuilder) {
446+
MockHttpServletRequestBuilder copiedParent = MockMvcRequestBuilders.get("/");
447+
copiedParent.merge(parent);
448+
this.parentBuilder = copiedParent;
449+
}
450+
else {
451+
this.parentBuilder = (RequestBuilder) parent;
452+
}
453+
if (parent instanceof SmartRequestBuilder) {
454+
this.parentPostProcessor = (SmartRequestBuilder) parent;
455+
}
456456
}
457-
458457
return this;
459458
}
460459

spring-tx/src/main/java/org/springframework/transaction/event/ApplicationListenerMethodTransactionalAdapter.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
* an event to a {@link TransactionalEventListener} annotated method. Supports
3333
* the exact same features as any regular {@link EventListener} annotated method
3434
* but is aware of the transactional context of the event publisher.
35-
* <p>
36-
* Processing of {@link TransactionalEventListener} is enabled automatically when
37-
* Spring's transaction management is enabled. For other cases, registering a
38-
* bean of type {@link TransactionalEventListenerFactory} is required.
35+
*
36+
* <p>Processing of {@link TransactionalEventListener} is enabled automatically
37+
* when Spring's transaction management is enabled. For other cases, registering
38+
* a bean of type {@link TransactionalEventListenerFactory} is required.
3939
*
4040
* @author Stephane Nicoll
4141
* @author Juergen Hoeller
@@ -69,8 +69,11 @@ else if (this.annotation.fallbackExecution()) {
6969
}
7070
processEvent(event);
7171
}
72-
else if (logger.isDebugEnabled()) {
73-
logger.debug("No transaction is running - skipping " + event);
72+
else {
73+
// No transactional event execution at all
74+
if (logger.isDebugEnabled()) {
75+
logger.debug("No transaction is active - skipping " + event);
76+
}
7477
}
7578
}
7679

spring-web/src/main/java/org/springframework/http/HttpRange.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public abstract class HttpRange {
5656
public ResourceRegion toResourceRegion(Resource resource) {
5757
// Don't try to determine contentLength on InputStreamResource - cannot be read afterwards...
5858
// Note: custom InputStreamResource subclasses could provide a pre-calculated content length!
59-
Assert.isTrue(InputStreamResource.class != resource.getClass(),
60-
"Can't convert an InputStreamResource to a ResourceRegion");
59+
Assert.isTrue(resource.getClass() != InputStreamResource.class,
60+
"Cannot convert an InputStreamResource to a ResourceRegion");
6161
try {
6262
long contentLength = resource.contentLength();
6363
Assert.isTrue(contentLength > 0, "Resource content length should be > 0");
@@ -163,12 +163,12 @@ else if (dashIdx == 0) {
163163
}
164164

165165
/**
166-
* Convert each {@code HttpRange} into a {@code ResourceRegion},
167-
* selecting the appropriate segment of the given {@code Resource}
168-
* using the HTTP Range information.
166+
* Convert each {@code HttpRange} into a {@code ResourceRegion}, selecting the
167+
* appropriate segment of the given {@code Resource} using HTTP Range information.
169168
* @param ranges the list of ranges
170169
* @param resource the resource to select the regions from
171170
* @return the list of regions for the given resource
171+
* @since 4.3
172172
*/
173173
public static List<ResourceRegion> toResourceRegions(List<HttpRange> ranges, Resource resource) {
174174
if (CollectionUtils.isEmpty(ranges)) {

spring-web/src/main/java/org/springframework/http/MediaType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ public class MediaType extends MimeType implements Serializable {
113113

114114
/**
115115
* Public constant media type for {@code application/pdf}.
116+
* @since 4.3
116117
*/
117118
public final static MediaType APPLICATION_PDF;
118119

119120
/**
120121
* A String equivalent of {@link MediaType#APPLICATION_PDF}.
122+
* @since 4.3
121123
*/
122124
public final static String APPLICATION_PDF_VALUE = "application/pdf";
123125

@@ -193,11 +195,13 @@ public class MediaType extends MimeType implements Serializable {
193195

194196
/**
195197
* Public constant media type for {@code text/markdown}.
198+
* @since 4.3
196199
*/
197200
public final static MediaType TEXT_MARKDOWN;
198201

199202
/**
200203
* A String equivalent of {@link MediaType#TEXT_MARKDOWN}.
204+
* @since 4.3
201205
*/
202206
public final static String TEXT_MARKDOWN_VALUE = "text/markdown";
203207

@@ -295,6 +299,7 @@ public MediaType(String type, String subtype, double qualityValue) {
295299
* @param other the other media type
296300
* @param charset the character set
297301
* @throws IllegalArgumentException if any of the parameters contain illegal characters
302+
* @since 4.3
298303
*/
299304
public MediaType(MediaType other, Charset charset) {
300305
super(other, charset);

spring-websocket/src/main/java/org/springframework/web/socket/WebSocketExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public static List<WebSocketExtension> parseExtensions(String extensions) {
139139
if (StringUtils.hasText(extensions)) {
140140
String[] tokens = StringUtils.tokenizeToStringArray(extensions, ",");
141141
List<WebSocketExtension> result = new ArrayList<WebSocketExtension>(tokens.length);
142-
for (String token : StringUtils.tokenizeToStringArray(extensions, ",")) {
142+
for (String token : tokens) {
143143
result.add(parseExtension(token));
144144
}
145145
return result;

0 commit comments

Comments
 (0)