aboutsummaryrefslogtreecommitdiffstats
path: root/http-utils
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2019-12-02 14:59:08 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2019-12-02 15:35:49 +0100
commit313236a5df9390dbd54e37a31665ba6277dd2713 (patch)
treebed3c47132edd855fe880640dc577d9fe2110056 /http-utils
parent39c902f023ba4356a5bc9fd525dacf23b977eb04 (diff)
Build http-utils with jdk8 and remove reflection hack
Diffstat (limited to 'http-utils')
-rw-r--r--http-utils/pom.xml29
-rw-r--r--http-utils/src/main/java/ai/vespa/util/http/VespaHttpClientBuilder.java2
-rw-r--r--http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java3
3 files changed, 32 insertions, 2 deletions
diff --git a/http-utils/pom.xml b/http-utils/pom.xml
index aea402aef87..0d340922042 100644
--- a/http-utils/pom.xml
+++ b/http-utils/pom.xml
@@ -11,6 +11,13 @@
<artifactId>http-utils</artifactId>
<packaging>jar</packaging>
<version>7-SNAPSHOT</version>
+
+ <properties>
+ <!-- vespa-http-client targets jdk8 and uses this library -->
+ <!-- TODO remove once vespa-http-client no longer builds against jdk8 -->
+ <maven.compiler.release>8</maven.compiler.release>
+ </properties>
+
<dependencies>
<!-- provided -->
<dependency>
@@ -49,4 +56,26 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <jdkToolchain>
+ <version>${java.version}</version>
+ </jdkToolchain>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgs>
+ <arg>-Xlint:all</arg>
+ <arg>-Xlint:-serial</arg>
+ <arg>-Werror</arg>
+ </compilerArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/http-utils/src/main/java/ai/vespa/util/http/VespaHttpClientBuilder.java b/http-utils/src/main/java/ai/vespa/util/http/VespaHttpClientBuilder.java
index 529cfdc2aff..a408b0d79ae 100644
--- a/http-utils/src/main/java/ai/vespa/util/http/VespaHttpClientBuilder.java
+++ b/http-utils/src/main/java/ai/vespa/util/http/VespaHttpClientBuilder.java
@@ -71,7 +71,7 @@ public class VespaHttpClientBuilder {
}
private static HttpClientBuilder createBuilder(ConnectionManagerFactory connectionManagerFactory) {
- var builder = HttpClientBuilder.create();
+ HttpClientBuilder builder = HttpClientBuilder.create();
addSslSocketFactory(builder, connectionManagerFactory);
addHttpsRewritingRoutePlanner(builder);
return builder;
diff --git a/http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java b/http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java
index 85ee0913c58..b9a8fd748d6 100644
--- a/http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java
+++ b/http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java
@@ -6,6 +6,7 @@ import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.conn.routing.HttpRoute;
+import org.apache.http.conn.routing.HttpRoutePlanner;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -32,7 +33,7 @@ public class VespaHttpClientBuilderTest {
}
private static void verifyProcessedUriMatchesExpectedOutput(String inputHostString, String expectedHostString) throws HttpException {
- var routePlanner = new VespaHttpClientBuilder.HttpToHttpsRoutePlanner();
+ HttpRoutePlanner routePlanner = new VespaHttpClientBuilder.HttpToHttpsRoutePlanner();
HttpRoute newRoute = routePlanner.determineRoute(HttpHost.create(inputHostString), mock(HttpRequest.class), new HttpClientContext());
HttpHost target = newRoute.getTargetHost();
assertEquals(expectedHostString, target.toURI());