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

@@ -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();
}