Polishing

This commit is contained in:
Juergen Hoeller 2016-08-10 16:21:35 +02:00
parent 67ba187b6f
commit 35e247aa26
6 changed files with 24 additions and 16 deletions

View File

@ -174,7 +174,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
@Override
public String toString() {
return "local=[" + this.localRegistry + "], remote=" + this.remoteRegistries + "]";
return "local=[" + this.localRegistry + "], remote=" + this.remoteRegistries;
}
@ -260,7 +260,6 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
/**
* SimpUser that can be (de)serialized and broadcast to other servers.
*/
@SuppressWarnings("unused")
private static class TransferSimpUser implements SimpUser {
private String name;
@ -274,6 +273,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
/**
* Default constructor for JSON deserialization.
*/
@SuppressWarnings("unused")
public TransferSimpUser() {
this.sessions = new HashSet<TransferSimpSession>(1);
}
@ -368,7 +368,6 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
/**
* SimpSession that can be (de)serialized and broadcast to other servers.
*/
@SuppressWarnings("unused")
private static class TransferSimpSession implements SimpSession {
private String id;
@ -380,6 +379,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
/**
* Default constructor for JSON deserialization.
*/
@SuppressWarnings("unused")
public TransferSimpSession() {
this.subscriptions = new HashSet<TransferSimpSubscription>(4);
}

View File

@ -146,15 +146,12 @@ public class SqlScriptsTestExecutionListener extends AbstractTestExecutionListen
/**
* Execute the SQL scripts configured via the supplied {@link Sql @Sql}
* annotation for the given {@link ExecutionPhase} and {@link TestContext}.
*
* <p>Special care must be taken in order to properly support the configured
* {@link SqlConfig#transactionMode}.
*
* @param sql the {@code @Sql} annotation to parse
* @param executionPhase the current execution phase
* @param testContext the current {@code TestContext}
* @param classLevel {@code true} if {@link Sql @Sql} was declared at the
* class level
* @param classLevel {@code true} if {@link Sql @Sql} was declared at the class level
*/
private void executeSqlScripts(Sql sql, ExecutionPhase executionPhase, TestContext testContext, boolean classLevel)
throws Exception {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@ -86,7 +86,7 @@ abstract class ActiveProfilesUtils {
ActiveProfiles annotation = descriptor.synthesizeAnnotation();
if (logger.isTraceEnabled()) {
logger.trace(String.format("Retrieved @ActiveProfiles [%s] for declaring class [%s].",
logger.trace(String.format("Retrieved @ActiveProfiles [%s] for declaring class [%s]",
annotation, declaringClass.getName()));
}
@ -101,7 +101,7 @@ abstract class ActiveProfilesUtils {
}
catch (Exception ex) {
String msg = String.format("Could not instantiate ActiveProfilesResolver of type [%s] " +
"for test class [%s].", resolverClass.getName(), rootDeclaringClass.getName());
"for test class [%s]", resolverClass.getName(), rootDeclaringClass.getName());
logger.error(msg);
throw new IllegalStateException(msg, ex);
}
@ -109,7 +109,7 @@ abstract class ActiveProfilesUtils {
String[] profiles = resolver.resolve(rootDeclaringClass);
if (profiles == null) {
String msg = String.format(
"ActiveProfilesResolver [%s] returned a null array of bean definition profiles.",
"ActiveProfilesResolver [%s] returned a null array of bean definition profiles",
resolverClass.getName());
logger.error(msg);
throw new IllegalStateException(msg);

View File

@ -243,7 +243,7 @@ public class MockHttpServletRequestBuilder
* @param mediaTypes one or more media types
*/
public MockHttpServletRequestBuilder accept(MediaType... mediaTypes) {
Assert.notEmpty(mediaTypes, "No 'Accept' media types");
Assert.notEmpty(mediaTypes, "'mediaTypes' must not be empty");
this.headers.set("Accept", MediaType.toString(Arrays.asList(mediaTypes)));
return this;
}
@ -253,7 +253,7 @@ public class MockHttpServletRequestBuilder
* @param mediaTypes one or more media types
*/
public MockHttpServletRequestBuilder accept(String... mediaTypes) {
Assert.notEmpty(mediaTypes, "No 'Accept' media types");
Assert.notEmpty(mediaTypes, "'mediaTypes' must not be empty");
List<MediaType> result = new ArrayList<MediaType>(mediaTypes.length);
for (String mediaType : mediaTypes) {
result.add(MediaType.parseMediaType(mediaType));
@ -285,7 +285,6 @@ public class MockHttpServletRequestBuilder
* @param cookies the cookies to add
*/
public MockHttpServletRequestBuilder cookie(Cookie... cookies) {
Assert.notNull(cookies, "'cookies' must not be null");
Assert.notEmpty(cookies, "'cookies' must not be empty");
this.cookies.addAll(Arrays.asList(cookies));
return this;

View File

@ -288,7 +288,7 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
}
return HttpStatus.valueOf(response.getStatus()).is2xxSuccessful();
}
catch (IllegalArgumentException e) {
catch (IllegalArgumentException ex) {
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 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.
@ -62,10 +62,22 @@ public class ResourceHandlerRegistry {
private int order = Integer.MAX_VALUE -1;
/**
* Create a new resource handler registry for the given application context.
* @param applicationContext the Spring application context
* @param servletContext the corresponding Servlet context
*/
public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContext servletContext) {
this(applicationContext, servletContext, null);
}
/**
* Create a new resource handler registry for the given application context.
* @param applicationContext the Spring application context
* @param servletContext the corresponding Servlet context
* @param contentNegotiationManager the content negotiation manager to use
* @since 4.3
*/
public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContext servletContext,
ContentNegotiationManager contentNegotiationManager) {