You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/08/04 15:39:06 UTC
[4/4] httpcomponents-core git commit: Remove redundant interfaces,
generics, and semicolons.
Remove redundant interfaces, generics, and semicolons.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/fc53fdd6
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/fc53fdd6
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/fc53fdd6
Branch: refs/heads/master
Commit: fc53fdd6695cdd6afe21d99769ff42bab60af917
Parents: 24fb4ec
Author: Gary Gregory <gg...@apache.org>
Authored: Sat Aug 4 09:00:20 2018 -0600
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sat Aug 4 17:31:56 2018 +0200
----------------------------------------------------------------------
.../hc/core5/http2/H2ConnectionException.java | 2 +-
.../hc/core5/http2/H2CorruptFrameException.java | 2 +-
.../java/org/apache/hc/core5/http2/H2Error.java | 2 +-
.../hc/core5/http2/H2StreamResetException.java | 2 +-
.../hc/core5/http2/HttpVersionPolicy.java | 2 +-
.../apache/hc/core5/http2/config/H2Param.java | 2 +-
.../apache/hc/core5/http2/config/H2Setting.java | 2 +-
.../hc/core5/http2/frame/FrameConsts.java | 2 +-
.../apache/hc/core5/http2/frame/FrameFlag.java | 2 +-
.../apache/hc/core5/http2/frame/FrameType.java | 2 +-
.../hc/core5/http2/hpack/HPackException.java | 2 +-
.../hc/core5/http2/impl/Http2Processors.java | 2 +-
.../nio/bootstrap/CancellableExecution.java | 2 +-
.../framework/ClassicTestClientAdapter.java | 4 +-
.../core5/testing/framework/FrameworkTest.java | 10 ++--
.../testing/framework/TestingFramework.java | 17 +++---
.../TestingFrameworkRequestHandler.java | 4 +-
.../TestClassicTestClientTestingAdapter.java | 36 ++++++------
.../framework/TestClientPOJOAdapter.java | 4 +-
.../testing/framework/TestFrameworkTest.java | 8 +--
.../testing/framework/TestTestingFramework.java | 58 ++++++++++----------
.../hc/core5/concurrent/ComplexCancellable.java | 2 +-
.../org/apache/hc/core5/http/ContentType.java | 2 +-
23 files changed, 86 insertions(+), 85 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java
index c77dae4..66e2c1c 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2ConnectionException.java
@@ -51,4 +51,4 @@ public class H2ConnectionException extends IOException {
return code;
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java
index 2fb1c91..275a9cb 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2CorruptFrameException.java
@@ -34,4 +34,4 @@ public class H2CorruptFrameException extends IOException {
super(message);
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java
index 130d5e2..6787c48 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2Error.java
@@ -153,4 +153,4 @@ public enum H2Error {
return MAP_BY_CODE.get(code);
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
index 3ee9101..7c497c2 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
@@ -51,4 +51,4 @@ public class H2StreamResetException extends IOException {
return code;
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java
index 237c864..867c619 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/HttpVersionPolicy.java
@@ -30,4 +30,4 @@ public enum HttpVersionPolicy {
FORCE_HTTP_1, FORCE_HTTP_2, NEGOTIATE
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
index 668e9eb..cc7294b 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
@@ -66,4 +66,4 @@ public enum H2Param {
return LOOKUP_TABLE[code - 1].name();
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
index a29242e..a57c8da 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
@@ -53,4 +53,4 @@ public final class H2Setting {
final StringBuilder sb = new StringBuilder().append(param).append(": ").append(value);
return sb.toString();
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
index 71d2207..cd47ee2 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
@@ -37,4 +37,4 @@ public final class FrameConsts {
public final static int MIN_FRAME_SIZE = 16384; // 2 ^ 14
public final static int MAX_FRAME_SIZE = 16777215; // 2 ^ 24 - 1;
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java
index 763aefb..eed6d9e 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFlag.java
@@ -52,4 +52,4 @@ public enum FrameFlag {
return value;
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java
index 235d851..bc7f9d9 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameType.java
@@ -70,4 +70,4 @@ public enum FrameType {
return LOOKUP_TABLE[value].name();
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java
index 55ca547..224d6d6 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackException.java
@@ -38,4 +38,4 @@ public class HPackException extends HttpException {
super(message, cause);
}
-};
+}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java
index 0f636b6..3468a7b 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/Http2Processors.java
@@ -78,7 +78,7 @@ public final class Http2Processors {
new RequestUserAgent(!TextUtils.isBlank(agentInfo) ? agentInfo :
VersionInfo.getSoftwareInfo(SOFTWARE, "org.apache.hc.core5", HttpProcessors.class)),
new RequestExpectContinue());
- };
+ }
public static HttpProcessor client(final String agentInfo) {
return customClient(agentInfo).build();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java
index e96a036..9468fee 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/CancellableExecution.java
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.hc.core5.concurrent.Cancellable;
import org.apache.hc.core5.concurrent.CancellableDependency;
-final class CancellableExecution implements CancellableDependency, Cancellable {
+final class CancellableExecution implements CancellableDependency {
private final AtomicBoolean cancelled;
private final AtomicReference<Cancellable> dependencyRef;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
index e2cf0a7..660d46c 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/ClassicTestClientAdapter.java
@@ -147,11 +147,11 @@ public class ClassicTestClientAdapter extends ClientPOJOAdapter {
final String contentType = entity == null ? null : entity.getContentType();
// prepare the returned information
- final Map<String, Object> ret = new HashMap<String, Object>();
+ final Map<String, Object> ret = new HashMap<>();
ret.put(STATUS, response.getCode());
// convert the headers to a Map
- final Map<String, Object> headerMap = new HashMap<String, Object>();
+ final Map<String, Object> headerMap = new HashMap<>();
for (final Header header : response.getAllHeaders()) {
headerMap.put(header.getName(), header.getValue());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java
index 6e61583..326a8f1 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/FrameworkTest.java
@@ -87,12 +87,12 @@ public class FrameworkTest {
*/
public Map<String, Object> initRequest() throws TestingFrameworkException {
// initialize to some helpful defaults
- final Map<String, Object> ret = new HashMap<String, Object>();
+ final Map<String, Object> ret = new HashMap<>();
ret.put(PATH, TestingFramework.DEFAULT_REQUEST_PATH);
ret.put(BODY, TestingFramework.DEFAULT_REQUEST_BODY);
ret.put(CONTENT_TYPE, TestingFramework.DEFAULT_REQUEST_CONTENT_TYPE);
- ret.put(QUERY, new HashMap<String, String>(TestingFramework.DEFAULT_REQUEST_QUERY));
- ret.put(HEADERS, new HashMap<String, String>(TestingFramework.DEFAULT_REQUEST_HEADERS));
+ ret.put(QUERY, new HashMap<>(TestingFramework.DEFAULT_REQUEST_QUERY));
+ ret.put(HEADERS, new HashMap<>(TestingFramework.DEFAULT_REQUEST_HEADERS));
ret.put(PROTOCOL_VERSION, TestingFramework.DEFAULT_REQUEST_PROTOCOL_VERSION);
// GET is the default method.
@@ -138,11 +138,11 @@ public class FrameworkTest {
response.put(STATUS, 200);
}
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
// initialize to some helpful defaults
responseExpectations.put(BODY, TestingFramework.DEFAULT_RESPONSE_BODY);
responseExpectations.put(CONTENT_TYPE, TestingFramework.DEFAULT_RESPONSE_CONTENT_TYPE);
- responseExpectations.put(HEADERS, new HashMap<String, String>(TestingFramework.DEFAULT_RESPONSE_HEADERS));
+ responseExpectations.put(HEADERS, new HashMap<>(TestingFramework.DEFAULT_RESPONSE_HEADERS));
// Now override any defaults with what is requested.
responseExpectations.putAll(response);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
index 371ea7d..8335efb 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFramework.java
@@ -56,6 +56,7 @@ import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
import org.apache.hc.core5.io.CloseMode;
public class TestingFramework {
+
/**
* Use the ALL_METHODS list to conveniently cycle through all HTTP methods.
*/
@@ -120,17 +121,17 @@ public class TestingFramework {
public static final Map<String, String> DEFAULT_RESPONSE_HEADERS;
static {
- final Map<String, String> request = new HashMap<String, String>();
+ final Map<String, String> request = new HashMap<>();
request.put("p1", "this");
request.put("p2", "that");
DEFAULT_REQUEST_QUERY = Collections.unmodifiableMap(request);
- Map<String, String> headers = new HashMap<String, String>();
+ Map<String, String> headers = new HashMap<>();
headers.put("header1", "stuff");
headers.put("header2", "more stuff");
DEFAULT_REQUEST_HEADERS = Collections.unmodifiableMap(headers);
- headers = new HashMap<String, String>();
+ headers = new HashMap<>();
headers.put("header3", "header_three");
headers.put("header4", "header_four");
DEFAULT_RESPONSE_HEADERS = Collections.unmodifiableMap(headers);
@@ -138,7 +139,7 @@ public class TestingFramework {
private ClientTestingAdapter adapter;
private TestingFrameworkRequestHandler requestHandler = new TestingFrameworkRequestHandler();
- private List<FrameworkTest> tests = new ArrayList<FrameworkTest>();
+ private List<FrameworkTest> tests = new ArrayList<>();
private HttpServer server;
private int port;
@@ -156,13 +157,13 @@ public class TestingFramework {
for (final String method : ALL_METHODS) {
final List<Integer> statusList = Arrays.asList(200, 201);
for (final Integer status : statusList) {
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
request.put(METHOD, method);
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, status);
- final Map<String, Object> test = new HashMap<String, Object>();
+ final Map<String, Object> test = new HashMap<>();
test.put(REQUEST, request);
test.put(RESPONSE, response);
@@ -402,7 +403,7 @@ public class TestingFramework {
* Deletes all tests.
*/
public void deleteTests() {
- tests = new ArrayList<FrameworkTest>();
+ tests = new ArrayList<>();
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java
index 9b460f6..2ab78eb 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/framework/TestingFrameworkRequestHandler.java
@@ -138,7 +138,7 @@ public class TestingFrameworkRequestHandler implements HttpRequestHandler {
if (expectedQuery != null) {
final URI uri = request.getUri();
final List<NameValuePair> actualParams = URLEncodedUtils.parse(uri, StandardCharsets.UTF_8);
- final Map<String, String> actualParamsMap = new HashMap<String, String>();
+ final Map<String, String> actualParamsMap = new HashMap<>();
for (final NameValuePair actualParam : actualParams) {
actualParamsMap.put(actualParam.getName(), actualParam.getValue());
}
@@ -162,7 +162,7 @@ public class TestingFrameworkRequestHandler implements HttpRequestHandler {
@SuppressWarnings("unchecked")
final Map<String, String> expectedHeaders = (Map<String, String>) requestExpectations.get(HEADERS);
if (expectedHeaders != null) {
- final Map<String, String> actualHeadersMap = new HashMap<String, String>();
+ final Map<String, String> actualHeadersMap = new HashMap<>();
final Header[] actualHeaders = request.getAllHeaders();
for (final Header header : actualHeaders) {
actualHeadersMap.put(header.getName(), header.getValue());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
index 0a22886..2df7f0c 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClassicTestClientTestingAdapter.java
@@ -77,9 +77,9 @@ public class TestClassicTestClientTestingAdapter {
final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
final String defaultURI = null;
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
try {
adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -96,7 +96,7 @@ public class TestClassicTestClientTestingAdapter {
final String defaultURI = "";
final Map<String, Object> request = null;
final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
try {
adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -111,9 +111,9 @@ public class TestClassicTestClientTestingAdapter {
final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
final String defaultURI = "";
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
final TestingFrameworkRequestHandler requestHandler = null;
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
try {
adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -128,7 +128,7 @@ public class TestClassicTestClientTestingAdapter {
final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
final String defaultURI = "";
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
final Map<String, Object> responseExpectations = null;
@@ -145,9 +145,9 @@ public class TestClassicTestClientTestingAdapter {
final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
final String defaultURI = "";
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
try {
adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -163,11 +163,11 @@ public class TestClassicTestClientTestingAdapter {
final String defaultURI = "";
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
request.put(PATH, ECHO_PATH);
final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
try {
adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -183,12 +183,12 @@ public class TestClassicTestClientTestingAdapter {
final String defaultURI = "";
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
request.put(PATH, ECHO_PATH);
request.put(METHOD, "JUNK");
final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
try {
adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -210,13 +210,13 @@ public class TestClassicTestClientTestingAdapter {
final HttpHost target = new HttpHost("localhost", this.server.getPort());
final String defaultURI = target.toString();
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
request.put(PATH, ECHO_PATH);
request.put(METHOD, "POST");
final String body = "mybody";
request.put(BODY, body);
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
final TestingFrameworkRequestHandler requestHandler = Mockito.mock(TestingFrameworkRequestHandler.class);
final Map<String, Object> response = adapter.execute(defaultURI, request, requestHandler, responseExpectations);
@@ -255,9 +255,9 @@ public class TestClassicTestClientTestingAdapter {
this.server.start();
final HttpHost target = new HttpHost("localhost", this.server.getPort());
final String defaultURI = target.toString();
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
request.put(PATH, CUSTOM_PATH);
for (final String method : TestingFramework.ALL_METHODS) {
@@ -271,7 +271,7 @@ public class TestClassicTestClientTestingAdapter {
public void modifyRequest() {
final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
final Map<String, Object> returnedRequest = adapter.modifyRequest(request);
Assert.assertSame("Same request was not returned as expected.", request, returnedRequest);
@@ -281,7 +281,7 @@ public class TestClassicTestClientTestingAdapter {
public void modifyResponseExpectations() {
final ClientTestingAdapter adapter = new ClassicTestClientTestingAdapter();
- final Map<String, Object> responseExpectations = new HashMap<String, Object>();
+ final Map<String, Object> responseExpectations = new HashMap<>();
final Map<String, Object> returnedResponseExpectations = adapter.modifyResponseExpectations(null, responseExpectations);
Assert.assertSame("Same response expectations were not returned as expected.", responseExpectations, returnedResponseExpectations);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
index 332d6ab..132e0ce 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestClientPOJOAdapter.java
@@ -36,7 +36,7 @@ public class TestClientPOJOAdapter {
@Test
public void modifyRequest() throws Exception {
final ClientPOJOAdapter adapter = new ClassicTestClientAdapter();
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
final Map<String, Object> request2 = adapter.modifyRequest(request);
Assert.assertSame("request should have been returned", request, request2);
@@ -69,7 +69,7 @@ public class TestClientPOJOAdapter {
@Override
public String getClientName() {
return null;
- };
+ }
};
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java
index 7b36152..57db424 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestFrameworkTest.java
@@ -89,8 +89,8 @@ public class TestFrameworkTest {
@Test
public void changeStatus() throws Exception {
- final Map<String, Object> testMap = new HashMap<String, Object>();
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> testMap = new HashMap<>();
+ final Map<String, Object> response = new HashMap<>();
testMap.put(RESPONSE, response);
response.put(STATUS, 201);
@@ -102,8 +102,8 @@ public class TestFrameworkTest {
@Test
public void changeMethod() throws Exception {
- final Map<String, Object> testMap = new HashMap<String, Object>();
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> testMap = new HashMap<>();
+ final Map<String, Object> request = new HashMap<>();
testMap.put(REQUEST, request);
request.put(METHOD, "POST");
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
index fd720ee..f1c6e4e 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
@@ -196,7 +196,7 @@ public class TestTestingFramework {
Assert.assertEquals("The responseExpectations do not match the defaults",
defaultResponseExpectations, responseExpectations);
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, responseExpectations.get(STATUS));
response.put(BODY, responseExpectations.get(BODY));
response.put(CONTENT_TYPE, responseExpectations.get(CONTENT_TYPE));
@@ -247,7 +247,7 @@ public class TestTestingFramework {
Assert.assertEquals(200, responseExpectations.get(STATUS));
// return a different status than expected.
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, 201);
return response;
}
@@ -267,7 +267,7 @@ public class TestTestingFramework {
private Map<String, Object> alreadyCheckedResponse() {
// return an indication that the response has already been checked.
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, TestingFramework.ALREADY_CHECKED);
response.put(BODY, TestingFramework.ALREADY_CHECKED);
response.put(CONTENT_TYPE, TestingFramework.ALREADY_CHECKED);
@@ -308,7 +308,7 @@ public class TestTestingFramework {
Assert.assertEquals(TestingFramework.DEFAULT_RESPONSE_BODY, responseExpectations.get(BODY));
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, TestingFramework.ALREADY_CHECKED);
// return a different body than expected.
@@ -341,7 +341,7 @@ public class TestTestingFramework {
Assert.assertEquals(TestingFramework.DEFAULT_RESPONSE_CONTENT_TYPE, responseExpectations.get(CONTENT_TYPE));
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, TestingFramework.ALREADY_CHECKED);
response.put(HEADERS, TestingFramework.ALREADY_CHECKED);
@@ -372,7 +372,7 @@ public class TestTestingFramework {
final Map<String, String> headersCopy = (Map<String, String>) TestingFramework.deepcopy(TestingFramework.DEFAULT_RESPONSE_HEADERS);
Assert.assertEquals(TestingFramework.DEFAULT_RESPONSE_HEADERS, headersCopy);
- final Map<String, Object> deepMap = new HashMap<String, Object>();
+ final Map<String, Object> deepMap = new HashMap<>();
deepMap.put(HEADERS, TestingFramework.DEFAULT_RESPONSE_HEADERS);
@SuppressWarnings("unchecked")
@@ -406,7 +406,7 @@ public class TestTestingFramework {
final String headerName = (String) headersCopy.keySet().toArray()[0];
headersCopy.remove(headerName);
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, TestingFramework.ALREADY_CHECKED);
response.put(BODY, TestingFramework.ALREADY_CHECKED);
@@ -447,7 +447,7 @@ public class TestTestingFramework {
final String headerName = (String) headersCopy.keySet().toArray()[0];
headersCopy.put(headerName, headersCopy.get(headerName) + "junk");
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, TestingFramework.ALREADY_CHECKED);
response.put(BODY, TestingFramework.ALREADY_CHECKED);
@@ -496,8 +496,8 @@ public class TestTestingFramework {
final TestingFramework framework = newFrameworkAndSetAdapter(adapter);
- final Map<String, Object> test = new HashMap<String, Object>();
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> test = new HashMap<>();
+ final Map<String, Object> request = new HashMap<>();
test.put(REQUEST, request);
request.put(NAME, "MyName");
@@ -531,8 +531,8 @@ public class TestTestingFramework {
final TestingFramework framework = newFrameworkAndSetAdapter(adapter);
- final Map<String, Object> test = new HashMap<String, Object>();
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> test = new HashMap<>();
+ final Map<String, Object> response = new HashMap<>();
test.put(RESPONSE, response);
response.put(STATUS, 201);
@@ -559,8 +559,8 @@ public class TestTestingFramework {
final TestingFramework framework = newFrameworkAndSetAdapter(adapter);
- final Map<String, Object> test = new HashMap<String, Object>();
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> test = new HashMap<>();
+ final Map<String, Object> response = new HashMap<>();
test.put(RESPONSE, response);
response.put(STATUS, 201);
@@ -828,7 +828,7 @@ public class TestTestingFramework {
// The next line is needed because we have to make a copy of the responseExpectations.
// It is an unmodifiable map.
- final Map<String, Object> tempResponseExpectations = new HashMap<String, Object>(responseExpectations);
+ final Map<String, Object> tempResponseExpectations = new HashMap<>(responseExpectations);
tempResponseExpectations.put(STATUS, 201);
final Map<String, Object> response = super.execute(defaultURI, request, requestHandler, tempResponseExpectations);
Assert.assertEquals(200, response.get(STATUS));
@@ -859,7 +859,7 @@ public class TestTestingFramework {
// make sure the modifyRequest method was called by seeing if the request was modified.
Assert.assertTrue("modifyRequest should have been called.", request.containsKey(UNLIKELY_ITEM));
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, responseExpectations.get(STATUS));
response.put(BODY, responseExpectations.get(BODY));
response.put(CONTENT_TYPE, responseExpectations.get(CONTENT_TYPE));
@@ -901,7 +901,7 @@ public class TestTestingFramework {
// make sure the modifyRequest method was called by seeing if the request was modified.
Assert.assertTrue("modifyResponseExpectations should have been called.", responseExpectations.containsKey(UNLIKELY_ITEM));
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
response.put(STATUS, responseExpectations.get(STATUS));
response.put(BODY, responseExpectations.get(BODY));
response.put(CONTENT_TYPE, responseExpectations.get(CONTENT_TYPE));
@@ -960,7 +960,7 @@ public class TestTestingFramework {
@Test
public void defaultTestsWithMockedAdapter() throws Exception {
- final Set<String> calledMethodSet = new HashSet<String>();
+ final Set<String> calledMethodSet = new HashSet<>();
final ClientTestingAdapter adapter = new ClientTestingAdapter() {
@Override
@@ -1023,20 +1023,20 @@ public class TestTestingFramework {
// ],
// )
- final Map<String, Object> test = new HashMap<String, Object>();
+ final Map<String, Object> test = new HashMap<>();
// Add request.
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
test.put(REQUEST, request);
request.put(PATH, "/stuff");
- final Map<String, Object> queryMap = new HashMap<String, Object>();
+ final Map<String, Object> queryMap = new HashMap<>();
request.put(QUERY, queryMap);
queryMap.put("param", "something");
- final Map<String, Object> requestHeadersMap = new HashMap<String, Object>();
+ final Map<String, Object> requestHeadersMap = new HashMap<>();
request.put(HEADERS, requestHeadersMap);
requestHeadersMap.put("header1", "stuff");
@@ -1046,12 +1046,12 @@ public class TestTestingFramework {
request.put(BODY, "What is the meaning of life?");
// Response
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
test.put(RESPONSE, response);
response.put(STATUS, 201);
- final Map<String, Object> responseHeadersMap = new HashMap<String, Object>();
+ final Map<String, Object> responseHeadersMap = new HashMap<>();
response.put(HEADERS, responseHeadersMap);
responseHeadersMap.put("header3", "header_stuff");
@@ -1092,10 +1092,10 @@ public class TestTestingFramework {
// ],
// )
- final Map<String, Object> test = new HashMap<String, Object>();
+ final Map<String, Object> test = new HashMap<>();
// Add request.
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
test.put(REQUEST, request);
request.put(PATH, null);
@@ -1109,7 +1109,7 @@ public class TestTestingFramework {
request.put(BODY, null);
// Response
- final Map<String, Object> response = new HashMap<String, Object>();
+ final Map<String, Object> response = new HashMap<>();
test.put(RESPONSE, response);
response.put(STATUS, null);
@@ -1150,10 +1150,10 @@ public class TestTestingFramework {
final TestingFramework framework = newFrameworkAndSetAdapter(adapter);
- final Map<String, Object> test = new HashMap<String, Object>();
+ final Map<String, Object> test = new HashMap<>();
// Add request.
- final Map<String, Object> request = new HashMap<String, Object>();
+ final Map<String, Object> request = new HashMap<>();
test.put(REQUEST, request);
request.put(PATH, "/stuff?stuffParm=stuff&stuffParm2=stuff2");
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java b/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java
index 7f2b46f..d2930b9 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/concurrent/ComplexCancellable.java
@@ -37,7 +37,7 @@ import org.apache.hc.core5.util.Args;
*
* @since 5.0
*/
-public final class ComplexCancellable implements Cancellable, CancellableDependency {
+public final class ComplexCancellable implements CancellableDependency {
private final AtomicReference<Cancellable> dependencyRef;
private final AtomicBoolean cancelled;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fc53fdd6/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java b/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java
index 4e48d8d..c67e15a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java
@@ -125,7 +125,7 @@ public final class ContentType implements Serializable {
TEXT_HTML,
TEXT_PLAIN,
TEXT_XML };
- final HashMap<String, ContentType> map = new HashMap<String, ContentType>();
+ final HashMap<String, ContentType> map = new HashMap<>();
for (final ContentType contentType: contentTypes) {
map.put(contentType.getMimeType(), contentType);
}