Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Sep 26, 2017
1 parent a4b2ae5 commit efce790
Show file tree
Hide file tree
Showing 43 changed files with 107 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void fatal(String message, @Nullable Object source, @Nullable ParseState
}

/**
* Raise a fatal error.
* Raise a regular error.
*/
public void error(String message, @Nullable Object source) {
error(message, source, null, null);
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public NoOpCache(String name) {
}



@Override
public String getName() {
return this.name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ private static ResolvableType resolveDeclaredEventType(ApplicationListener<Appli
ResolvableType declaredEventType = resolveDeclaredEventType(listener.getClass());
if (declaredEventType == null || declaredEventType.isAssignableFrom(
ResolvableType.forClass(ApplicationEvent.class))) {

Class<?> targetClass = AopUtils.getTargetClass(listener);
if (targetClass != listener.getClass()) {
declaredEventType = resolveDeclaredEventType(targetClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ public void setMappingLocations(Resource... mappingLocations) {
* Merges the {@code Properties} configured in the {@code mappings} and
* {@code mappingLocations} into the final {@code Properties} instance
* used for {@code ObjectName} resolution.
* @throws IOException
*/
@Override
public void afterPropertiesSet() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -142,7 +142,7 @@ public String[] resolveMessageCodes(String errorCode, String objectName) {
* object/field-specific code, a field-specific code, a plain error code.
* <p>Arrays, Lists and Maps are resolved both for specific elements and
* the whole collection.
* <p>See the {@link DefaultMessageCodesResolver class level Javadoc} for
* <p>See the {@link DefaultMessageCodesResolver class level javadoc} for
* details on the generated codes.
* @return the list of codes
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public abstract class VfsUtils {
Class<?> visitorAttributesClass = loader.loadClass(VFS3_PKG + "VisitorAttributes");
VISITOR_ATTRIBUTES_FIELD_RECURSE = visitorAttributesClass.getField("RECURSE");
}
catch (Exception ex) {
catch (Throwable ex) {
throw new IllegalStateException("Could not detect JBoss VFS infrastructure", ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private Expression[] parseExpressions(String expressionString, ParserContext con
String prefix = context.getExpressionPrefix();
String suffix = context.getExpressionSuffix();
int startIdx = 0;

while (startIdx < expressionString.length()) {
int prefixIndex = expressionString.indexOf(prefix, startIdx);
if (prefixIndex >= startIdx) {
Expand All @@ -104,22 +105,18 @@ private Expression[] parseExpressions(String expressionString, ParserContext con
"No ending suffix '" + suffix + "' for expression starting at character " +
prefixIndex + ": " + expressionString.substring(prefixIndex));
}

if (suffixIndex == afterPrefixIndex) {
throw new ParseException(expressionString, prefixIndex,
"No expression defined within delimiter '" + prefix + suffix +
"' at character " + prefixIndex);
}

String expr = expressionString.substring(prefixIndex + prefix.length(), suffixIndex);
expr = expr.trim();

if (expr.isEmpty()) {
throw new ParseException(expressionString, prefixIndex,
"No expression defined within delimiter '" + prefix + suffix +
"' at character " + prefixIndex);
}

expressions.add(doParseExpression(expr, context));
startIdx = suffixIndex + suffix.length();
}
Expand All @@ -129,6 +126,7 @@ private Expression[] parseExpressions(String expressionString, ParserContext con
startIdx = expressionString.length();
}
}

return expressions.toArray(new Expression[expressions.size()]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class FunctionReference extends SpelNodeImpl {


public FunctionReference(String functionName, int pos, SpelNodeImpl... arguments) {
super(pos,arguments);
super(pos, arguments);
this.name = functionName;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ public String getExitDescriptor() {


/**
* Generate code that handles building the argument values for the specified method. This method will take account
* of whether the invoked method is a varargs method and if it is then the argument values will be appropriately
* packaged into an array.
* Generate code that handles building the argument values for the specified method.
* This method will take account of whether the invoked method is a varargs method
* and if it is then the argument values will be appropriately packaged into an array.
* @param mv the method visitor where code should be generated
* @param cf the current codeflow
* @param member the method or constructor for which arguments are being setup
Expand All @@ -208,7 +208,7 @@ protected static void generateCodeForArguments(MethodVisitor mv, CodeFlow cf, Me
String[] paramDescriptors = null;
boolean isVarargs = false;
if (member instanceof Constructor) {
Constructor<?> ctor = (Constructor<?>)member;
Constructor<?> ctor = (Constructor<?>) member;
paramDescriptors = CodeFlow.toDescriptors(ctor.getParameterTypes());
isVarargs = ctor.isVarArgs();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public ReflectiveMethodExecutor(Method method) {
}
}


public Method getMethod() {
return this.method;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

/**
* Tests for {@link JmsMessagingTemplate}.
*
*
* @author Stephane Nicoll
*/
public class JmsMessagingTemplateTests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public interface ContentTypeResolver {
* Determine the {@link MimeType} of a message from the given MessageHeaders.
* @param headers the headers to use for the resolution
* @return the resolved {@code MimeType}, or {@code null} if none found
* @throws org.springframework.util.InvalidMimeTypeException if the content type
* is a String that cannot be parsed
* @throws InvalidMimeTypeException if the content type is a String that cannot be parsed
* @throws IllegalArgumentException if there is a content type but its type is unknown
*/
@Nullable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ public ChannelRegistration interceptors(ChannelInterceptor... interceptors) {
}

/**
* Configure interceptors for the message channel.
* @deprecated as of 4.3.12, in favor of {@link #interceptors(ChannelInterceptor...)}
*/
@Deprecated
public ChannelRegistration setInterceptors(ChannelInterceptor... interceptors) {
return interceptors(interceptors);
public ChannelRegistration setInterceptors(@Nullable ChannelInterceptor... interceptors) {
if (interceptors != null) {
this.interceptors.addAll(Arrays.asList(interceptors));
}
return this;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ interface Subscription extends Receiptable {

/**
* Return the headers used on the SUBSCRIBE frame.
* @since 5.0
*/
StompHeaders getSubscriptionHeaders();

Expand All @@ -160,6 +161,7 @@ interface Subscription extends Receiptable {
* Alternative to {@link #unsubscribe()} with additional custom headers
* to send to the server.
* <p><strong>Note:</strong> There is no need to set the subscription id.
* @since 5.0
*/
void unsubscribe(@Nullable StompHeaders stompHeaders);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ public String toString() {
return "UserDestinationResult [source=" + this.sourceDestination + ", target=" + this.targetDestinations +
", subscribeDestination=" + this.subscribeDestination + ", user=" + this.user + "]";
}

}
2 changes: 1 addition & 1 deletion spring-oxm/spring-oxm.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ description = "Spring Object/XML Marshalling"

configurations {
castor
xjc
jibx
xjc
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ void setFlaggedForRollback(boolean flaggedForRollback) {
void startTransaction() {
Assert.state(this.transactionStatus == null,
"Cannot start a new transaction without ending the existing transaction first.");

this.flaggedForRollback = this.defaultRollback;
this.transactionStatus = this.transactionManager.getTransaction(this.transactionDefinition);
++this.transactionsStarted;

if (logger.isInfoEnabled()) {
logger.info(String.format(
"Began transaction (%s) for test context %s; transaction manager [%s]; rollback [%s]",
this.transactionsStarted, this.testContext, this.transactionManager, flaggedForRollback));
"Began transaction (%s) for test context %s; transaction manager [%s]; rollback [%s]",
this.transactionsStarted, this.testContext, this.transactionManager, flaggedForRollback));
}
}

Expand All @@ -113,14 +115,14 @@ void startTransaction() {
void endTransaction() {
if (logger.isTraceEnabled()) {
logger.trace(String.format(
"Ending transaction for test context %s; transaction status [%s]; rollback [%s]", this.testContext,
this.transactionStatus, flaggedForRollback));
"Ending transaction for test context %s; transaction status [%s]; rollback [%s]",
this.testContext, this.transactionStatus, this.flaggedForRollback));
}
Assert.state(this.transactionStatus != null, () -> String.format(
"Failed to end transaction for test context %s: transaction does not exist.", this.testContext));

try {
if (flaggedForRollback) {
if (this.flaggedForRollback) {
this.transactionManager.rollback(this.transactionStatus);
}
else {
Expand All @@ -132,8 +134,8 @@ void endTransaction() {
}

if (logger.isInfoEnabled()) {
logger.info(String.format("%s transaction for test context %s.", (flaggedForRollback ? "Rolled back"
: "Committed"), this.testContext));
logger.info(String.format("%s transaction for test context %s.",
(this.flaggedForRollback ? "Rolled back" : "Committed"), this.testContext));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -51,6 +51,7 @@
* return new ResponseEntity&lt;String&gt;("Hello World", responseHeaders, HttpStatus.CREATED);
* }
* </pre>
*
* Or, by using a builder accessible via static methods:
* <pre class="code">
* &#64;RequestMapping("/handle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ public ListenableFuture<ClientHttpResponse> executeAsync(HttpRequest request, by
return interceptor.intercept(request, body, this);
}
else {
URI theUri = request.getURI();
URI uri = request.getURI();
HttpMethod method = request.getMethod();
HttpHeaders headers = request.getHeaders();

Assert.state(method != null, "No standard HTTP method");
AsyncClientHttpRequest delegate = requestFactory.createAsyncRequest(theUri, method);
AsyncClientHttpRequest delegate = requestFactory.createAsyncRequest(uri, method);
delegate.getHeaders().putAll(headers);
if (body.length > 0) {
StreamUtils.copy(body, delegate.getBody());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
* {@link PathExtensionContentNegotiationStrategy#getMediaTypeForResource}
* with the ability to also look up through the ServletContext.
* @param resource the resource to look up
* @return the MediaType for the extension or {@code null}.
* @return the MediaType for the extension, or {@code null} if none found
* @since 4.3
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ private boolean validateIfNoneMatch(@Nullable String etag) {
etag = padEtagIfNecessary(etag);
while (ifNoneMatch.hasMoreElements()) {
String clientETags = ifNoneMatch.nextElement();
Matcher eTagMatcher = ETAG_HEADER_VALUE_PATTERN.matcher(clientETags);
Matcher etagMatcher = ETAG_HEADER_VALUE_PATTERN.matcher(clientETags);
// Compare weak/strong ETags as per https://tools.ietf.org/html/rfc7232#section-2.3
while (eTagMatcher.find()) {
if (StringUtils.hasLength(eTagMatcher.group()) &&
etag.replaceFirst("^W/", "").equals(eTagMatcher.group(3))) {
while (etagMatcher.find()) {
if (StringUtils.hasLength(etagMatcher.group()) &&
etag.replaceFirst("^W/", "").equals(etagMatcher.group(3))) {
this.notModified = true;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public DelegatingFilterProxy(String targetBeanName) {
* @see #setEnvironment(org.springframework.core.env.Environment)
*/
public DelegatingFilterProxy(String targetBeanName, @Nullable WebApplicationContext wac) {
Assert.hasText(targetBeanName, "target Filter bean name must not be null or empty");
Assert.hasText(targetBeanName, "Target Filter bean name must not be null or empty");
this.setTargetBeanName(targetBeanName);
this.webApplicationContext = wac;
if (wac != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* {@link SessionStatus#setComplete()}.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @since 3.1
*/
public class SessionAttributesHandler {
Expand Down Expand Up @@ -154,7 +155,7 @@ public void cleanupAttributes(WebRequest request) {
* A pass-through call to the underlying {@link SessionAttributeStore}.
* @param request the current request
* @param attributeName the name of the attribute of interest
* @return the attribute value or {@code null}
* @return the attribute value, or {@code null} if none
*/
@Nullable
Object retrieveAttribute(WebRequest request, String attributeName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ else if (corsConfigurations != null) {
/**
* Find the {@code ContentNegotiationManager} bean created by or registered
* with the {@code annotation-driven} element.
* @return a bean definition, bean reference, or null.
* @return a bean definition, bean reference, or {@code null}
*/
@Nullable
public static Object getContentNegotiationManager(ParserContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
* {@link org.springframework.beans.factory.xml.BeanDefinitionParser} that
* parses the following MVC namespace elements:
* <ul>
* <li>{@code <view-controller>}
* <li>{@code <redirect-view-controller>}
* <li>{@code <status-controller>}
* <li>{@code <view-controller>}
* <li>{@code <redirect-view-controller>}
* <li>{@code <status-controller>}
* </ul>
*
* <p>All elements result in the registration of a
Expand All @@ -56,7 +56,7 @@
class ViewControllerBeanDefinitionParser implements BeanDefinitionParser {

private static final String HANDLER_MAPPING_BEAN_NAME =
"org.springframework.web.servlet.config.viewControllerHandlerMapping";
"org.springframework.web.servlet.config.viewControllerHandlerMapping";


@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Loading

0 comments on commit efce790

Please sign in to comment.