Polishing
This commit is contained in:
@@ -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.
|
||||
@@ -151,8 +151,7 @@ public class SimpleClientHttpRequestFactory implements ClientHttpRequestFactory,
|
||||
*/
|
||||
@Override
|
||||
public AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod) throws IOException {
|
||||
Assert.state(this.taskExecutor != null,
|
||||
"Asynchronous execution requires an AsyncTaskExecutor to be set");
|
||||
Assert.state(this.taskExecutor != null, "Asynchronous execution requires TaskExecutor to be set");
|
||||
|
||||
HttpURLConnection connection = openConnection(uri.toURL(), this.proxy);
|
||||
prepareConnection(connection, httpMethod.name());
|
||||
|
||||
@@ -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.
|
||||
@@ -44,14 +44,14 @@ import org.springframework.util.Assert;
|
||||
@SuppressWarnings("serial")
|
||||
public class UriTemplate implements Serializable {
|
||||
|
||||
private final String uriTemplate;
|
||||
|
||||
private final UriComponents uriComponents;
|
||||
|
||||
private final List<String> variableNames;
|
||||
|
||||
private final Pattern matchPattern;
|
||||
|
||||
private final String uriTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new {@code UriTemplate} with the given URI String.
|
||||
@@ -173,7 +173,6 @@ public class UriTemplate implements Serializable {
|
||||
|
||||
private final Pattern pattern;
|
||||
|
||||
|
||||
private TemplateInfo(List<String> vars, Pattern pattern) {
|
||||
this.variableNames = vars;
|
||||
this.pattern = pattern;
|
||||
@@ -187,7 +186,7 @@ public class UriTemplate implements Serializable {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
private static TemplateInfo parse(String uriTemplate) {
|
||||
public static TemplateInfo parse(String uriTemplate) {
|
||||
int level = 0;
|
||||
List<String> variableNames = new ArrayList<String>();
|
||||
StringBuilder pattern = new StringBuilder();
|
||||
@@ -216,8 +215,7 @@ public class UriTemplate implements Serializable {
|
||||
else {
|
||||
if (idx + 1 == variable.length()) {
|
||||
throw new IllegalArgumentException(
|
||||
"No custom regular expression specified after ':' " +
|
||||
"in \"" + variable + "\"");
|
||||
"No custom regular expression specified after ':' in \"" + variable + "\"");
|
||||
}
|
||||
String regex = variable.substring(idx + 1, variable.length());
|
||||
pattern.append('(');
|
||||
@@ -238,7 +236,7 @@ public class UriTemplate implements Serializable {
|
||||
}
|
||||
|
||||
private static String quote(StringBuilder builder) {
|
||||
return builder.length() != 0 ? Pattern.quote(builder.toString()) : "";
|
||||
return (builder.length() > 0 ? Pattern.quote(builder.toString()) : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa
|
||||
assertNull("Invalid content", entity.getBody());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getNoContentTypeHeader() throws Exception {
|
||||
Future<ResponseEntity<byte[]>> futureEntity = template.getForEntity(baseUrl + "/get/nocontenttype", byte[].class);
|
||||
@@ -127,7 +126,6 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa
|
||||
assertArrayEquals("Invalid content", helloWorld.getBytes("UTF-8"), responseEntity.getBody());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getNoContent() throws Exception {
|
||||
Future<ResponseEntity<String>> responseFuture = template.getForEntity(baseUrl + "/status/nocontent", String.class);
|
||||
|
||||
Reference in New Issue
Block a user