Replace space indentation with tabs

Issue: SPR-10127
This commit is contained in:
Phillip Webb
2012-12-19 14:55:41 -08:00
committed by Chris Beams
parent 1762157ad1
commit 2cf45bad86
154 changed files with 1481 additions and 1476 deletions

View File

@@ -229,7 +229,7 @@ public abstract class HttpServletBean extends HttpServlet
* @throws ServletException if any required properties are missing
*/
public ServletConfigPropertyValues(ServletConfig config, Set<String> requiredProperties)
throws ServletException {
throws ServletException {
Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
new HashSet<String>(requiredProperties) : null;
@@ -247,9 +247,9 @@ public abstract class HttpServletBean extends HttpServlet
// Fail if we are still missing properties.
if (missingProps != null && missingProps.size() > 0) {
throw new ServletException(
"Initialization from ServletConfig for servlet '" + config.getServletName() +
"' failed; the following required properties were missing: " +
StringUtils.collectionToDelimitedString(missingProps, ", "));
"Initialization from ServletConfig for servlet '" + config.getServletName() +
"' failed; the following required properties were missing: " +
StringUtils.collectionToDelimitedString(missingProps, ", "));
}
}
}

View File

@@ -191,7 +191,7 @@ public class ResourceServlet extends HttpServletBean {
*/
@Override
protected final void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
throws ServletException, IOException {
// determine URL of resource to include
String resourceUrl = determineResourceUrl(request);
@@ -247,7 +247,7 @@ public class ResourceServlet extends HttpServletBean {
* @throws IOException if thrown by the RequestDispatcher
*/
private boolean includeDefaultUrl(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
throws ServletException, IOException {
if (this.defaultUrl == null) {
return false;
@@ -265,13 +265,13 @@ public class ResourceServlet extends HttpServletBean {
* @throws IOException if thrown by the RequestDispatcher
*/
private void doInclude(HttpServletRequest request, HttpServletResponse response, String resourceUrl)
throws ServletException, IOException {
throws ServletException, IOException {
if (this.contentType != null) {
response.setContentType(this.contentType);
}
String[] resourceUrls =
StringUtils.tokenizeToStringArray(resourceUrl, RESOURCE_URL_DELIMITERS);
StringUtils.tokenizeToStringArray(resourceUrl, RESOURCE_URL_DELIMITERS);
for (int i = 0; i < resourceUrls.length; i++) {
// check whether URL matches allowed resources
if (this.allowedResources != null && !this.pathMatcher.match(this.allowedResources, resourceUrls[i])) {

View File

@@ -57,7 +57,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
String resourceRequestPath = element.getAttribute("mapping");
if (!StringUtils.hasText(resourceRequestPath)) {
parserContext.getReaderContext().error("The 'mapping' attribute is required.", parserContext.extractSource(element));
return null;
return null;
}
urlMap.put(resourceRequestPath, resourceHandlerName);
@@ -85,7 +85,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
String locationAttr = element.getAttribute("location");
if (!StringUtils.hasText(locationAttr)) {
parserContext.getReaderContext().error("The 'location' attribute is required.", parserContext.extractSource(element));
return null;
return null;
}
ManagedList<String> locations = new ManagedList<String>();

View File

@@ -35,7 +35,7 @@ public abstract class HandlerInterceptorAdapter implements AsyncHandlerIntercept
* This implementation always returns <code>true</code>.
*/
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
throws Exception {
return true;
}

View File

@@ -226,7 +226,7 @@ public abstract class AbstractWizardFormController extends AbstractFormControlle
*/
@Override
protected final void onBindAndValidate(HttpServletRequest request, Object command, BindException errors)
throws Exception {
throws Exception {
onBindAndValidate(request, command, errors, getCurrentPage(request));
}
@@ -248,7 +248,7 @@ public abstract class AbstractWizardFormController extends AbstractFormControlle
* @see org.springframework.validation.Errors
*/
protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors, int page)
throws Exception {
throws Exception {
}
/**
@@ -266,7 +266,7 @@ public abstract class AbstractWizardFormController extends AbstractFormControlle
*/
@Override
protected final Map referenceData(HttpServletRequest request, Object command, Errors errors)
throws Exception {
throws Exception {
return referenceData(request, command, errors, getCurrentPage(request));
}
@@ -286,7 +286,7 @@ public abstract class AbstractWizardFormController extends AbstractFormControlle
* @see ModelAndView
*/
protected Map referenceData(HttpServletRequest request, Object command, Errors errors, int page)
throws Exception {
throws Exception {
return referenceData(request, page);
}
@@ -315,7 +315,7 @@ public abstract class AbstractWizardFormController extends AbstractFormControlle
@Override
protected ModelAndView showForm(
HttpServletRequest request, HttpServletResponse response, BindException errors)
throws Exception {
throws Exception {
return showPage(request, errors, getInitialPage(request, errors.getTarget()));
}
@@ -331,7 +331,7 @@ public abstract class AbstractWizardFormController extends AbstractFormControlle
* @throws Exception in case of invalid state or arguments
*/
protected final ModelAndView showPage(HttpServletRequest request, BindException errors, int page)
throws Exception {
throws Exception {
if (page >= 0 && page < getPageCount(request, errors.getTarget())) {
if (logger.isDebugEnabled()) {

View File

@@ -434,7 +434,7 @@ public abstract class BaseCommandController extends AbstractController {
* @see #initBinder
*/
protected ServletRequestDataBinder createBinder(HttpServletRequest request, Object command)
throws Exception {
throws Exception {
ServletRequestDataBinder binder = new ServletRequestDataBinder(command, getCommandName());
prepareBinder(binder);

View File

@@ -138,7 +138,7 @@ public class WebContentInterceptor extends WebContentGenerator implements Handle
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws ServletException {
throws ServletException {
String lookupPath = this.urlPathHelper.getLookupPathForRequest(request);
if (logger.isDebugEnabled()) {

View File

@@ -500,7 +500,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
* @return the HttpInputMessage instance to use
* @throws Exception in case of errors
*/
protected HttpInputMessage createHttpInputMessage(HttpServletRequest servletRequest) throws Exception {
protected HttpInputMessage createHttpInputMessage(HttpServletRequest servletRequest) throws Exception {
return new ServletServerHttpRequest(servletRequest);
}
@@ -512,7 +512,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
* @return the HttpInputMessage instance to use
* @throws Exception in case of errors
*/
protected HttpOutputMessage createHttpOutputMessage(HttpServletResponse servletResponse) throws Exception {
protected HttpOutputMessage createHttpOutputMessage(HttpServletResponse servletResponse) throws Exception {
return new ServletServerHttpResponse(servletResponse);
}
@@ -803,7 +803,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
return AnnotationMethodHandlerAdapter.this.createHttpInputMessage(servletRequest);
}
@Override
@Override
protected HttpOutputMessage createHttpOutputMessage(NativeWebRequest webRequest) throws Exception {
HttpServletResponse servletResponse = (HttpServletResponse) webRequest.getNativeResponse();
return AnnotationMethodHandlerAdapter.this.createHttpOutputMessage(servletResponse);

View File

@@ -82,8 +82,8 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
* {@link #writeWithMessageConverters(Object, MethodParameter, ServletServerHttpRequest, ServletServerHttpResponse)}
*/
protected <T> void writeWithMessageConverters(T returnValue,
MethodParameter returnType,
NativeWebRequest webRequest)
MethodParameter returnType,
NativeWebRequest webRequest)
throws IOException, HttpMediaTypeNotAcceptableException {
ServletServerHttpRequest inputMessage = createInputMessage(webRequest);
ServletServerHttpResponse outputMessage = createOutputMessage(webRequest);
@@ -103,9 +103,9 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
*/
@SuppressWarnings("unchecked")
protected <T> void writeWithMessageConverters(T returnValue,
MethodParameter returnType,
ServletServerHttpRequest inputMessage,
ServletServerHttpResponse outputMessage)
MethodParameter returnType,
ServletServerHttpRequest inputMessage,
ServletServerHttpResponse outputMessage)
throws IOException, HttpMediaTypeNotAcceptableException {
Class<?> returnValueClass = returnValue.getClass();
@@ -173,11 +173,11 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
}
else if (!allSupportedMediaTypes.isEmpty()) {
List<MediaType> result = new ArrayList<MediaType>();
for (HttpMessageConverter<?> converter : messageConverters) {
if (converter.canWrite(returnValueClass, null)) {
result.addAll(converter.getSupportedMediaTypes());
}
}
for (HttpMessageConverter<?> converter : messageConverters) {
if (converter.canWrite(returnValueClass, null)) {
result.addAll(converter.getSupportedMediaTypes());
}
}
return result;
}
else {
@@ -199,4 +199,4 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) <= 0 ? acceptType : produceType;
}
}
}

View File

@@ -55,7 +55,7 @@ public abstract class RequestContextUtils {
* @throws IllegalStateException if no servlet-specific context has been found
*/
public static WebApplicationContext getWebApplicationContext(ServletRequest request)
throws IllegalStateException {
throws IllegalStateException {
return getWebApplicationContext(request, null);
}

View File

@@ -117,14 +117,14 @@ public class ButtonTag extends AbstractHtmlElementTag {
tagWriter.writeAttribute("value", processFieldValue(getName(), valueToUse, getType()));
}
/**
* Return the default value.
*
* @return The default value if none supplied.
*/
protected String getDefaultValue() {
return "Submit";
}
/**
* Return the default value.
*
* @return The default value if none supplied.
*/
protected String getDefaultValue() {
return "Submit";
}
/**
* Get the value of the '<code>type</code>' attribute. Subclasses

View File

@@ -31,69 +31,69 @@ import org.springframework.util.Assert;
*/
public abstract class FreePortScanner {
private static final int MIN_SAFE_PORT = 1024;
private static final int MIN_SAFE_PORT = 1024;
private static final int MAX_PORT = 65535;
private static final int MAX_PORT = 65535;
private static final Random random = new Random();
private static final Random random = new Random();
/**
* Returns the number of a free port in the default range.
*/
public static int getFreePort() {
return getFreePort(MIN_SAFE_PORT, MAX_PORT);
}
/**
* Returns the number of a free port in the default range.
*/
public static int getFreePort() {
return getFreePort(MIN_SAFE_PORT, MAX_PORT);
}
/**
* Returns the number of a free port in the given range.
*/
public static int getFreePort(int minPort, int maxPort) {
Assert.isTrue(minPort > 0, "'minPort' must be larger than 0");
Assert.isTrue(maxPort > minPort, "'maxPort' must be larger than minPort");
int portRange = maxPort - minPort;
int candidatePort;
int searchCounter = 0;
do {
if (++searchCounter > portRange) {
throw new IllegalStateException(
String.format("There were no ports available in the range %d to %d", minPort, maxPort));
}
candidatePort = getRandomPort(minPort, portRange);
}
while (!isPortAvailable(candidatePort));
/**
* Returns the number of a free port in the given range.
*/
public static int getFreePort(int minPort, int maxPort) {
Assert.isTrue(minPort > 0, "'minPort' must be larger than 0");
Assert.isTrue(maxPort > minPort, "'maxPort' must be larger than minPort");
int portRange = maxPort - minPort;
int candidatePort;
int searchCounter = 0;
do {
if (++searchCounter > portRange) {
throw new IllegalStateException(
String.format("There were no ports available in the range %d to %d", minPort, maxPort));
}
candidatePort = getRandomPort(minPort, portRange);
}
while (!isPortAvailable(candidatePort));
return candidatePort;
}
return candidatePort;
}
private static int getRandomPort(int minPort, int portRange) {
return minPort + random.nextInt(portRange);
}
private static int getRandomPort(int minPort, int portRange) {
return minPort + random.nextInt(portRange);
}
private static boolean isPortAvailable(int port) {
ServerSocket serverSocket;
try {
serverSocket = new ServerSocket();
}
catch (IOException ex) {
throw new IllegalStateException("Unable to create ServerSocket.", ex);
}
private static boolean isPortAvailable(int port) {
ServerSocket serverSocket;
try {
serverSocket = new ServerSocket();
}
catch (IOException ex) {
throw new IllegalStateException("Unable to create ServerSocket.", ex);
}
try {
InetSocketAddress sa = new InetSocketAddress(port);
serverSocket.bind(sa);
return true;
}
catch (IOException ex) {
return false;
}
finally {
try {
serverSocket.close();
}
catch (IOException ex) {
// ignore
}
}
}
try {
InetSocketAddress sa = new InetSocketAddress(port);
serverSocket.bind(sa);
return true;
}
catch (IOException ex) {
return false;
}
finally {
try {
serverSocket.close();
}
catch (IOException ex) {
// ignore
}
}
}
}

View File

@@ -152,8 +152,8 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
pvs = new MutablePropertyValues();
pvs.add("order", "1");
pvs.add("exceptionMappings",
"java.lang.IllegalAccessException=failed2\n" +
"ServletRequestBindingException=failed3");
"java.lang.IllegalAccessException=failed2\n" +
"ServletRequestBindingException=failed3");
pvs.add("defaultErrorView", "failed0");
registerSingleton("exceptionResolver1", SimpleMappingExceptionResolver.class, pvs);
@@ -250,7 +250,7 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
}
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object delegate)
throws ServletException, IllegalAccessException {
throws ServletException, IllegalAccessException {
((MyHandler) delegate).doSomething(request);
return null;
}
@@ -268,7 +268,7 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
}
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object delegate)
throws IOException, ServletException {
throws IOException, ServletException {
throw new ServletException("dummy");
}
@@ -281,7 +281,7 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
public static class MyHandlerInterceptor1 implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws ServletException {
throws ServletException {
if (request.getAttribute("test2") != null) {
throw new ServletException("Wrong interceptor order");
}
@@ -317,7 +317,7 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
public static class MyHandlerInterceptor2 implements HandlerInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws ServletException {
throws ServletException {
if (request.getAttribute("test1x") == null) {
throw new ServletException("Wrong interceptor order");
}

View File

@@ -405,21 +405,21 @@ public class WizardFormControllerTests extends TestCase {
errors.rejectValue("age", "AGE_REQUIRED", null, "Age is required");
}
break;
default:
default:
throw new IllegalArgumentException("Invalid page number");
}
}
protected ModelAndView processFinish(
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
throws ServletException, IOException {
throws ServletException, IOException {
assertTrue(getCurrentPage(request) == 0 || getCurrentPage(request) == 1);
return new ModelAndView("success", getCommandName(), command);
}
protected ModelAndView processCancel(
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
throws ServletException, IOException {
throws ServletException, IOException {
assertTrue(getCurrentPage(request) == 0 || getCurrentPage(request) == 1);
return new ModelAndView("cancel", getCommandName(), command);
}

View File

@@ -183,7 +183,7 @@ public class Spr7839Tests {
public static class JavaBean {
private NestedBean nested;
private NestedBean nested;
public NestedBean getNested() {
return nested;
@@ -198,25 +198,25 @@ public class Spr7839Tests {
public static class NestedBean {
private String foo;
private String foo;
private List<NestedBean> list;
private List<NestedBean> list;
private List<List<NestedBean>> listOfLists;
private List<List<NestedBean>> listOfLists;
private List<NestedBean>[] arrayOfLists;
private List<NestedBean>[] arrayOfLists;
private Map<String, NestedBean> map;
private Map<String, NestedBean> map;
private Map<String, List<Integer>> mapOfLists;
private Map<String, List<Integer>> mapOfLists;
public NestedBean() {
public NestedBean() {
}
}
public NestedBean(String foo) {
this.foo = foo;
}
public NestedBean(String foo) {
this.foo = foo;
}
public String getFoo() {
return foo;

View File

@@ -107,8 +107,8 @@ public class RequestPartIntegrationTests {
converter.setPartConverters(Arrays.<HttpMessageConverter<?>>asList(
new ResourceHttpMessageConverter(), new MappingJacksonHttpMessageConverter()));
restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(converter));
restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(converter));
}
@AfterClass
@@ -174,10 +174,10 @@ public class RequestPartIntegrationTests {
@RequestMapping(value = "/test", method = RequestMethod.POST, consumes = { "multipart/mixed", "multipart/form-data" })
public ResponseEntity<Object> create(@RequestPart("json-data") TestData testData, @RequestPart("file-data") MultipartFile file) {
String url = "http://localhost:8080/test/" + testData.getName() + "/" + file.getOriginalFilename();
HttpHeaders headers = new HttpHeaders();
String url = "http://localhost:8080/test/" + testData.getName() + "/" + file.getOriginalFilename();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(URI.create(url));
return new ResponseEntity<Object>(headers, HttpStatus.CREATED);
return new ResponseEntity<Object>(headers, HttpStatus.CREATED);
}
}

View File

@@ -87,7 +87,7 @@ public class DispatcherServletInitializerTests {
@Override
public ServletRegistration.Dynamic addServlet(String servletName,
Servlet servlet) {
Servlet servlet) {
servlets.put(servletName, servlet);
MockServletRegistration registration = new MockServletRegistration();
registrations.put(servletName, registration);

View File

@@ -368,7 +368,7 @@ public class MappingJackson2JsonViewTests {
}
@Override
public JsonSerializer<Object> createSerializer(SerializerProvider prov, JavaType type, BeanProperty property) throws JsonMappingException {
public JsonSerializer<Object> createSerializer(SerializerProvider prov, JavaType type, BeanProperty property) throws JsonMappingException {
if (type.getRawClass() == TestBeanSimple.class) {
return new TestBeanSimpleSerializer();
}