Polishing

This commit is contained in:
Juergen Hoeller 2016-08-31 01:53:03 +02:00
parent ee5143b54b
commit 37670924f6
5 changed files with 32 additions and 25 deletions

View File

@ -441,20 +441,19 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
@Override
public Object merge(Object parent) {
if (parent == null) {
return this;
if (parent instanceof RequestBuilder) {
if (parent instanceof MockHttpServletRequestBuilder) {
MockHttpServletRequestBuilder copiedParent = MockMvcRequestBuilders.get("/");
copiedParent.merge(parent);
this.parentBuilder = copiedParent;
}
else {
this.parentBuilder = (RequestBuilder) parent;
}
if (parent instanceof SmartRequestBuilder) {
this.parentPostProcessor = (SmartRequestBuilder) parent;
}
}
if (parent instanceof MockHttpServletRequestBuilder) {
MockHttpServletRequestBuilder copiedParent = MockMvcRequestBuilders.get("/");
copiedParent.merge(parent);
this.parentBuilder = copiedParent;
} else if (parent instanceof RequestBuilder) {
this.parentBuilder = (RequestBuilder) parent;
}
if (parent instanceof SmartRequestBuilder) {
this.parentPostProcessor = (SmartRequestBuilder) parent;
}
return this;
}

View File

@ -32,10 +32,10 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
* an event to a {@link TransactionalEventListener} annotated method. Supports
* the exact same features as any regular {@link EventListener} annotated method
* but is aware of the transactional context of the event publisher.
* <p>
* Processing of {@link TransactionalEventListener} is enabled automatically when
* Spring's transaction management is enabled. For other cases, registering a
* bean of type {@link TransactionalEventListenerFactory} is required.
*
* <p>Processing of {@link TransactionalEventListener} is enabled automatically
* when Spring's transaction management is enabled. For other cases, registering
* a bean of type {@link TransactionalEventListenerFactory} is required.
*
* @author Stephane Nicoll
* @author Juergen Hoeller
@ -69,8 +69,11 @@ class ApplicationListenerMethodTransactionalAdapter extends ApplicationListenerM
}
processEvent(event);
}
else if (logger.isDebugEnabled()) {
logger.debug("No transaction is running - skipping " + event);
else {
// No transactional event execution at all
if (logger.isDebugEnabled()) {
logger.debug("No transaction is active - skipping " + event);
}
}
}

View File

@ -56,8 +56,8 @@ public abstract class HttpRange {
public ResourceRegion toResourceRegion(Resource resource) {
// Don't try to determine contentLength on InputStreamResource - cannot be read afterwards...
// Note: custom InputStreamResource subclasses could provide a pre-calculated content length!
Assert.isTrue(InputStreamResource.class != resource.getClass(),
"Can't convert an InputStreamResource to a ResourceRegion");
Assert.isTrue(resource.getClass() != InputStreamResource.class,
"Cannot convert an InputStreamResource to a ResourceRegion");
try {
long contentLength = resource.contentLength();
Assert.isTrue(contentLength > 0, "Resource content length should be > 0");
@ -163,12 +163,12 @@ public abstract class HttpRange {
}
/**
* Convert each {@code HttpRange} into a {@code ResourceRegion},
* selecting the appropriate segment of the given {@code Resource}
* using the HTTP Range information.
* Convert each {@code HttpRange} into a {@code ResourceRegion}, selecting the
* appropriate segment of the given {@code Resource} using HTTP Range information.
* @param ranges the list of ranges
* @param resource the resource to select the regions from
* @return the list of regions for the given resource
* @since 4.3
*/
public static List<ResourceRegion> toResourceRegions(List<HttpRange> ranges, Resource resource) {
if (CollectionUtils.isEmpty(ranges)) {

View File

@ -113,11 +113,13 @@ public class MediaType extends MimeType implements Serializable {
/**
* Public constant media type for {@code application/pdf}.
* @since 4.3
*/
public final static MediaType APPLICATION_PDF;
/**
* A String equivalent of {@link MediaType#APPLICATION_PDF}.
* @since 4.3
*/
public final static String APPLICATION_PDF_VALUE = "application/pdf";
@ -193,11 +195,13 @@ public class MediaType extends MimeType implements Serializable {
/**
* Public constant media type for {@code text/markdown}.
* @since 4.3
*/
public final static MediaType TEXT_MARKDOWN;
/**
* A String equivalent of {@link MediaType#TEXT_MARKDOWN}.
* @since 4.3
*/
public final static String TEXT_MARKDOWN_VALUE = "text/markdown";
@ -295,6 +299,7 @@ public class MediaType extends MimeType implements Serializable {
* @param other the other media type
* @param charset the character set
* @throws IllegalArgumentException if any of the parameters contain illegal characters
* @since 4.3
*/
public MediaType(MediaType other, Charset charset) {
super(other, charset);

View File

@ -139,7 +139,7 @@ public class WebSocketExtension {
if (StringUtils.hasText(extensions)) {
String[] tokens = StringUtils.tokenizeToStringArray(extensions, ",");
List<WebSocketExtension> result = new ArrayList<WebSocketExtension>(tokens.length);
for (String token : StringUtils.tokenizeToStringArray(extensions, ",")) {
for (String token : tokens) {
result.add(parseExtension(token));
}
return result;